Example #1
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"));
        }
Example #2
0
        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"));
        }
Example #3
0
        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"));
        }
Example #4
0
        public ActionResult RemoveDelegation(Delegations Dg)  //this method triggers when the "ADD" button is pressed for the item.
        {
            int IsUnAllocated;

            //Debug.WriteLine(s.ItemID);
            using (SqlConnection conn = new SqlConnection(DataLink.connectionString))
            {
                conn.Open();
                string     cmdtext = @"UPDATE Delegation SET DelegationStatus ='UnAllocated' where DelegationID = '" + Dg.DelegationID + "'";
                SqlCommand cmd     = new SqlCommand(cmdtext, conn);
                IsUnAllocated = cmd.ExecuteNonQuery();
            }

            if (IsUnAllocated != 0)
            {
                using (SqlConnection conn = new SqlConnection(DataLink.connectionString))
                {
                    conn.Open();
                    string     cmdtext = @"UPDATE Users SET role ='DepStaff' where Username = '******'";
                    SqlCommand cmd     = new SqlCommand(cmdtext, conn);
                    cmd.ExecuteNonQuery();
                }
            }
            //Email Alert to department staff who has been remove for Delegation

            Users user = Data_Users.GetUserInfo(Dg.Username);
            SendEmailNotification sen        = new SendEmailNotification();
            Department            department = Data_Department.GetDepartmentInfoByID(user.DeptID_FK);

            String Useremail = user.EmailID;

            String EmailSubject = "Removed from Delegation";
            String EmailBody    = "<p> Dear " + user.Username + ",</p>";

            EmailBody += "<p>You have been removed from InterimHead 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);

            return(RedirectToAction("ViewDelegations"));
        }
Example #5
0
        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"));
        }
Example #6
0
        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"));
        }
Example #7
0
        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"));
        }