Ejemplo n.º 1
0
        public ActionResult SRDetails(ApproverSRDetails obj)
        {
            string mid = System.Web.HttpContext.Current.Session["id"].ToString();

            try
            {
                SRNumber srn    = new SRNumber();
                int      userID = Convert.ToInt32(srn.getUserId(mid));
                int      RoleID = Convert.ToInt32(srn.generateRoleID(userID));
                int      count  = Convert.ToInt32(System.Web.HttpContext.Current.Session["CountforSRDetails"]);
                Session["CountforSRDetails"] = count;
                string srid = System.Web.HttpContext.Current.Session["SRIDforSRDetailsPost"].ToString();
                int    SRID = Convert.ToInt32(System.Web.HttpContext.Current.Session["SRIDforSRDetailsPost"]);

                if (Request.Form["approvesr"] != null)
                {
                    if (srn.ApproveTokenUpdateAction(SRID, mid) == 1)
                    {
                        srn.UI_InsertAssignedStatus(SRID, mid, obj.Comments);
                        tokenObj.UI_sendMailToUser_AfterApproved(SRID.ToString());
                        tokenObj.UI_sendMailToAdmin_AfterApproved(SRID.ToString());
                    }
                    else
                    {
                        TempData["ApproveError"] = "Your time Limit to approve this SR has been crossed so now it is with 2nd Approver";
                    }
                    SRDetails();
                }
                if (Request.Form["rejectsr"] != null)
                {
                    if (obj.Comments != null)
                    {
                        if (srn.RejectTokenUpdateAction(SRID, mid) == 1)
                        {
                            srn.UI_InsertAssignedStatus(SRID, mid, obj.Comments);
                            tokenObj.UI_sendMailToUser_AfterReject(SRID.ToString());

                            SRDetails();
                        }
                        else
                        {
                            SRDetails();
                            TempData["ApproveError"] = "Your time Limit to reject this SR has been crossed so now it is with 2nd Approver";
                        }
                    }
                    SRDetails();
                }
            }
            catch (Exception e)
            {
                Log.CreateLog(e);
            }
            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult SRDetails(ApproverSRDetails obj)
        {
            string mid = System.Web.HttpContext.Current.Session["id"].ToString();

            try
            {
                SRNumber srn    = new SRNumber();
                int      userID = Convert.ToInt32(srn.getUserId(mid));
                int      RoleID = Convert.ToInt32(srn.generateRoleID(userID));
                int      count  = Convert.ToInt32(System.Web.HttpContext.Current.Session["CountforSRDetails"]);
                Session["CountforSRDetails"] = count;
                int SRID = Convert.ToInt32(System.Web.HttpContext.Current.Session["SRIDforSRDetailsPost"]);

                int retValforSRS = srn.InsertNextSRStatus(SRID, userID, RoleID, obj.Comments, obj.selectStatus);

                if (retValforSRS == 1)
                {
                    SRDetails();
                    if (obj.selectStatus == "Closed")
                    {
                        string Subject  = "SR000000" + SRID + " " + "-Resolved";
                        string mailId   = srn.SRCreatorMail(SRID);
                        string mailBody = "Hi," + "<br/> The SR000000" + SRID + " " + "has been closed by Admin team. Please visit SR for any further concern";
                        SendMail(Subject, mailBody, mailId);
                    }
                    TempData["AlertMessage"] = "Ticket is now " + obj.selectStatus;
                }
                else if (retValforSRS == 2)
                {
                    SRDetails();
                    TempData["AlertMessage"] = "Service Ticket is already in Progress !!!";
                }
                else
                {
                    //return Content("<script> alert('Please make the Service request in Progress before closing it')</script>");
                    SRDetails();
                    TempData["AlertMessage"] = "Please make the Service request in Progress before closing it";
                }
            }
            catch (Exception e)
            {
                Log.CreateLog(e.InnerException);
            }

            return(View());
        }