//Add new requisition order public string AddNewRequest(WCF_Token token) { string x = token.gettoken.Replace(@"\", "").Trim(); if (AuthenticateToken(x)) { WCF_Employee emp = GetEmployeeByToken(x); int emp_id = Convert.ToInt32(emp.EmployeeId); //16; string Depid = emp.DepartmentId.Trim(); //ENGL; DateTime d = DateTime.Now.Date; unique_id u = BusinessLogic.getlastrequestid(Depid); int i = (int)u.req_id + 1; string id = Depid + "/" + DateTime.Now.Year.ToString() + "/" + i; BusinessLogic.AddNewRequisitionOrder(id, emp_id, d); BusinessLogic.updatelastrequestid(Depid, i); int head_id = Convert.ToInt32(BusinessLogic.GetDepartmenthead(Depid).head_id); string to = BusinessLogic.GetEmployee(head_id).email_id; //string to = "*****@*****.**"; string ename = BusinessLogic.GetEmployee(emp_id).employee_name; string sub = "Stationery System: New request raised for your approval"; string body = "New Request ID" + id + "has been placed by" + ename + "for your approval"; BusinessLogic.sendMail(to, sub, body); return(id); } else { return(null); } }
protected void Button2_Click1(object sender, EventArgs e) { Button2.CssClass = "btn btn-success disabled"; Button2.Enabled = false; int Empid = (int)Session["Employee"]; string Depid = (string)Session["Department"]; //19 belongs to ENGL dep DateTime d = DateTime.Now.Date; //int i = (int)Application["RequestID"] + 1; unique_id u = BusinessLogic.getlastrequestid(Depid); int i = (int)u.req_id + 1; string id = Depid.Trim() + "/" + DateTime.Now.Year.ToString() + "/" + i; BusinessLogic.AddNewRequisitionOrder(id, Empid, d); List <cart> cart = (List <cart>)Session["RequestCart"]; BusinessLogic.updatelastrequestid(Depid, i); for (int xi = 0; xi < cart.Count; xi++) { BusinessLogic.AddRequisitionOrderDetail(cart[xi], id); } //Application["RequestID"] = i; Session["RequestCart"] = null; string to = BusinessLogic.GetEmployee((int)Session["Head_id"]).email_id.Trim(); //to department head //string to = "*****@*****.**"; string ename = BusinessLogic.GetEmployee(Empid).employee_name; string sub = "Stationery System: New request raised for your approval"; string body = "New Request ID" + i + "has been placed by" + ename + "for your approval"; BusinessLogic.sendMail(to, sub, body); Response.Redirect("~/Protected/RequestConfirm.aspx?id=" + id); }