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)); }
public ActionResult PersonnelArchivePartial() { IIrmaServiceDataModel dataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.RigPersonnelArchive); DataTableModel model = new DataTableModel(1, dataModel.GetQueryable("Id")); return(PartialView("PersonnelArchivePartial", model)); }
// GET: IRMA/Report public ActionResult RosterSignInByMusterStationReport() { RosterSignInByMusterStation report = new RosterSignInByMusterStation(); report.RigName.Value = Ensco.Utilities.UtilitySystem.Settings.RigName; report.LogoFile.Value = HttpContext.Server.MapPath("~/Images/ensco.png"); report.IrmaFile.Value = HttpContext.Server.MapPath("~/Images/irma.png"); IIrmaServiceDataModel dataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.RosterByMusterStation); List <RosterUserModel> list = dataModel.GetAllItems().Cast <RosterUserModel>().ToList(); report.DataSource = list; Session["currentReport"] = report; //PopupModel popupModel = new PopupModel(); //popupModel.Name = "RosterSignInByMusterStationReport"; //popupModel.Title = "Roster SignIn By Muster Station"; //popupModel.AllowResize = true; //popupModel.MaximizeBox = true; //popupModel.ContentUrl = Url.Action("ShowReportPartial", "Report", new { Area = "IRMA" }); //popupModel.Data = report; //Session["PopupModel"] = popupModel; //return RedirectToAction("EnscoPopup", "Common", new { Area = "Common" }); return(RedirectToAction("ShowReport", "Report")); }
public ActionResult PobSummaryReport() { PobSummaryReport report = new PobSummaryReport(); report.RigName.Value = Ensco.Utilities.UtilitySystem.Settings.RigName; report.LogoFile.Value = HttpContext.Server.MapPath("~/Images/ensco.png"); report.IrmaFile.Value = HttpContext.Server.MapPath("~/Images/irma.png"); // Show/Hide Essential and Vantage IIrmaServiceDataModel reqModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.RigFieldVisible); RigFieldVisibilityModel req = (RigFieldVisibilityModel)reqModel.GetItem(string.Format("Id=1"), "Id"); report.ShowVantage.Value = (req != null) ? req.Visible : true; req = (RigFieldVisibilityModel)reqModel.GetItem(string.Format("Id=3"), "Id"); report.ShowEssential.Value = (req != null) ? req.Visible : true; List <PobSummaryReportModel> list = new List <PobSummaryReportModel>(); list.Add(IrmaServiceSystem.GetSummaryReportData()); report.DataSource = list; Session["currentReport"] = report; return(RedirectToAction("ShowReport", "Report")); }
public ActionResult ApprovalProcessApproval(int Id, int ApprovalId, int Approver, int Status, string Comment) { string comment = (Comment == "null") ? "" : Comment; // DevExpress sending the 'null' string when textbox is empty LessonLearnedModel lessonLearned = (LessonLearnedModel)Session["LessonLearnedModel"]; IIrmaServiceDataModel serviceSystem = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Approval); ApprovalModel approval = serviceSystem.GetItem(string.Format("Id={0}", ApprovalId), "Id"); approval.ApprovedDate = DateTime.Now; approval.ApproverComments = Comment; approval.Status = Status; lessonLearned.Approvals.FirstOrDefault(a => a.Id == ApprovalId).Status = Status; switch (Status) { case (int)IrmaConstants.ApprovalStatus.Approved: var approvedCount = lessonLearned.GetApprovals().Where(a => a.Status == (int)IrmaConstants.ApprovalStatus.Approved).Count(); var totalCount = lessonLearned.GetApprovals().Count(); if (approvedCount == totalCount) // Proceeds with the workflow / auto close { lessonLearned.Status = "Closed"; } break; case (int)IrmaConstants.ApprovalStatus.Rejected: lessonLearned.Status = "Rejected"; approval.ApproverComments = Comment; break; } dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearned); dataModel.Update(lessonLearned); serviceSystem.Update(approval); return(RedirectToAction("Edit", new { Id = Id })); }
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; }
public ActionResult EmergencyTeams() { EmergencyTeamReport report = new EmergencyTeamReport(); report.RigName.Value = Ensco.Utilities.UtilitySystem.Settings.RigName; report.LogoFile.Value = HttpContext.Server.MapPath("~/Images/ensco.png"); report.IrmaFile.Value = HttpContext.Server.MapPath("~/Images/irma.png"); IIrmaServiceDataModel dataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.EmergencyTeamReportView); List <dynamic> list = dataModel.GetAllItems(); string yesUrl = HttpContext.Server.MapPath("~/Images/Yes.png"); string noUrl = HttpContext.Server.MapPath("~/Images/No.png"); foreach (EmergencyTeamReportModel item in list) { item.ImageUrlNo = System.IO.File.ReadAllBytes(HttpContext.Server.MapPath("~/Images/No.png")); item.ImageUrlYes = System.IO.File.ReadAllBytes(HttpContext.Server.MapPath("~/Images/Yes.png")); } report.DataSource = list; Session["currentReport"] = report; return(RedirectToAction("ShowReport", "Report")); }
public ActionResult RigAdminUserRolePartial() { RigAdminManageModel manageRigModel = (RigAdminManageModel)Session["manageRigModel"]; IIrmaServiceDataModel dataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.AdminView); manageRigModel.AdminUsers = new DataTableModel(1, dataModel.GetQueryable("id")); this.ViewBag.IaType = this.GetIaType(); return(PartialView("RigAdminUserRolePartial", manageRigModel.AdminUsers)); }
public ActionResult RigAdminIsolationLockPartial() { RigAdminManageModel manageRigModel = (RigAdminManageModel)Session["manageRigModel"]; IIrmaServiceDataModel dataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.IsolationLock); manageRigModel.IsolationLocks = new DataTableModel(1, dataModel.GetQueryable("id")); return(PartialView("RigAdminIsolationLockPartial", manageRigModel.IsolationLocks)); }
public ActionResult ReconcilePassport() { ReconcilePassportModel model = new ReconcilePassportModel(); Session["ReconcilePassportModel"] = model; model.Dataset = new DataTableModel(1, IrmaServiceSystem.GetQueryable(IrmaConstants.IrmaPobModels.ReconcilePassport, string.Format("MatchGroup != 0"), "MatchGroup")); return(View(model)); }
DataTableModel GetDataTable(string mType, string dType) { dynamic handler = IrmaServiceSystem.GetServiceListModel(mType, dType); MethodInfo[] AllMethods = handler.GetType().GetMethods(); MethodInfo fun = AllMethods.FirstOrDefault(mi => mi.Name == "GetQueryable" && mi.GetParameters().Count() == 1); DataTableModel dt = new DataTableModel(1, fun.Invoke(handler, new string[] { "Id" })); return(dt); }
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)); }
public ActionResult LessonsLearnedPreApprovalReviewDeletePartial(int Id) { IIrmaServiceDataModel serviceSystem = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Approval); var approver = (ApprovalModel)serviceSystem.GetItem(string.Format("Id={0}", Id), "Id"); if (approver != null) { serviceSystem.Delete(approver); var lessonLearnedModel = (LessonLearnedModel)Session["LessonLearnedModel"]; lessonLearnedModel.Approvals.RemoveAll(o => o.Id == approver.Id); } return(LessonsLearnedPreApprovalReviewPartial()); }
public dynamic GetLookupList(string name) { try { IrmaConstants.IrmaLookupLists type = (IrmaConstants.IrmaLookupLists)Enum.Parse(typeof(IrmaConstants.IrmaLookupLists), name); return(IrmaServiceSystem.GetLookupList(type)); } catch (Exception ex) { return(null); } }
public ActionResult MyPassport(Nullable <int> UserId) { int userId = (UserId == null) ? UtilitySystem.CurrentUserId : (int)UserId; IrmaHomeModel irmaHome = IrmaServiceSystem.GetLandingPageInfo(userId); irmaHome.Id = userId; Session["IrmaHomeModel"] = irmaHome; DataSet ds = this.GetDataSet("select * from vw_TLCPersonnelSummary where EnscoPassportNo='" + this.UserId + "'"); this.ViewBag.TimeAt = ds; return(View(irmaHome)); }
public ActionResult RigAdminFieldsVisiblePartial() { RigAdminManageModel manageRigModel = (RigAdminManageModel)Session["manageRigModel"]; manageRigModel.SelectedPersonnelRigId = UtilitySystem.Settings.RigId; IIrmaServiceDataModel rigReqs = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.RigFieldVisible); if (rigReqs != null) { manageRigModel.FieldsVisible = rigReqs.GetAllItems(); } return(PartialView("RigAdminFieldsVisiblePartial", manageRigModel)); }
public static void AddApprover(ApprovalModel approvalModel, LessonLearnedModel lessonLearned) { IIrmaServiceDataModel dataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Approval); var approver = ServiceSystem.GetUser((int)approvalModel.Approver); approvalModel.Type = (int)ApprovalModel.ApprovalType.LessonsLearnedApproval; approvalModel.RequestItemId = lessonLearned.Id; approvalModel.Name = lessonLearned.Title; approvalModel.Requester = UtilitySystem.CurrentUserId; approvalModel.RequestedDate = DateTime.Now; approvalModel.Position = (int)approver.Position; approvalModel = dataModel.Add(approvalModel); lessonLearned.Approvals.Add(approvalModel); }
public ActionResult RigAdminIsolationLockDelete(LockModel model) { RigAdminManageModel manageRigModel = (RigAdminManageModel)Session["manageRigModel"]; if (ModelState.IsValid) { IIrmaServiceDataModel dataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.IsolationLock); LockModel entity = dataModel.GetItem(string.Format("id={0}", model.id), "id"); if (entity != null) { bool bResult = dataModel.Delete(entity); } } return(PartialView("RigAdminIsolationLockPartial", manageRigModel.IsolationLocks)); }
public ActionResult RosterSignInReport() { RosterSignInSheet report = new RosterSignInSheet(); report.RigName.Value = Ensco.Utilities.UtilitySystem.Settings.RigName; report.LogoFile.Value = HttpContext.Server.MapPath("~/Images/ensco.png"); report.IrmaFile.Value = HttpContext.Server.MapPath("~/Images/irma.png"); IIrmaServiceDataModel dataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.RosterFull); List <RosterUserModel> list = dataModel.GetAllItems().Cast <RosterUserModel>().ToList(); report.DataSource = list; Session["currentReport"] = report; return(RedirectToAction("ShowReport", "Report")); }
public ActionResult CrewArrivalDepartureLogReport(int Id) { PobArrivalDepartureLogReport report = new PobArrivalDepartureLogReport(); report.RigName.Value = Ensco.Utilities.UtilitySystem.Settings.RigName; report.LogoFile.Value = HttpContext.Server.MapPath("~/Images/ensco.png"); report.IrmaFile.Value = HttpContext.Server.MapPath("~/Images/irma.png"); IIrmaServiceDataModel dataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.CrewArrivalDepartureLog); report.DataSource = dataModel.GetItems(string.Format("CrewChangeId={0}", Id), "Id"); Session["currentReport"] = report; return(RedirectToAction("ShowReport", "Report")); }
public ActionResult RoomBedSummaryReport() { RoomBedSummaryReport report = new RoomBedSummaryReport(); report.RigName.Value = Ensco.Utilities.UtilitySystem.Settings.RigName; report.LogoFile.Value = HttpContext.Server.MapPath("~/Images/ensco.png"); report.IrmaFile.Value = HttpContext.Server.MapPath("~/Images/irma.png"); IIrmaServiceDataModel dataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.RoomBedSummary); report.DataSource = dataModel.GetAllItems(); Session["currentReport"] = report; return(RedirectToAction("ShowReport", "Report")); }
public ActionResult RigAdminListsPartial() { RigAdminManageModel manageRigModel = (RigAdminManageModel)Session["manageRigModel"]; IIrmaServiceDataModel emailDataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Emails); PobEmailModel pobEmail = emailDataModel.GetItem(string.Format("Name=\"PobSummaryReport\""), "Name"); PobEmailModel dailyEmail = emailDataModel.GetItem(string.Format("Name=\"DailySummaryReport\""), "Name"); char[] sep = { ';' }; manageRigModel.MaxPOB = IrmaServiceSystem.GetMaxPOB(); manageRigModel.DateFormat = UtilitySystem.Settings.ConfigSettings["DateFormat"]; manageRigModel.DateTimeFormat = UtilitySystem.Settings.ConfigSettings["DateTimeFormat"]; manageRigModel.PobSummaryEmailList = (pobEmail != null && pobEmail.Recipients != null) ? pobEmail.Recipients.Split(sep) : null; manageRigModel.DailySummaryEmailList = (dailyEmail != null && dailyEmail.Recipients != null) ? dailyEmail.Recipients.Split(sep) : null; // Phase 1 Parameters string val = IrmaServiceSystem.GetAdminCustomValue("EmailTime"); manageRigModel.EmailTime = (val != null) ? DateTime.Parse(val) : DateTime.Now; val = IrmaServiceSystem.GetAdminCustomValue("Brazil"); manageRigModel.IsRigInBrazil = (val != null && val == "1") ? true : false; val = IrmaServiceSystem.GetAdminCustomValue("RequireClientSignature"); manageRigModel.ChooseClientSignAtTimeOfPermit = (val != null && val == "1") ? true : false; val = IrmaServiceSystem.GetAdminCustomValue("ClientHotWork"); manageRigModel.IsClientRequireSignHotWorkPermit = (val != null && val == "1") ? true : false; val = IrmaServiceSystem.GetAdminCustomValue("ClientColdWork"); manageRigModel.IsClientRequireSignColdWorkPermit = (val != null && val == "1") ? true : false; val = IrmaServiceSystem.GetAdminCustomValue("ClientConfinedSpace"); manageRigModel.IsClientRequireSignConfinedWorkPermit = (val != null && val == "1") ? true : false; val = IrmaServiceSystem.GetAdminCustomValue("OIM"); UserModel userOIM = ServiceSystem.GetUserFromPassport(val.Trim()); manageRigModel.CurrentOIM = userOIM.Id; val = IrmaServiceSystem.GetAdminCustomValue("Master"); UserModel userMaster = ServiceSystem.GetUserFromPassport(val.Trim()); if (userMaster != null) { manageRigModel.CurrentMaster = userMaster.Id; } Session["manageRigModel"] = manageRigModel; return(PartialView("RigAdminListsPartial", manageRigModel)); }
public ActionResult CapBookApprovalStatusUpdate(int Id, int ApprovalId, int Approver, int Status) { ManageCapBookModel model = (ManageCapBookModel)Session["ManageCapBookModel"]; IIrmaServiceDataModel statusDataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Approval); ApprovalModel approval = statusDataModel.GetItem(string.Format("Id={0}", ApprovalId), "Id"); if (approval != null) { approval.Status = Status; if (Status != 2) { approval.ApprovedDate = DateTime.Now; } statusDataModel.Update(approval); } return(View("CapBookApproval", model)); }
public ActionResult RigAdminFieldsVisibleUpdate(RigFieldVisibilityModel model) { RigAdminManageModel manageRigModel = (RigAdminManageModel)Session["manageRigModel"]; if (ModelState.IsValid) { IIrmaServiceDataModel rigReqs = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.RigFieldVisible); RigFieldVisibilityModel entityModel = rigReqs.GetItem(string.Format("Id={0}", model.Id), "Id"); if (entityModel != null) { entityModel.Visible = model.Visible; entityModel.Name = model.Name; rigReqs.Update(entityModel); manageRigModel.FieldsVisible = rigReqs.GetAllItems(); } } return(PartialView("RigAdminFieldsVisiblePartial", manageRigModel)); }
public ActionResult RigAdminIsolationLockAdd(LockModel model) { RigAdminManageModel manageRigModel = (RigAdminManageModel)Session["manageRigModel"]; if (ModelState.IsValid) { LookupListModel <dynamic> lkpList = UtilitySystem.GetLookupList("YesNoList"); int listId = 0; if (!int.TryParse(model.Available, out listId)) { listId = 0; } model.Available = (string)lkpList.GetDisplayValue(listId); model = IrmaServiceSystem.Add(IrmaConstants.IrmaPobModels.IsolationLock, model, true); } return(PartialView("RigAdminIsolationLockPartial", manageRigModel.IsolationLocks)); }
public ActionResult SubmitForApproval() { LessonLearnedModel lessonLearned = (LessonLearnedModel)Session["LessonLearnedModel"]; if (lessonLearned == null) { return(RedirectToAction("Index")); } var approvals = lessonLearned.Approvals.Where(a => a.Type == (int)ApprovalModel.ApprovalType.LessonsLearnedApproval); var approvalDataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Approval); foreach (var approval in approvals) { approval.Status = (int)IrmaConstants.ApprovalStatus.PendingApproval; approvalDataModel.Update(approval); } lessonLearned.Status = "Pending Approval"; dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearned); dataModel.Update(lessonLearned); return(RedirectToAction("Edit", new { Id = lessonLearned.Id })); }
public ActionResult CapBookApprovalDetailUpdate(ApprovalModel approval) { ManageCapBookModel model = (ManageCapBookModel)Session["ManageCapBookModel"]; if (ModelState.IsValid) { IIrmaServiceDataModel approvalModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Approval); ApprovalModel entity = approvalModel.GetItem(string.Format("Id={0}", approval.Id), "Id"); if (entity != null) { entity.ApproverComments = approval.ApproverComments; approvalModel.Update(entity); int index = model.Approvals.FindIndex(x => x.Id == approval.Id); if (index >= 0 && index < model.Approvals.Count) { model.Approvals[index].ApproverComments = approval.ApproverComments; } } } return(PartialView("CapBookApprovalDetailPartial", model)); }
public static LessonLearnedModel GetLessonLearned(int id) { var dataModel = GetServiceModel(OAPDataModelType.LessonLearned); LessonLearnedModel lessonLearned = dataModel.GetItem(string.Format("Id={0}", id), "Id"); IIrmaServiceDataModel approvalDataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Approval); var approvals = approvalDataModel.GetItems( string.Format("RequestItemId={0}", lessonLearned.Id), "Id").Cast <ApprovalModel>().ToList(); foreach (var approver in approvals) { var user = ServiceSystem.GetUser((int)approver.Approver); approver.Position = (int)user.Position; approver.Initialize(); } lessonLearned.Approvals = approvals; dataModel = OAPServiceSystem.GetServiceModel(OAPDataModelType.LessonLearnedType); LessonLearnedType lessonType = (LessonLearnedType)dataModel.GetItem(string.Format("Id={0}", lessonLearned.TypeId), "Id"); lessonLearned.Type = lessonType; lessonLearned.Attachments = ServiceSystem.GetAttachments("Lessons Learned", lessonLearned.Id.ToString()); dataModel = GetServiceModel(OAPDataModelType.LessonLearnedOriginator); var originators = dataModel.GetItems(string.Format("LessonId={0}", lessonLearned.Id), "Id").Cast <LessonLearnedOriginatorModel>().ToList(); foreach (var originator in originators) { var user = ServiceSystem.GetUser(originator.PassportId); originator.Position = (int)user.Position; } lessonLearned.Originators = originators; return(lessonLearned); }
public static void ProcessPobSummaryEmailJob(ScheduleJobModel job) { Logger.Info(new LogInfo(MethodBase.GetCurrentMethod(), string.Format("Processing jobId={0}", job.Id))); PobSummaryReport report = new PobSummaryReport(); report.RigName.Value = Ensco.Utilities.UtilitySystem.Settings.RigName; report.LogoFile.Value = System.Web.Hosting.HostingEnvironment.MapPath("~/Images/ensco.png"); report.IrmaFile.Value = System.Web.Hosting.HostingEnvironment.MapPath("~/Images/irma.png"); // Show/Hide Essential and Vantage IIrmaServiceDataModel reqModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.RigFieldVisible); RigFieldVisibilityModel req = (RigFieldVisibilityModel)reqModel.GetItem(string.Format("Id=1"), "Id"); report.ShowVantage.Value = (req != null) ? req.Visible : true; req = (RigFieldVisibilityModel)reqModel.GetItem(string.Format("Id=3"), "Id"); report.ShowEssential.Value = (req != null) ? req.Visible : true; List <PobSummaryReportModel> list = new List <PobSummaryReportModel>(); list.Add(IrmaServiceSystem.GetSummaryReportData()); report.DataSource = list; 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(); report.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) { } }
public ActionResult RigAdminListsPartial(RigAdminManageModel model) { RigAdminManageModel manageRigModel = (RigAdminManageModel)Session["manageRigModel"]; if (ModelState.IsValid) { IrmaServiceSystem.SaveMaxPOB(model.MaxPOB); //UtilitySystem.Settings.ConfigSettings["DateFormat"] = model.DateFormat; //UtilitySystem.Settings.ConfigSettings["DateTimeFormat"] = model.DateTimeFormat; //UtilitySystem.SaveConfigSettings(); IrmaServiceSystem.UpdateAdminCustomValue("DateFormat", model.DateFormat); IrmaServiceSystem.UpdateAdminCustomValue("DateTimeFormat", model.DateTimeFormat); UtilitySystem.Settings.ConfigSettings["DateFormat"] = model.DateFormat; UtilitySystem.Settings.ConfigSettings["DateTimeFormat"] = model.DateTimeFormat; IIrmaServiceDataModel emailDataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Emails); PobEmailModel emailModel = emailDataModel.GetItem(string.Format("Name=\"PobSummaryReport\""), "Name"); emailModel.Recipients = (model.PobSummaryEmailList != null) ? string.Join(";", model.PobSummaryEmailList) : null; emailDataModel.Update(emailModel); emailModel = emailDataModel.GetItem(string.Format("Name=\"DailySummaryReport\""), "Name"); emailModel.Recipients = (model.DailySummaryEmailList != null) ? string.Join(";", model.DailySummaryEmailList) : null; emailDataModel.Update(emailModel); string dailyEmails = ""; if (model.DailySummaryEmailList != null) { char[] sep = { ';' }; foreach (string sid in model.DailySummaryEmailList) { int id = 0; if (!int.TryParse(sid, out id)) { continue; } UserModel user = ServiceSystem.GetUser(id); if (user != null && user.Email != null && user.Email.Length > 0) { dailyEmails += user.Email + ";"; } } dailyEmails = dailyEmails.Trim(sep); } UserModel userOIM = ServiceSystem.GetUser(model.CurrentOIM); UserModel userMaster = ServiceSystem.GetUser(model.CurrentMaster); // Phase 1 parameters IrmaServiceSystem.UpdateAdminCustomValue("EmailTime", model.EmailTime.ToString("HH:mm")); IrmaServiceSystem.UpdateAdminCustomValue("Brazil", string.Format("{0}", model.IsRigInBrazil ? "1" : "0")); IrmaServiceSystem.UpdateAdminCustomValue("RequireClientSignature", string.Format("{0}", model.ChooseClientSignAtTimeOfPermit ? "1" : "0")); IrmaServiceSystem.UpdateAdminCustomValue("ClientHotWork", string.Format("{0}", model.IsClientRequireSignHotWorkPermit ? "1" : "0")); IrmaServiceSystem.UpdateAdminCustomValue("ClientColdWork", string.Format("{0}", model.IsClientRequireSignColdWorkPermit ? "1" : "0")); IrmaServiceSystem.UpdateAdminCustomValue("ClientConfinedSpace", string.Format("{0}", model.IsClientRequireSignConfinedWorkPermit ? "1" : "0")); IrmaServiceSystem.UpdateAdminCustomValue("DailySummaryEmails", dailyEmails); if (userOIM != null) { IrmaServiceSystem.UpdateAdminCustomValue("OIM", userOIM.Passport); IrmaServiceSystem.UpdateAdminCustomValue("OIMName", userOIM.DisplayName); } if (userMaster != null) { IrmaServiceSystem.UpdateAdminCustomValue("Master", userMaster.Passport); IrmaServiceSystem.UpdateAdminCustomValue("MasterName", userMaster.DisplayName); } manageRigModel = model; } ControllerContext.HttpContext.Response.Redirect("RigRequirements"); ViewBag.Flag = "Save"; return(null); return(PartialView("RigAdminListsPartial", manageRigModel)); }