public ActionResult SaveRepresentative(int UserID) { Users DepRepInfo = Data_Users.GetDepRepInfo((string)Session["DeptID"]); int prev_DepRep = DepRepInfo.UserID; int Confirm = Data_Users.AssignRepresentative(UserID); if (Confirm != 0) { Data_Users.RemoveRepresentative(prev_DepRep); } //Email Alert to Department Staff and clerk for Assign Representative. SendEmailNotification sen = new SendEmailNotification(); // Deparmentrep Info = Data_User.RequestInfo(ID); int empID = UserID; //Email to staff who have assigned as Department Representative Users userInfo = Data_Users.GetInfoByUserID(empID); Users ClerkInfo = Data_Users.GetStoreClerkInfo(userInfo.DeptID_FK); Department department = Data_Department.GetDepartmentInfoByID(userInfo.DeptID_FK); String Useremail = userInfo.EmailID; String EmailSubject = " Change for department representative"; String EmailBody = "<p> Dear " + userInfo.Username + ",</p>"; EmailBody += "<p>You have been assigned as Department Representative for " + department.Departmentname + "."; EmailBody += "<p>Thank you<br/>Logic University Staionery Store</p>"; EmailBody += "<p> Please do not reply to this email it is auto-generated.</p>"; sen.SendEmailHTML(Useremail, EmailSubject, EmailBody); //Send email to Store Clerk for changing Department representative String EmailSubject1 = "Change for department representative"; //String EmailBody = "<p>Dear Yee Mon , </p>"; String EmailBody1 = "<p> Dear " + ClerkInfo.Username + ",</p>"; EmailBody1 += "<p>I am " + userInfo.Username + " currently the Department Representative for " + department.Departmentname + ". We are pleased to say that we have changed new assign representative for <b> " + department.Departmentname + "</b>. The new representative is <b>" + ClerkInfo.Username + ".</p>"; EmailBody1 += "<p>Thank you<br/>Logic University Staionery Store</p>"; EmailBody1 += "<p> Please do not reply to this email it is auto-generated.</p>"; sen.SendEmailHTML(ClerkInfo.EmailID, EmailSubject1, EmailBody1); return(RedirectToAction("Assginrepresentative")); }
public ActionResult UpdateCP(string DepartmentID, string Collectionpoint) { bool res = Data_Department.UpdateCollectionPoint(DepartmentID, Collectionpoint); SendEmailNotification sen = new SendEmailNotification(); Users userInfo = Data_Users.GetInfoByUserID((int)Session["UserID"]); Department department = Data_Department.GetDepartmentInfoByID(userInfo.DeptID_FK); Users ClerkInfo = Data_Users.GetStoreClerkInfo(userInfo.DeptID_FK); String EmailSubject = "Change Collection Point for " + department.Departmentname; String EmailBody = "<p> Dear " + ClerkInfo.Username + ",</p>"; EmailBody += "<p>I am " + userInfo.Username + " currently the Department Representative for " + department.Departmentname + ". We are pleased to say that Collection point for <b> " + department.Departmentname + "</b> is amended . The updatest collection point is <b>" + Collectionpoint + ".</p>"; EmailBody += "<p>Thank you<br/>Logic University Staionery Store</p>"; EmailBody += "<p> Please do not reply to this email it is auto-generated.</p>"; sen.SendEmailHTML(ClerkInfo.EmailID, EmailSubject, EmailBody); return(RedirectToAction("CollectionPoint")); }