public HttpResponseMessage Assginrepresentative(string DeptID)
        {
            Users DepRepInfo = Data_Users.GetDepRepInfo(DeptID);
            var   model1     = DepRepInfo.Username;

            List <Users> DeptStaff = Data_Users.GetAllDeptStaffByDeptID(DeptID);

            var model2 = DeptStaff;

            return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, (model1, model2)));
        }
Пример #2
0
        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"));
        }
Пример #3
0
        public ActionResult Assginrepresentative()
        {
            Users DepRepInfo = Data_Users.GetDepRepInfo((string)Session["DeptID"]);

            ViewBag.DepRepName = DepRepInfo.Username;

            List <Users> DeptSatff = Data_Users.GetAllDeptStaffByDeptID((string)Session["DeptID"]);

            SelectList list = new SelectList(DeptSatff, "UserID", "Username");

            ViewBag.DeptStaff = list;

            return(View());
        }
        public HttpResponseMessage SaveRepresentative(string username)
        {
            String DepID = Data_Users.GetDepRepbyName(username);                                //getting DEP id of the Department

            Users u = Data_Users.GetUserInfo(username);


            Users DepRepInfo = Data_Users.GetDepRepInfo(DepID);

            int prev_DepRep = DepRepInfo.UserID;                                              //Getting Previous Dep Rep ID

            int Confirm = Data_Users.AssignRepresentative(u.UserID);                          //Setting New Representative to Department

            if (Confirm != 0)
            {
                Data_Users.RemoveRepresentative(prev_DepRep);                                //Removing the Previous Representative of the Department
            }
            var message = Request.CreateResponse(HttpStatusCode.Created, "Successfully updated!");

            return(message);
        }