Пример #1
0
        public ActionResult UpdateRequest(string requestId, string statusUpdate, string internalUser, string externalUser, string custodianUser, string Comment, string convertedFile, string convertedFile1, string convertedFile2)
        {
            string UploadStatus  = "";
            string UploadStatus1 = "";
            string UploadStatus2 = "";
            string assignedToId  = "";
            string roleId        = "";
            //convertedFile = "";
            //convertedFile1 = "";
            //convertedFile2 = "";

            string ipaddress   = Request.UserHostAddress;
            string Agent       = Request.UserAgent;
            string BrowserUsed = Request.Browser.Browser;
            string SessionID   = HttpContext.Session.SessionID;

            string userkey = ConfigurationManager.AppSettings["userkey"];
            string uid     = ConfigurationManager.AppSettings["uid"];

            string LoginUser  = (string)Session["LoginSAPID"];
            string EmployerId = (string)Session["EMPLOYER_ID"];
            string WebUserID  = (string)Session["WebUserID"];
            string RoleID     = (string)Session["ROLE_ID"];

            try
            {
                Employer.Employer employer = new Employer.Employer();

                if (internalUser != "")
                {
                    assignedToId = internalUser;
                    roleId       = "2";
                }
                else if (externalUser != "")
                {
                    assignedToId = externalUser;
                    roleId       = "3";
                }
                else if (custodianUser != "")
                {
                    assignedToId = externalUser;
                    roleId       = "4";
                }
                string requestStatus;
                if (statusUpdate == "Assigned")
                {
                    requestStatus = employer.AssignRequest(requestId, Comment, WebUserID, "2", roleId, assignedToId, statusUpdate, userkey, uid);
                }
                else
                {
                    requestStatus = employer.AssignRequest(requestId, Comment, WebUserID, "2", roleId, WebUserID, statusUpdate, userkey, uid);
                }
                //var requestStatus = employer.CreateRequest(WebUserID, "3", requestCategory, "Initiated", Comment, userkey, uid);
                var requestDetails = requestStatus.Split('~');

                if (requestDetails[0] != "01")
                {
                    var file = Request.Files;

                    if (file[0].ContentLength > 0)
                    {
                        string _FileName = file[0].FileName;
                        string Docext    = Path.GetExtension(file[0].FileName);
                        string Doc       = convertedFile;
                        UploadStatus = employer.LogRequestDoc(requestId, requestDetails[1], Doc, Docext, _FileName, "Y", userkey, uid);
                        var uploadDetails = UploadStatus.Split('~');
                    }
                    if (file[1].ContentLength > 0)
                    {
                        string _FileName1 = file[1].FileName;
                        string Docext1    = Path.GetExtension(file[1].FileName);
                        string Doc1       = convertedFile1;
                        UploadStatus1 = employer.LogRequestDoc(requestId, requestDetails[1], Doc1, Docext1, _FileName1, "Y", userkey, uid);
                        //var uploadDetails1 = UploadStatus1.Split('~');
                    }
                    if (file[2].ContentLength > 0)
                    {
                        string _FileName2 = file[2].FileName;
                        string Docext2    = Path.GetExtension(file[2].FileName);
                        string Doc2       = convertedFile2;
                        UploadStatus2 = employer.LogRequestDoc(requestId, requestDetails[1], Doc2, Docext2, _FileName2, "Y", userkey, uid);
                        //uploadDetails2 = UploadStatus2.Split('~');
                    }

                    if (UploadStatus == "00~Your documents have been logged successfully" || UploadStatus1 == "00~Your documents have been logged successfully" || UploadStatus2 == "00~Your documents have been logged successfully")
                    {
                        employer.NotifyIncident(requestDetails[1], userkey, uid);
                        string status        = "00~Your documents have been logged successfully";
                        var    statusDetails = status.Split('~');
                        TempData["error"] = "Your request and " + statusDetails[1];
                        //employer
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                    }


                    TempData["msg"] = requestDetails[2];
                    return(RedirectToAction("Index"));
                }
                else
                {
                    TempData["error"] = requestDetails[2];
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                LogError logerror = new LogError();
                logerror.ErrorLog("", LoginUser, "", "Requests/UpdateRequest", "Requests", "UpdateRequest", "AssignRequest Error", ex.InnerException.Message.ToString(), 0);
                TempData["error"] = "An error processing complaints";
                return(View());
            }
        }