示例#1
0
        public ActionResult AssignPartial([ModelBinder(typeof(DevExpressEditorsBinder))]  IrmaCapaModel model)
        {
            string hCapaControl = this.Request.Form["hCapaControl"];

            if (model.Id == 0)
            {
                model.Status = "Open";
            }
            if ((hCapaControl != null && hCapaControl.Contains("Submit")) || (hCapaControl == null && this.Request.Form["btnCapaSubmit"] != null))
            {
                model.Status = "Submit";
            }
            if (model.AssignedTos != null)
            {
                model.AssignedTo = string.Join(",", model.AssignedTos);
            }
            model.Source = this.GetSession("source");
            if (model.Id == 0)
            {
                model.DateAssigned = DateTime.Now;
                model.SourceId     = this.GetSession("sourceId");
                model.SourceUrl    = this.GetSession("SourceUrl");
                model = ServiceSystem.Add(EnscoConstants.EntityModel.IrmaCapa, model, true);
            }
            else
            {
                ServiceSystem.Save(EnscoConstants.EntityModel.IrmaCapa, model, true);
            }
            if (hCapaControl != null)
            {
                return(null);
            }
            return(RedirectToAction("Index/" + model.Id.ToString()));
        }
        public static AuthenticationResult ResetPassword(int id)
        {
            AuthenticationResult result = new AuthenticationResult();

            IServiceDataModel dataModel = ServiceSystem.GetServiceModel(EnscoConstants.EntityModel.User);
            UserModel         model     = dataModel.GetItem(string.Format("Id={0}", id), "Id");

            if (model == null)
            {
                return(new AuthenticationResult("User not found in the system"));
            }

            model.Password = Cryptography.Encrypt(model.Passport, "123");
            model.RequirePasswordChange = true;
            bool bSaved = ServiceSystem.Save(EnscoConstants.EntityModel.User, model, true);

            if (bSaved)
            {
                result = new AuthenticationResult();
            }
            else
            {
                result = new AuthenticationResult("Internal Error. Failed to save password");
            }

            return(result);
        }
示例#3
0
        public ActionResult SubmitResponse(string[] arr)
        {
            IServiceDataModel dataModel = ServiceSystem.GetServiceModel(EnscoConstants.EntityModel.Attachment);
            IrmaCapaModel     m         = this.GetModel(this.CapaId);

            m.DateCompleted         = DateTime.Parse(arr[0]);
            m.WO                    = arr[1];
            m.CompletionDescription = arr[2];
            ServiceSystem.Save(EnscoConstants.EntityModel.IrmaCapa, m, true);
            // if(arr != null)
            for (int i = 3; i < arr.Length; i++)
            {
                AttachmentModel attachment = dataModel.GetItem(string.Format("FilePath =\"{0}\"", HttpUtility.UrlDecode(arr[i])), "Id");
                if (attachment != null)
                {
                    dataModel.Delete(attachment);
                }
            }
            //     this.UpdateAttachment(this.CapaId);
            //this.UpdateAttachment(0);

            return(RedirectToAction("Index/" + this.CapaId.ToString()));

            return(null);
        }
示例#4
0
        public ActionResult SubmitForVerification(int id)
        {
            IServiceDataModel dataModel = ServiceSystem.GetServiceModel(EnscoConstants.EntityModel.IrmaCapaPlan);
            IrmaCapaPlanModel m         = new IrmaCapaPlanModel();

            m        = dataModel.GetItem("Id=" + id.ToString(), "Id");
            m.Status = "Pending Verification";
            ServiceSystem.Save(EnscoConstants.EntityModel.IrmaCapaPlan, m, true);
            TaskModel taskModel = new TaskModel();

            taskModel.AssignedAt = DateTime.Now;
            taskModel.AssignedBy = UtilitySystem.CurrentUserId;
            int       oimId = 0;
            DataTable dt    = this.GetDataSet("select dbo.fn_OimPassportId() ").Tables[0];

            if (dt.Rows.Count > 0)
            {
                int.TryParse(dt.Rows[0][0].ToString(), out oimId);
            }
            taskModel.AssigneeUserId = oimId;
            taskModel.SourceForm     = "CapaPlan";
            taskModel.SourceFormId   = id.ToString();
            taskModel.SourceFormURL  = "/irma/capa/capaPlan/" + id.ToString();
            taskModel.Status         = "Pending";
            taskModel.Message        = "";
            ServiceSystem.Add(EnscoConstants.EntityModel.Task, taskModel, true);
            return(null);
        }
示例#5
0
        public ActionResult CapaPlan([ModelBinder(typeof(DevExpressEditorsBinder))]  IrmaCapaPlanModel model)
        {
            if (this.Request.Form["Submit"] == "Submit")
            {
                model.Status = "Submit";
            }
            if (model.OwnersList != null)
            {
                model.Owners = string.Join(",", model.OwnersList);
            }

            if (model.Id == 0)
            {
                model.DateCreated = DateTime.Now;
                model.Status      = "Open";
                model             = ServiceSystem.Add(EnscoConstants.EntityModel.IrmaCapaPlan, model, true);
                string newId = this.Request.Form["SourceFormId"];
                if (newId != null)
                {
                    this.GetDataSet("update Common_Attachments set SourceFormId=" + model.Id.ToString() + " where SourceFormId=" + newId);
                }
            }
            else
            {
                ServiceSystem.Save(EnscoConstants.EntityModel.IrmaCapaPlan, model, true);
            }

            if (model.Status == "Open")
            {
                this.UpdateAttachment(model.Id);
            }
            this.UpdateAttachment(0);
            return(Redirect("/Irma/Capa/CapaPlan/" + model.Id.ToString()));
        }
示例#6
0
 public ActionResult GridUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CapaActionModel model, string clientAction)
 {
     model.CapaId = this.CapaId;
     if (this.ModelState.IsValid)
     {
         if (clientAction == "Add")
         {
             ServiceSystem.Add(EnscoConstants.EntityModel.CapaAction, model, true);
         }
         else if (clientAction == "Delete")
         {
             ServiceSystem.Delete(EnscoConstants.EntityModel.CapaAction, model, true);
         }
         else
         {
             ServiceSystem.Save(EnscoConstants.EntityModel.CapaAction, model, true);
         }
     }
     else
     {
         this.SaveModelStateErrors();
     }
     this.GetRolePermission(new string[] { this.CapaId.ToString(), model.Type });
     return(PartialView("GridPartial", this.GetActionDataTable(model.Type)));
 }
示例#7
0
        public ActionResult RespondPartial([ModelBinder(typeof(DevExpressEditorsBinder))]  IrmaCapaModel model)
        {
            IrmaCapaModel m = this.GetModel(this.CapaId);

            m.DateCompleted         = model.DateCompleted;
            m.WO                    = model.WO;
            m.CompletionDescription = model.CompletionDescription;
            ServiceSystem.Save(EnscoConstants.EntityModel.IrmaCapa, m, true);

            return(RedirectToAction("Index/" + this.CapaId.ToString()));
        }
示例#8
0
        public ActionResult ReviewPartial([ModelBinder(typeof(DevExpressEditorsBinder))]  IrmaCapaModel model)
        {
            if (model.Id == 0)
            {
                model = ServiceSystem.Add(EnscoConstants.EntityModel.IrmaCapa, model, true);
            }
            else
            {
                ServiceSystem.Save(EnscoConstants.EntityModel.IrmaCapa, model, true);
            }

            return(RedirectToAction("Index/" + model.Id.ToString()));
        }
        public static AuthenticationResult ChangePassword(string curPassword, string newPassword, string confirmPassword, IAuthenticationManager authMgr)
        {
            AuthenticationResult result = new AuthenticationResult();

            try
            {
                if (newPassword != confirmPassword)
                {
                    return(new AuthenticationResult("New and Confirm Passwords do not match."));
                }

                UserSession userInfo = UtilitySystem.CurrentUser;
                if (userInfo == null)
                {
                    return(new AuthenticationResult("User session expired"));
                }

                IServiceDataModel dataModel = ServiceSystem.GetServiceModel(EnscoConstants.EntityModel.User);
                UserModel         model     = dataModel.GetItem(string.Format("Id={0}", userInfo.UserId), "Id");
                if (model == null)
                {
                    return(new AuthenticationResult("User not found in the system"));
                }

                string ecurPwd = Cryptography.Encrypt(userInfo.Passport, curPassword);
                if (ecurPwd != model.Password)
                {
                    return(new AuthenticationResult("Current password incorrect"));
                }

                model.Password = Cryptography.Encrypt(userInfo.Passport, newPassword);
                model.RequirePasswordChange = false;
                bool bSaved = ServiceSystem.Save(EnscoConstants.EntityModel.User, model, true);
                if (bSaved)
                {
                    result = new AuthenticationResult();
                }
                else
                {
                    result = new AuthenticationResult("Internal Error. Failed to save password");
                }
            }
            catch (Exception ex)
            {
                Logger.Error(new LogInfo(MethodBase.GetCurrentMethod(), ex.Message));
            }

            return(result);
        }