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 SubmitDiscrepency(RequisitionDetails Dp)
        {
            String ItemID      = Dp.ItemID;
            string StockcardID = getstockcardID(ItemID);
            string DisStatus   = "PendingForApproval";

            using (SqlConnection conn = new SqlConnection(DataLink.connectionString))
            {
                conn.Open();
                string     cmdtext = @"insert into Discrepancy (DisbursementID,StockCardID,DiscrepancyQty,Reason,DiscrepancyStatus,ItemID) values ('" + Dp.DisbursementID + "','" + StockcardID + "'," + Dp.DeliveredQty + ",'" + Dp.Reason + "','" + DisStatus + "','" + ItemID + "')";
                SqlCommand cmd     = new SqlCommand(cmdtext, conn);
                cmd.ExecuteNonQuery();
            }

            Users  u             = ds.GetUserInfo((int)Session["UserID"]);
            string EmailID       = u.EmailID;
            int    DiscrepancyId = GetDiscrepancyID();

            SendEmailNotification send = new SendEmailNotification();

            String EmailSubject = "Request Submitted DiscrepancyID#" + DiscrepancyId;
            String EmailBody    = "<p> Dear KyiPhyu,</p>";

            EmailBody += "<p>Your order is ready to deliver with Discrepancy ID" + DiscrepancyId + " for your reference.</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>";

            send.SendEmailHTML("*****@*****.**", EmailSubject, EmailBody);

            return(RedirectToAction("DisbursementList"));
        }
Example #3
0
        public ActionResult StockCardDetail(string stockCardID, string id)
        {
            StockCradDetails scDetails = sc.createStockCardDetail(id);

            sc.createDisbursementTransaction(stockCardID, id);
            //  List<StockCradDetails> scDisTran = sc.showDisbursementTransaction(stockCardID, id);

            sc.createSupplierTransaction(stockCardID, id);
            List <IncomingCode> incomingTran = sc.showSupplierTransaction(stockCardID);
            int balance      = sc.getLatestBalance(stockCardID, id);
            int reorderLevel = sc.getReorderLevel(id);

            if (balance <= reorderLevel)
            {
                Users  u                   = ds.GetUserInfo((int)Session["UserID"]);
                string EmailID             = u.EmailID;
                SendEmailNotification send = new SendEmailNotification();

                String EmailSubject = "Reorder level low at ItemID#" + id;
                String EmailBody    = "<p> Dear SuSu,</p>";
                EmailBody += "<p>Your reorder level is low in ItemID" + id + ". For your reference.</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>";
                send.SendEmailHTML("*****@*****.**", EmailSubject, EmailBody);
            }
            ViewBag.stockCardDetail = scDetails;
            // ViewBag.scDisbursementTran = scDisTran;
            ViewBag.incomingTran = incomingTran;
            return(View());
        }
Example #4
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 #5
0
        //send Manger to notify when Discrepancy> 250
        //by supervisor
        public ActionResult sendMail()
        {
            Users  u             = ds.GetUserInfo((int)Session["UserID"]);
            string EmailID       = u.EmailID;
            int    discrepancyID = GetDiscrepancyID();

            SendEmailNotification send = new SendEmailNotification();

            String EmailSubject = "Request Submitted DiscrepancyID#" + discrepancyID;
            String EmailBody    = "<p> Dear KyiPhyu,</p>";

            EmailBody += "<p>Your item has discrepancy in Discrepancy ID" + discrepancyID + " for your reference.</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>";

            send.SendEmailHTML("*****@*****.**", EmailSubject, EmailBody);
            return(RedirectToAction("UpdateAdjustmentStatus", "Adjustment"));
        }
Example #6
0
        public ActionResult sendRejectMailSup()
        {
            Users  u             = ds.GetUserInfo((int)Session["UserID"]);
            string EmailID       = u.EmailID;
            int    discrepancyID = GetDiscrepancyID();

            SendEmailNotification send = new SendEmailNotification();

            String EmailSubject = "Rejected DiscrepancyID#" + discrepancyID;
            String EmailBody    = "<p> Dear SuSu,</p>";

            EmailBody += "<p>Your Discrepancy ID" + discrepancyID + " has been rejected by supervisor.</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>";

            send.SendEmailHTML("*****@*****.**", EmailSubject, EmailBody);
            return(RedirectToAction("UpdateAdjustmentStatus", "Adjustment"));
        }
Example #7
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 #8
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 #9
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 #10
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 #11
0
        public ActionResult validateOTP(RequisitionDetails rd)
        {
            string OTP = ds.validateOTP(rd);

            RequisitionDetails    userData = ds.getUserDataByDisbID(rd.DisbursementID);
            SendEmailNotification send     = new SendEmailNotification();

            String EmailSubject = "Request Submitted DisbursementID#" + userData.DisbursementID;
            String EmailBody    = "<p> Dear " + userData.UserName + ",</p>";

            EmailBody += "<p>Your order is ready to deliver with Disbursement ID <b>" + userData.DisbursementID + "</b> for your reference.</p>";
            EmailBody += "<p>Collection Point will be <b>" + userData.CollectionPoint + "</b></p>";
            EmailBody += "<p>" + "OTP for loging into your account is here. <b> " + OTP + " </b>." +
                         " Please tell this OTP to verify your identity. " + " </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>";
            send.SendEmailHTML(userData.EmailID, EmailSubject, EmailBody);


            int id = rd.DisbursementID;

            return(RedirectToAction("ViewDisbursementDetail/" + id));
        }
Example #12
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"));
        }