public void run()
        {
            List<Item> itemCollection = catalogueFacade.getItemsForReorder("Active");

            if (itemCollection.Count != 0)
            {

                List<string> itemList = new List<string>();

                string subject = "Notification for items below reorder level";

                string bodyStart = "<HTML>"
                              + "<HEAD>"
                              + "</HEAD>"
                              + "<BODY>"
                              +"<BR/>"
                              +"<P>Dear ";

                string body = ",</P><BR/><P>The following items have fallen below reorder level :- </P>"
                              + "<UL>";

                foreach (Item item in itemCollection)
                {
                    body = body + "<LI>" + item.ItemId + "    " + item.Description + "</LI>";
                }

                body = body + "</UL>"
                    + "<BR/>"
                    + "<a href=\"http://10.10.1.155/SSISWebApplication/WebPages/PurchaseOrder/RaisePurchaseOrder\">Click this link to reorder</a>"//TODO LINK
                    + "<BR/>"
                    + "<P>From,</P>"
                    + "<P>SSIS.</P>"
                    + "</BODY>"
                    + "</HTML>";

                List<User> userCollection = new List<User>();
                userFacade = new UserFacade();

                userCollection = userFacade.getUsersWithRole("storeClerk");

                notifyUserController = new NotifyUserController();

                foreach(User user in userCollection)
                {
                    notifyUserController.sendEmail(user.Email,subject,bodyStart+user.UserName+body);
                }

            }
        }
Esempio n. 2
0
        public void insertDiscrepancyGF(Discrepancy dis)
        {
            discrepancy d = new discrepancy();
            d.discrepancyId = dis.DiscrepancyId;
            d.itemId = dis.ItemId;
            d.userId = dis.UserId;
            d.quantity = dis.Qunatity;
            d.supplierId = dis.SupplierId;
            d.amount = dis.Amount;
            d.reason = dis.Reason;
            d.submitDate = dis.SubmitDate;
            d.approveDate = dis.ApproveDate;
            d.status = dis.Status;
            d.rejectReason = dis.RejectReason;
            ctx.discrepancies.Add(d);
            ctx.SaveChanges();

            UserFacade userFacade = new UserFacade();
            List<User> userCollection;
            if(dis.Amount>250)
            {
               userCollection= userFacade.getUsersWithRole("storeManager");
            }
            else
            {
               userCollection= userFacade.getUsersWithRole("storeSupervisor");
            }

            string subject = "New Discrepency Submitted.";

            string bodyStart = "<HTML>"
                          + "<HEAD>"
                          + "</HEAD>"
                          + "<BODY>"
                          + "<BR/>"
                          + "<P>Dear ";

            string body = ",</P><BR/><P>A discrepency has been raised from your department.</P>";

            body = body
                + "<BR/>"
                + "<a href=\"http://10.10.1.155/SSISWebApplication/WebPages/Discrepancy/ApproveDiscrepancyRequest\">Click this link to view the discrepency</a>"//TODO LINK
                + "<BR/>"
                + "<P>From,</P>"
                + "<P>SSIS.</P>"
                + "</BODY>"
                + "</HTML>";

            NotifyUserController notifyUserController = new NotifyUserController();

            foreach (User user in userCollection)
            {
                notifyUserController.sendEmail(user.Email, subject, bodyStart + user.UserName + body);
            }
        }
        // modify in 3/11
        protected void SubmitBtn_Click(object sender, EventArgs e)
        {
            if (Session["orderList"] != null)
            {
                List<ReorderItem> orderList = (List<ReorderItem>)Session["orderList"];
                for (int i = 0; i < orderList.Count; i++)
                {
                    ReorderItem r = orderList[i];
                    controller.createReorderItem(r);
                }

                Session["orderList"] = null;
                UpdateGridView.DataSource = null;
                UpdateGridView.DataBind();
            }

            string subject = "Purchase Order Raised";

            string bodyStart = "<HTML>"
                          + "<HEAD>"
                          + "</HEAD>"
                          + "<BODY>"
                          + "<BR/>"
                          + "<P>Dear ";

            string body = "";

            UserFacade userFacade = new UserFacade();
            List<User> userCollection = userFacade.getUsersWithRole("storeManager");

            body = ",</P><BR/><P>A purchase order has been raised.</P>"
                + "<BR/>"
                + "<a href=\"http://10.10.1.155/SSISWebApplication/WebPages/ApproveRejectPurchaseOrder\">Please click this link to view it</a>"; //TODO LINK

            body = body
            + "<BR/>"
            + "<P>From,</P>"
            + "<P>SSIS.</P>"
            + "</BODY>"
            + "</HTML>";

            NotifyUserController notifyUserController = new NotifyUserController();

            foreach (User user in userCollection)
            {
                notifyUserController.sendEmail(user.Email, subject, bodyStart + user.UserName + body);
            }
        }
        public void completeDelivery(Disbursement disbursement)
        {
            List<DisbursementDetails> disbursementDetailsCollection = disbursement.DisbursementDetailsCollection;

            requisitionFacade.updateDisbursment(disbursementDetailsCollection, disbursement.DisbursementId);

            foreach (DisbursementDetails disbursementDetails in disbursementDetailsCollection)
            {
                catalogueFacade.updateStock(disbursementDetails.ItemId, disbursementDetails.DeliveredQty);

                List<DisbursementHelper> disbursementHelperCollection = requisitionFacade.getRequisitionsForCompleteDisbursement(disbursementDetails.ItemId,disbursement.DepartmentId);
                if (disbursementHelperCollection.Count > 0)
                {
                    foreach (DisbursementHelper d in disbursementHelperCollection)
                    {
                        if (disbursementDetails.DeliveredQty > 0)
                        {
                            int req = d.RequestedQty - d.DeliveredQty;
                            if (disbursementDetails.DeliveredQty<=req)
                            {
                                d.DeliveredQty = d.DeliveredQty+disbursementDetails.DeliveredQty;
                                disbursementDetails.DeliveredQty -= disbursementDetails.DeliveredQty;
                            }
                            else
                            {
                                d.DeliveredQty = d.DeliveredQty+req;
                                disbursementDetails.DeliveredQty -= req;
                            }

                            requisitionFacade.updateRequisitionDelivery(d, disbursementDetails.ItemId);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }

            requisitionFacade.updateDisbursementRequisitions(disbursement.DepartmentId);

            string subject = "Disbursement Update";

            string bodyStart = "<HTML>"
                          + "<HEAD>"
                          + "</HEAD>"
                          + "<BODY>"
                          + "<BR/>"
                          + "<P>Dear ";

            string body = "";

            userFacade = new UserFacade();

            List<User> userCollection = userFacade.getUsersWithRole("departmentHead",disbursement.DepartmentId);

            body = ",</P><BR/><P>Disbursement update for Disbursement Id : "+disbursement.DisbursementId+" delivered on date : "+disbursement.DeliveryDate+" </P>"
                + "<BR/>"
                + "<P>The details are :- </P>"
                + "<UL>";

            NotifyUserController notifyUserController;

            List<DisbursementDetails> disbursementDetailCol = disbursement.DisbursementDetailsCollection;
            foreach (DisbursementDetails disdetail in disbursementDetailCol)
            {
                body = body + "<LI>" + disdetail.ItemName + "    " + disdetail.RequestedQty + "     "+ disdetail.DeliveredQty+"</LI>";
            }

            body = body + "</UL>"
            + "<BR/>"
            + "<P>From,</P>"
            + "<P>SSIS.</P>"
            + "</BODY>"
            + "</HTML>";

            notifyUserController = new NotifyUserController();

            foreach (User user in userCollection)
            {
                notifyUserController.sendEmail(user.Email, subject, bodyStart + user.UserName + body);
            }
        }
Esempio n. 5
0
        public void insertRequisitionGF(Requisition re)
        {
            requisition newre = new requisition();
            newre.requisitionId = re.RequisitionId;
            newre.date = re.Date;
            newre.userId = re.UserId;
            newre.departmentId = re.DepartmentId;
            newre.rejectreason = re.RejectReason;
            newre.status = re.Status;
            ctx.requisitions.Add(newre);
            ctx.SaveChanges();
            //gaofan

            UserFacade userFacade = new UserFacade();
            List<User> userCollection = userFacade.getUsersWithRole("departmentDeputy", re.DepartmentId);
            if(userCollection.Count==0)
            {
                userCollection = userFacade.getUsersWithRole("departmentHead", re.DepartmentId);

            }

            string subject = "New Requisition Submitted.";

            string bodyStart = "<HTML>"
                          + "<HEAD>"
                          + "</HEAD>"
                          + "<BODY>"
                          + "<BR/>"
                          + "<P>Dear ";

            string body = ",</P><BR/><P>A requisition has been raised from your department.</P>";

            body = body
                + "<BR/>"
                + "<a href=\"http://10.10.1.155/SSISWebApplication/WebPages/ApproveRejectRequisition\">Click this link to view the requisition</a>"//TODO LINK
                + "<BR/>"
                + "<P>From,</P>"
                + "<P>SSIS.</P>"
                + "</BODY>"
                + "</HTML>";

            NotifyUserController notifyUserController = new NotifyUserController();

            foreach (User user in userCollection)
            {
                notifyUserController.sendEmail(user.Email, subject, bodyStart + user.UserName + body);
            }
        }
        public void selectSubmit(string departmentId, string departmentName, CollectionPoint collectionPoint, bool representative)
        {
            try
            {
                departmentFacade.updateCollectionPoint(departmentId, collectionPoint.CollectionPointId);

                userFacade = new UserFacade();

                string subject = "Notification for change of collection point";

                string bodyStart = "<HTML>"
                              + "<HEAD>"
                              + "</HEAD>"
                              + "<BODY>"
                              + "<BR/>"
                              + "<P>Dear ";

                string body ;

                if (representative == true)
                {
                    List<User> userCollection = userFacade.getUsersWithRole("storeClerk");

                    body = ",</P><BR/><P>The collection point of the " + departmentName + "department has been changed to " + collectionPoint.Address + " </P>";

                    body = body
                    + "<BR/>"
                    + "<P>From,</P>"
                    + "<P>SSIS.</P>"
                    + "</BODY>"
                    + "</HTML>";

                    notifyUserController = new NotifyUserController();

                    foreach (User user in userCollection)
                    {
                        notifyUserController.sendEmail(user.Email, subject, bodyStart + user.UserName + body);
                    }
                }
                else
                {
                    body = ",</P><BR/><P>The collection point of your department has been changed to " + collectionPoint.Address + " </P>";

                    body = body
                    + "<BR/>"
                    + "<P>From,</P>"
                    + "<P>SSIS.</P>"
                    + "</BODY>"
                    + "</HTML>";

                    List<User> userCollection = userFacade.getUsersWithRole("departmentRepresentative",departmentId);

                    notifyUserController = new NotifyUserController();

                    foreach (User user in userCollection)
                    {
                        notifyUserController.sendEmail(user.Email, subject, bodyStart + user.UserName + body);
                    }
                }
            }
            catch (Exception exception)
            {
                errorobj.WriteErrorLog("ChangeCollectionPointController-selectSubmit():::" + exception.ToString());
            }
        }