Shantha - Monday, February 18, 2013 12:20 AM:
Hi Team,
I tried in my machine able to schedule a email so i did same in my client machine follwoing are the things i did...,
1.Innovator services is started in services
2.Checked SMTP it is running fine.
3.Created a server method C# to schedule a email
//System.Diagnostics.Debugger.Break();
Innovator inn = this.getInnovator();
Item st_base = this.newItem("st_base_Instrument","get");
Item st_issue = this.newItem("st_Issue_Instrument","get");
Item inst = st_base.apply();
Item inst1 = st_issue.apply();
int count=90;
int count1 = 90;
for (int i=0; i<count; ++i)
{
string ExpiryStr;
ExpiryStr=inst.getItemByIndex(i).getProperty("expiry_date");
if(ExpiryStr==null)
{
return this;
}
else
{
DateTime theDate;
theDate = DateTime.Now;
DateTime startDt =(theDate);
DateTime endDt = DateTime.Parse(ExpiryStr);
if (DateTime.Compare(endDt, startDt) <= 0)
{
//Item err = inn.newError("Your finish date must be greater than your start date!!!");
//return err;
}
else
{
TimeSpan date_diff = endDt - startDt;
int days = date_diff.Days;
if (Convert.ToInt32(days)<= 20)
{
Item email_msg = this.newItem("Email Message", "get");
email_msg.setProperty("name", "Expiry Reminder");
email_msg = email_msg.apply();
//Get admin Identity
Item iden = this.newItem("Identity", "get");
iden.setProperty("name", "Innovator Admin");
iden = iden.apply();
bool result = this.email(email_msg, iden);
//this.getInnovator().newError("Mail sent");
if (!result)
{
return this.getInnovator().newError("Mail not sent");
}
}
}
}
}
return this;
for (int i=0; i<count1; ++i)
{
string borrowStr;
borrowStr=inst1.getItemByIndex(i).getProperty("created_on");
if(borrowStr==null)
{
return this;
}
else
{
DateTime theDate;
theDate = DateTime.Now;
DateTime startDt1 =(theDate);
DateTime endDt1 = DateTime.Parse(borrowStr);
if (DateTime.Compare(endDt1, startDt1) <= 0)
{
//Item err1 = inn.newError("Your finish date must be greater than your start date!!!");
//return err1;
}
else
{
TimeSpan date_diff1 = endDt1 - startDt1;
int days1 = date_diff1.Days;
if (Convert.ToInt32(days1)>= 45)
{
Item email_msg1 = this.newItem("Email Message", "get");
email_msg1.setProperty("name", "Borrow Instrument Reminder");
email_msg1 = email_msg1.apply();
//Get admin Identity
Item iden1 = this.newItem("Identity", "get");
iden1.setProperty("name", "Innovator Admin");
iden1 = iden1.apply();
bool result1 = this.email(email_msg1, iden1);
//this.getInnovator().newError("Mail sent");
if (!result1)
{
return this.getInnovator().newError("Mail not sent");
}
}
}
}
}
return this;
4.Updated the above method name in Innovatorconfig.xml file provided timings as 10 mins inside schedular folder.
5.Checked Event viewer the services gets wake up every minute.
By doubt lies here but never triggering a email. Whats wrong with the system. same method is running in my machine and triggereing email but this not happening in client pc. Can some one point out my mistake where im doing error. Thanks in advance.
Thanks,
Shantha.
Shantha - Monday, February 18, 2013 12:39 AM:
Hi Team,
I even tested following line in nash.aspx
1.ApplyItem > <Item type="Method" action="sh_ExpiryEmail" />
It runs fine and thus confirms in my method no error. But where the problem lies why the services not triggering email once it gets wake up. Guide me.
Thanks,
Shantha.