Example #1
0
        public PartialViewResult IndexLessonsAddGridView(LL_IndexGridRowModel rowModel)
        {
            dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearned);

            BusinessUnitModel objBU = ServiceSystem.GetBusinessUnitByRigId(UtilitySystem.Settings.RigId);

            if (ModelState.IsValid)
            {
                var newLesson = new LessonLearnedModel()
                {
                    DateStarted       = DateTimeOffset.Now,
                    Title             = rowModel.Title,
                    ImpactLevel       = rowModel.ImpactLevel,
                    Status            = LessonsLearnedStatus.Open.ToString(),
                    SourceForm        = "Lessons Learned",
                    SourceRigFacility = UtilitySystem.Settings.RigId,
                    SourceBU          = objBU.Id,
                    TypeId            = rowModel.TypeId
                };
                dataModel.Add(newLesson);
            }
            else
            {
                ViewData["UpdateError"] = true;
            }
            return(IndexLessonsGridView());
        }
Example #2
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()));
        }
Example #3
0
        public ActionResult RigAdminUserRoleAdd(AdminModel model)
        {
            RigAdminManageModel manageRigModel = (RigAdminManageModel)Session["manageRigModel"];

            if (ModelState.IsValid)
            {
                LookupListModel <dynamic> lkpList = UtilitySystem.GetLookupList("Position");

                UserModel user = ServiceSystem.GetUser(model.Passport);
                model.Name   = user.DisplayName;
                model.UserId = user.Passport;
                model.dt     = DateTime.Now;
                DataTable dt = this.GetIaType();
                if (model.Position == null || dt.Select("Name='" + model.Position + "'").Length == 0)
                {
                    model.Position = (string)lkpList.GetDisplayValue(user.Position);
                }

                IIrmaServiceDataModel dataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Admin);
                AdminModel            item      = dataModel.GetItem(string.Format("UserId=\"{0}\" and RoleId={1} and Position=\"{2}\" ", model.UserId, model.RoleId, model.Position), "id");
                if (item == null)
                {
                    model = IrmaServiceSystem.Add(IrmaConstants.IrmaPobModels.Admin, model, true);
                }
            }

            return(PartialView("RigAdminUserRolePartial", manageRigModel.AdminUsers));
        }
Example #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);
        }
Example #5
0
        public ActionResult CapaPlan(int?id = 0)
        {
            IServiceDataModel dataModel = ServiceSystem.GetServiceModel(EnscoConstants.EntityModel.IrmaCapaPlan);
            IrmaCapaPlanModel m         = new IrmaCapaPlanModel();

            if (id == 0)
            {
                this.Session["Source"] = Guid.NewGuid().ToString();
                m.RigId = UtilitySystem.CurrentRigId;
            }
            else
            {
                m = dataModel.GetItem("Id=" + id.ToString(), "Id");
            }
            m.OwnersList        = (m.Owners == null ? UtilitySystem.CurrentUserId.ToString() : m.Owners).Split(',');
            Session["CapaPlan"] = m;
            bool readOnly = true;

            if (id == 0 || (m.OwnersList.Contains(UtilitySystem.CurrentUserId.ToString()) && m.Status == "Open"))
            {
                readOnly = false;
            }
            this.ViewBag.readOnly = readOnly;

            this.ViewBag.dsSummary = this.GetDataSet("exec usp_GetCapaPlanSummary " + id.ToString());
            return(View(m));
        }
Example #6
0
        protected void Application_Start()
        {
            // Load Web.Config AppSettings
            LoadConfigSettings();

            // Initialize Utilities
            UtilitySystem.Initialize();

            // Initialize Services
            ServiceSystem.Initialize();
            ServiceSystem.InitializeApplication();

            // Initialize Irma Services
            IrmaServiceSystem.Initialize();

            // Initialize Tlc LookupLists
            TlcManageLookupLists.InitLookupLists();

            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // DevExpress Model Binder
            System.Web.Mvc.ModelBinders.Binders.DefaultBinder = new DevExpress.Web.Mvc.DevExpressEditorsBinder();
            //DevExpress.Web.BinaryStorageConfigurator.Mode = DevExpress.Web.BinaryStorageMode.Session;

            //Localization
            ModelMetadataProviders.Current = new EnscoLocalizationProvider();
            ASPxWebControl.CallbackError  += Application_Error;
        }
Example #7
0
        public void UpdateAttachment(int?id)
        {
            IServiceDataModel dataModel = ServiceSystem.GetServiceModel(EnscoConstants.EntityModel.Attachment);

            if (id != 0)
            {
                string source = this.Session["Source"] == null ? "" : this.Session["Source"].ToString();
                IEnumerable <AttachmentModel> attachments = ServiceSystem.GetAttachments(source, "0");
                if (attachments != null)
                {
                    foreach (AttachmentModel attachment in attachments)
                    {
                        attachment.SourceFormId = id?.ToString();
                        attachment.SourceForm   = "CapaPlan";
                        dataModel.Update(attachment);
                    }
                }
            }
            else
            {
                string[] arr = this.Request.Form.GetValues("Removed");
                if (arr != null)
                {
                    foreach (string path in arr)
                    {
                        AttachmentModel attachment = dataModel.GetItem(string.Format("FilePath =\"{0}\"", HttpUtility.UrlDecode(path)), "Id");
                        if (attachment != null)
                        {
                            dataModel.Delete(attachment);
                        }
                    }
                }
            }
        }
Example #8
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()));
        }
Example #9
0
        public ActionResult ControlAddReview(ReviewModel reviewModel, string SourceForm, string SourceFormId)
        {
            if (ModelState.IsValid)
            {
                dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.Review);
                BusinessUnitModel businessUnit = ServiceSystem.GetBusinessUnitByRigId(UtilitySystem.Settings.RigId);
                ReviewModel       newReview    = new ReviewModel()
                {
                    RigId              = UtilitySystem.Settings.RigId,
                    Comment            = reviewModel.Comment,
                    ReviewerPassportId = reviewModel.ReviewerPassportId,
                    RequestedBy        = UtilitySystem.CurrentUserId,
                    SourceBU           = businessUnit.Id,
                    SourceForm         = SourceForm,
                    SourceFormId       = SourceFormId.ToString(),
                    DateCreated        = DateTimeOffset.Now
                };
                dataModel.Add(newReview);
                ServiceSystem.AddTask(sourceForm: "Review", sourceFormId: SourceFormId, assigneeUserId: newReview.ReviewerPassportId,
                                      dueDate: reviewModel.DueDate, sourceFormUrl: Request.UrlReferrer.PathAndQuery);
            }
            else
            {
                ViewData["UpdateError"] = true;
            }

            return(Control(SourceForm, SourceFormId));
        }
Example #10
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)));
 }
        private IEnumerable <OpenFSOGridModel> GetOpenFsoGridModelList(OapChecklist corpFSOChecklist)
        {
            IEnumerable <RigOapChecklist> checklists = GetOpenFsoChecklists(corpFSOChecklist);
            List <OpenFSOGridModel>       modelList  = new List <OpenFSOGridModel>();

            foreach (var checklist in checklists)
            {
                UserModel     user     = ServiceSystem.GetUser(checklist.OwnerId);
                PositionModel position = ServiceSystem.GetUserPosition(checklist.OwnerId);

                OpenFSOGridModel gridModel = new OpenFSOGridModel()
                {
                    Id                   = checklist.Id,
                    Title                = checklist.Title,
                    ChecklistDateTime    = checklist.ChecklistDateTime,
                    RigChecklistUniqueId = checklist.RigChecklistUniqueId,
                    Observer             = user?.DisplayName,
                    Position             = position?.Name,
                    Company              = user?.Company,
                    Location             = user?.RigId
                };

                modelList.Add(gridModel);
            }

            return(modelList);
        }
Example #12
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);
        }
Example #13
0
        // GET: Common/Common
        public ActionResult Index(string returnUrl)
        {
            // Initialize application, this is the first place that we have the application id from query string
            ServiceSystem.InitializeApplication();

            // TEST CODE TO AUTOLOGIN
            LoginTest();
            // TEST CODE TO AUTOLOGIN

            ApplicationModel model = ServiceSystem.ApplicationModel;

            if (model != null)
            {
                if (returnUrl != null)
                {
                    return(Redirect(returnUrl));
                }
                //if (currentCrumb != null)
                //    return RedirectToAction(currentCrumb.Action, currentCrumb.Controller, new { area=currentCrumb.Area });
                else
                {
                    return(RedirectToAction(model.Action, model.Controller, new { area = model.Area }));
                }
            }

            return(View());
        }
Example #14
0
        public ActionResult LessonsLearnedAddOriginatorsPartial(LL_EditOriginatorsGridRowModel rowModel)
        {
            // Add Originator logic
            var lessonLearnedModel = (LessonLearnedModel)Session["LessonLearnedModel"];
            List <LessonLearnedOriginatorModel> originators = lessonLearnedModel.Originators;

            if (ModelState.IsValid)
            {
                LessonLearnedOriginatorModel newOriginator = new LessonLearnedOriginatorModel()
                {
                    LessonId = lessonLearnedModel.Id, PassportId = rowModel.PassportId, RigFacility = rowModel.RigFacility
                };
                var user = ServiceSystem.GetUser(rowModel.PassportId);
                newOriginator.Position = (int)user.Position;
                if (Ensco.Utilities.UtilitySystem.Settings.RigId != 1)
                {
                    newOriginator.RigFacility = Ensco.Utilities.UtilitySystem.Settings.RigId;
                }
                dataModel     = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearnedOriginator);
                newOriginator = dataModel.Add(newOriginator);
                originators.Add(newOriginator);
            }
            else
            {
                ViewData["UpdateError"] = true;
            }

            return(LessonsLearnedOriginatorsPartial());
            //return PartialView("LessonLearnedOriginatorsPartial", originators);
        }
        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);
        }
Example #16
0
        public ActionResult CapaPlanDelete(int id)
        {
            IServiceDataModel dataModel = ServiceSystem.GetServiceModel(EnscoConstants.EntityModel.IrmaCapaPlan);
            IrmaCapaPlanModel m         = new IrmaCapaPlanModel();

            m.Id = id;
            dataModel.Delete(m, true);
            return(Redirect("/irma/capa/CapaPlanHome"));
        }
Example #17
0
        public ActionResult UploadPartial(int id, string source, bool readOnly = false)
        {
            AttachmentSource att = new AttachmentSource();

            att.SourceForm        = source;
            att.SourceFormId      = id;
            att.Attachments       = ServiceSystem.GetAttachments(source, id.ToString());
            this.ViewBag.readOnly = readOnly;
            return(PartialView("UploadPartial", att));
        }
Example #18
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()));
        }
Example #19
0
        public ActionResult LessonsLearnedOriginatorsPartial()
        {
            LessonLearnedModel model = (LessonLearnedModel)Session["LessonLearnedModel"];

            ViewBag.IsEditable = model.IsEditable;
            foreach (var originator in model.Originators)
            {
                var user = ServiceSystem.GetUser(originator.PassportId);
                originator.Position = (int)user.Position;
            }
            return(PartialView("LessonLearnedOriginatorsPartial", model.Originators));
        }
Example #20
0
        public ActionResult EmailReport()
        {
            DevExpress.XtraReports.UI.XtraReport currentReport = (DevExpress.XtraReports.UI.XtraReport)Session["currentReport"];

            IIrmaServiceDataModel emailDataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Emails);
            PobEmailModel         emailModel     = emailDataModel.GetItem(string.Format("Name=\"PobSummaryReport\""), "Name");

            char[]            sep          = { ';' };
            string[]          recipients   = (emailModel != null && emailModel.Recipients != null) ? emailModel.Recipients.Split(sep) : null;
            IServiceDataModel pobDataModel = ServiceSystem.GetServiceModel(EnscoConstants.EntityModel.User);

            try
            {
                using (SmtpClient client = new SmtpClient("smtp.ensco.ws"))
                {
                    MemoryStream memStream = new MemoryStream();
                    currentReport.ExportToPdf(memStream);

                    memStream.Seek(0, System.IO.SeekOrigin.Begin);
                    Attachment att = new Attachment(memStream, "PobSummayReport.pdf", "application/pdf");

                    MailMessage message = new MailMessage();
                    message.Attachments.Add(att);
                    message.From    = new MailAddress("*****@*****.**");
                    message.Subject = emailModel.Subject;

                    // Get recepients
                    foreach (string id in recipients)
                    {
                        UserModel user = pobDataModel.GetItem(string.Format("Id={0}", id), "Id");
                        if (user != null && user.Email != null)
                        {
                            message.To.Add(new MailAddress(user.Email));
                        }
                    }

                    // This line can be used to embed HTML into the email itself
                    // MailMessage message = currentReport.ExportToMail("*****@*****.**", emailModel.Recipients, emailModel.Subject);

                    // Get correct credentials for irma profile
                    client.Credentials = new System.Net.NetworkCredential("Ensco\\023627", "");
                    client.Send(message);

                    memStream.Close();
                    memStream.Flush();
                }
            }
            catch (Exception ex)
            {
            }

            return(View("ShowReportPartial", currentReport));
        }
Example #21
0
        // GET: IRMA/Comments
        public ActionResult GetAllComments()
        {
            dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.Comment);
            IEnumerable <CommentModel> comments = dataModel.GetAllItems().Cast <CommentModel>();

            foreach (CommentModel comment in comments)
            {
                UserModel user = ServiceSystem.GetUser((int)comment.CommenterPassport); // Populates position field
                comment.Position = (int)user.Position;
            }
            return(PartialView("GetAllComments", comments));
        }
Example #22
0
        public static ReviewModel GetReview(int id)
        {
            IOAPServiceDataModel dataModel = GetServiceModel(OAPDataModelType.Review);
            ReviewModel          review    = dataModel.GetItem(string.Format("Id={0}", id), "Id");

            var user = ServiceSystem.GetUser(review.ReviewerPassportId);

            review.Reviewer = user.DisplayName;

            review.Attachments = ServiceSystem.GetAttachments("Review", review.Id.ToString());
            return(review);
        }
Example #23
0
        public ActionResult GetAllReviews()
        {
            dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.Review);
            IEnumerable <ReviewModel> reviews = dataModel.GetAllItems().Cast <ReviewModel>();

            foreach (ReviewModel review in reviews)
            {
                review.Attachments = ServiceSystem.GetAttachments("Review", review.Id.ToString());
            }

            return(PartialView("GetAllReviews", reviews));
        }
Example #24
0
        public static void ProcessPobSummaryEmalJob()
        {
            IServiceDataModel dataModel = ServiceSystem.GetServiceModel(EnscoConstants.EntityModel.Scheduler);
            ScheduleJobModel  job       = dataModel.GetItem(string.Format("Id={0}", 1), "Id"); // PobSummaryReport job id

            if (job == null)
            {
                return;
            }

            ProcessPobSummaryEmailJob(job);
        }
Example #25
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()));
        }
Example #26
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (Session["CurrentOIM"] != null)
            {
                currentOIM = (UserModel)Session["CurrentOIM"];
            }
            else
            {
                currentOIM            = ServiceSystem.GetCurrentOIM();
                Session["CurrentOIM"] = currentOIM;
            }

            base.OnActionExecuting(filterContext);
        }
Example #27
0
        public ActionResult Control(string SourceForm, string SourceFormId)
        {
            ViewBag.SourceForm   = SourceForm;
            ViewBag.SourceFormId = SourceFormId;
            dataModel            = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.Review);
            IEnumerable <ReviewModel> reviews = dataModel.GetItems(string.Format("SourceForm=\"{0}\" AND SourceFormId=\"{1}\"", SourceForm, SourceFormId), "Id").Cast <ReviewModel>();

            foreach (ReviewModel review in reviews)
            {
                review.Attachments = ServiceSystem.GetAttachments("Review", review.Id.ToString());
            }

            return(PartialView("Control", reviews));
        }
        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);
        }
Example #29
0
        public ActionResult RigRequirements()
        {
            RigAdminManageModel manageRigModel = new RigAdminManageModel();

            Session["manageRigModel"] = manageRigModel;

            IServiceDataModel rigRelation = ServiceSystem.GetServiceModel(EnscoConstants.EntityModel.RigAssetRelation);

            if (rigRelation != null)
            {
                manageRigModel.Assets = new DataTableModel(UtilitySystem.Settings.RigId, rigRelation.GetQueryable(string.Format("RigId={0}", UtilitySystem.Settings.RigId), "Id"));
            }

            return(View(manageRigModel));
        }
Example #30
0
        public ActionResult RigAssetRelationAdd(RigAssetRelationModel model)
        {
            RigAdminManageModel manageRigModel = (RigAdminManageModel)Session["RigAdminManageModel"];

            if (ModelState.IsValid)
            {
                IServiceDataModel rigRelation = ServiceSystem.GetServiceModel(EnscoConstants.EntityModel.RigAssetRelation);
                if (rigRelation != null)
                {
                    model.RigId = UtilitySystem.Settings.RigId;
                    rigRelation.Add(model);
                }
            }
            return(PartialView("RigAdminAssetsPartial", manageRigModel));
        }