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 SubmitRequisition(List <WishList> wishListofusers) //triggreed when Request is submitted { using (SqlConnection conn = new SqlConnection(DataLink.connectionString)) { conn.Open(); string cmdtext = @"insert into RequisitionList (statusOfRequest,DateOfSubmission,DeptID_FK,UserID_FK) values ('PendingforApproval'" + ",'" + DateTime.Today.ToString("yyyy-MM-dd") + "','" + (String)Session["DeptID"] + "','" + (int)Session["UserID"] + "')"; SqlCommand cmd = new SqlCommand(cmdtext, conn); cmd.ExecuteNonQuery(); } int requestID = getRequisitionID(); Debug.WriteLine(requestID); foreach (WishList wt in wishListofusers) { //int Temp = wt.ItemID.Length; /*Debug.WriteLine(wt.ItemID); * Debug.WriteLine(wt.ItemName); * Debug.WriteLine(wt.UOM); * Debug.WriteLine(wt.RequiredQuantity);*/ using (SqlConnection conn = new SqlConnection(DataLink.connectionString)) { conn.Open(); string cmdtext = @"insert into RequisitionDetail (RequisitionID,ItemID,RequisitionQuantity) values ('" + requestID + "','" + wt.ItemID + "','" + wt.RequiredQuantity + "')"; SqlCommand cmd = new SqlCommand(cmdtext, conn); cmd.ExecuteNonQuery(); } } clearWishList((int)Session["UserID"]); //Email Alert to users fpr placing order. SendEmailNotification sen = new SendEmailNotification(); Users userInfo = Data_Users.GetInfoByUserID((int)Session["UserID"]); Department department = Data_Department.GetDepartmentInfoByID(userInfo.DeptID_FK); String Useremail = userInfo.EmailID; String EmailSubject = "Request Submitted RequisitionID#" + requestID; String EmailBody = "<p> Dear " + userInfo.Username + ",</p>"; EmailBody += "<p>Your order has been succesfully submitted here is the OrderID " + requestID + " for your reference. Currently, it is been pending for approval from your " + department.DepartmentHead + ".</br> We will notify you once it approved.</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(Useremail, EmailSubject, EmailBody); return(RedirectToAction("MyRequisitions")); }
public ActionResult DisbursmentList() { string deptID = (string)Session["DeptID"]; Data_DisbursementList DList = new Data_DisbursementList(); List <DisbursementList> dlist = DList.FindDisbursementListByDepartmentID(deptID); ViewBag.ListofDisbursement = dlist; Users users = Data_Users.GetInfoByUserID((int)Session["UserID"]); ViewData["Userinfo"] = users; return(View()); }
public ActionResult RequisitionForm() //Display requisition form { int ID = (int)Session["UserID"]; Data_RequisitionForm Rc = new Data_RequisitionForm(); List <WishList> Lt_wishlist = Rc.wishList(ID); ViewBag.wishList = Lt_wishlist; Users users = Data_Users.GetInfoByUserID((int)Session["UserID"]); ViewData["Userinfo"] = users; return(View()); }
public ActionResult MyRequisitions() { int userID = (int)Session["UserID"]; Data_MyRequisitions My = new Data_MyRequisitions(); List <RequisitionList> requisitionLists = My.getRequisitionList(userID); ViewBag.ListofRequest = requisitionLists; Users users = Data_Users.GetInfoByUserID((int)Session["UserID"]); ViewData["Userinfo"] = users; return(View()); }
public ActionResult ViewDisbursementDetail(DisbursementList dlist) { Data_DisbursementDetails details = new Data_DisbursementDetails(); List <Stationary> DetailsOfDisbursement = details.DisbursementDetails(dlist.DisbursementID); ViewBag.DetailsOfDisbursement = DetailsOfDisbursement; ViewData["DisbursementID"] = dlist.DisbursementID; ViewData["DisbursementStatus"] = dlist.DisbursementStatus; Users users = Data_Users.GetInfoByUserID((int)Session["UserID"]); ViewData["Userinfo"] = users; return(View()); }
public ActionResult ViewRequestInfo(RequisitionList r) { Data_RequestDetails ReqDetails = new Data_RequestDetails(); List <WishList> DetailsOfRequest = ReqDetails.RequestDetails(r.RequisitionID); ViewBag.DetailsOfRequest = DetailsOfRequest; ViewData["RequestID"] = r.RequisitionID; ViewData["Dateofsub"] = r.DateofSubmission; ViewData["status"] = r.statusOfRequest; Users users = Data_Users.GetInfoByUserID((int)Session["UserID"]); ViewData["Userinfo"] = users; return(View()); }
public ActionResult RejectRequest(int ID, string Comments) { Data_CancelRequest DC = new Data_CancelRequest(); if (Comments.Length == 0) { DC.RejectRequest(ID); } else { DC.RejectRequestwithComments(ID, Comments); } //return RedirectToAction("ApproveRequisition"); //Email Alert to users for Reject request. SendEmailNotification sen = new SendEmailNotification(); // Users userInfo = Data_Users.GetInfoByUserID((int)Session["UserID"]); RequisitionList requestInfo = Data_CancelRequest.RequestInfo(ID); int empID = (int)requestInfo.UserID_FK; Users userInfo = Data_Users.GetInfoByUserID(empID); Department department = Data_Department.GetDepartmentInfoByID(userInfo.DeptID_FK); String Useremail = userInfo.EmailID; String EmailSubject = "Request Rejected for RequisitionID#" + ID; String EmailBody = "<p> Dear " + userInfo.Username + ",</p>"; EmailBody += "<p>Your request " + ID + " has been Rejected by the the your Department Head " + department.DepartmentHead + ". For more details please login into your Account or Please contact your Department Head."; 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); return(RedirectToAction("ApproveRequisition")); }
public ActionResult CancelOrder(int ID) { Data_CancelRequest DC = new Data_CancelRequest(); DC.CancelRequest(ID); SendEmailNotification sen = new SendEmailNotification(); Users userInfo = Data_Users.GetInfoByUserID((int)Session["UserID"]); Department department = Data_Department.GetDepartmentInfoByID(userInfo.DeptID_FK); String Useremail = userInfo.EmailID; String EmailSubject = "Cancellation of ReuestID#" + ID; String EmailBody = "<p> Dear " + userInfo.Username + ",</p>"; EmailBody += "<p>We would like to inform you that your Request for stationery with RequisitionID " + ID + " has been cancelled by you .</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(Useremail, EmailSubject, EmailBody); return(RedirectToAction("MyRequisitions")); }
public ActionResult SaveDelegation(Delegations d) { int IsAllocated; Users user = Data_Users.GetInfoByUserID(d.UserID); using (SqlConnection conn = new SqlConnection(DataLink.connectionString)) { conn.Open(); string cmdtext = @"insert into Delegation (DeptID,UserID,StartDate,EndDate,Username,DelegationStatus) values ('" + user.DeptID_FK + "','" + user.UserID + "','" + d.StartDate + "','" + d.EndDate + "','" + user.Username + "','Allocated')"; SqlCommand cmd = new SqlCommand(cmdtext, conn); IsAllocated = cmd.ExecuteNonQuery(); } if (IsAllocated != 0) { using (SqlConnection conn = new SqlConnection(DataLink.connectionString)) { conn.Open(); string cmdtext = @"UPDATE Users SET role ='InterimHead' where UserID = '" + d.UserID + "'"; SqlCommand cmd = new SqlCommand(cmdtext, conn); IsAllocated = cmd.ExecuteNonQuery(); } } //Email Alert to department staff who has been assigned for Delegation SendEmailNotification sen = new SendEmailNotification(); Department department = Data_Department.GetDepartmentInfoByID(user.DeptID_FK); String Useremail = user.EmailID; String EmailSubject = "Delegated As InterimHead"; String EmailBody = "<p> Dear " + user.Username + ",</p>"; EmailBody += "<p>You have been delegated as InterimHead for " + department.Departmentname + " from " + d.StartDate + " to " + d.EndDate + "."; 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); return(Redirect("ViewDelegations")); }
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")); }