c# - How to send email using threading when new record in inserted before return a data ? how to achieve that -
i need send email concern employee when ever complain posted against him.in insertion record inserted , same details returned user .
i want send email using threading in c# that,i created email method don't know how use it.
code:
public string insert(string context) { sam_erpentities entities = new sam_erpentities(); dynamic list = utility.desearlizejson(context); int userid = new base().userid; int departmentid = utility.intval(list["departmentid"]); empcomplaint.complainttypeid = utility.intval(list["complainttypeid"]); empcomplaint.complaintstatusid = utility.intval(list["complaintstatusid"]); empcomplaint.departmentid = utility.intval(list["departmentid"]); empcomplaint.complaintsubject = utility.strval(list["complaintsubject"]); empcomplaint.complaintnotes = utility.strval(list["complaintnotes"]); empcomplaint.createdby = utility.intval(new base().employeeid(userid)); empcomplaint.applicantemployeeid = utility.intval(new base().employeeid(userid)); empcomplaint.approveremployeeid = utility.intval(new base().departmentsupervisorid(empcomplaint.departmentid)); empcomplaint.createddate = datetime.now; empcomplaint.isactive = true; entities.addtoempcomplaints(empcomplaint); entities.savechanges(); deliverables _deliverables = new deliverables(); _deliverables.notifycomplaintdepartment(departmentid, empcomplaint.complaintid); var inserteddate = c in entities.empcomplaints join e in entities.employees on c.applicantemployeeid equals e.employeeid join e1 in entities.employees on c.applicantemployeeid equals e1.employeeid join ct in entities.empcomplainttypes on c.complainttypeid equals ct.complainttypeid join d in entities.empdepartments on c.departmentid equals d.departmentid c.complaintid == empcomplaint.complaintid && c.isactive == true select new { complaintid = c.complaintid, applicantemployeeid = c.applicantemployeeid, complainttypeid = c.complainttypeid, departmentid = c.departmentid, applicantname = e.fullname, approvername = e1.fullname, complaintsubject = c.complaintsubject, complaintnotes = c.complaintnotes, isactive = c.isactive, createdby = c.createdby, updateddate = c.updateddate }; return utility.newtonserialize(inserteddate); }
i want reponse send user withpout delay n email send using threading ...
method call using threading :
deliverables _deliverables = new deliverables(); _deliverables.notifycomplaintdepartment(departmentid, empcomplaint.complaintid);
*edit :
i found if need return data after insert ???????
[webmethod] public bool callingmethod(int num1,int num2) { employee emp=new employee(); thread t=new thread(emp.method(num1,num2)); t.start(); return "mydatastring"; } public class employee { public void method(int ,int b) { logic... } }
Comments
Post a Comment