public void updateRequisitionStatus(Requisition re)
 {
     requisitiongf.updateRequisitionStatusGF(re);
 }
 //requsition--------------
 public void insertRequisition(Requisition re)
 {
     requisitiongf.insertRequisitionGF(re);
 }
Exemple #3
0
 public void updateRequisitionStatusGF(Requisition re)
 {
     requisition x = ctx.requisitions.FirstOrDefault(o => o.requisitionId == re.RequisitionId);
     x.status = re.Status;
     x.rejectreason = re.RejectReason;
     ctx.SaveChanges();
     // gaofan
 }
Exemple #4
0
 public List<Requisition> getAllPendingRequisitionByDepartmentIdGF(string departmentId)
 {
     var item = from x in ctx.requisitions
                where x.departmentId == departmentId && x.status == "Pending"
                select new
                {
                    a1 = x.requisitionId,
                    a2 = x.date,
                    a3 = x.userId,
                    a4 = x.status,
                    a5 = x.user.name,
                    a6 = x.departmentId,
                    a7 = x.rejectreason
                };
     List<Requisition> list = new List<Requisition>();
     foreach (var a in item)
     {
         Requisition re = new Requisition();
         re.RequisitionId = a.a1;
         re.Date = Convert.ToDateTime(a.a2);
         re.UserId = a.a3;
         re.Status = a.a4;
         re.UserName = a.a5;
         re.DepartmentId = a.a6;
         re.RejectReason = a.a7;
         list.Add(re);
     }
     return list;
     //gaofan
 }
Exemple #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);
            }
        }