public RequestResult <object> Help(string Email, string Message, string UserEmail = null) { try { SystemVariableServices SV = new SystemVariableServices(); var Key = Crypto.ToBase64(SV.GetSystemVariableValue("CryptoKey")).ToString().Substring(0, 16); var Iv = Crypto.ToBase64(SV.GetSystemVariableValue("CryptoIV")).ToString().Substring(0, 16); var _Email = (!string.IsNullOrEmpty(UserEmail)) ? UserEmail : Crypto.DecryptString(Email, Key, Iv); var _Message = Crypto.DecryptString(Message, Key, Iv); var _To = SV.GetSystemVariableValue("SupportEmailInbox"); var _From = SV.GetSystemVariableValue("EgulfSupportEmail"); MailServices MailServ = new MailServices(); ITemplate factory = new TemplateMessagesFactory(); Dictionary <string, string[]> param = new Dictionary <string, string[]>(); param.Add("{Enfasis}", new string[] { _Message }); param.Add("{Text}", new string[] { _Email }); MailServ.SendMail(factory.GetTemplate(_To, "NewIncident", param, _From)); return(new RequestResult <object> { Status = Status.Success }); } catch (Exception ex) { return(new RequestResult <object> { Status = Status.Error }); } }
public void UpdateRolePerson(int?userId, string rol) { UserServices userServ = new UserServices(); SystemVariableServices SystemVariableServ = new SystemVariableServices(); userServ.UpdateRoleUser(userId, int.Parse(SystemVariableServ.GetSystemVariableValue(rol))); }
public JsonResult Get(DatatableModel dt, ProjectModel parameters) { try { SystemVariableServices SystemVariableServ = new SystemVariableServices(); var ActiveProject = Convert.ToInt32(SystemVariableServ.GetSystemVariableValue("EstatusActiveProject")); ProjectServices ProjectServ = new ProjectServices(); PagerModel pager = dt.ToPager(); parameters.CompanyId = SessionWeb.User.CompanyId ?? -1; var collection = ProjectServ.GetProjectCollection(parameters, pager); return(Json(new { status = UI.Status.Success, sEcho = dt.sEcho, iTotalRecords = pager.TotalRecords, iTotalDisplayRecords = pager.TotalRecords, aaData = collection.Data }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(new JsonResult { Data = new { status = UI.Status.Error, data = ex.Message }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } }
public ActionResult SaveProjectInfo(ProjectModel parameters) { try { SystemVariableServices SystemVariableServ = new SystemVariableServices(); var ActiveProject = Convert.ToInt32(SystemVariableServ.GetSystemVariableValue("EstatusActiveProject")); ProjectServices ProjectServ = new ProjectServices(); parameters.CompanyId = (int)SessionWeb.User.CompanyId; parameters.Status = ActiveProject; RequestResult <object> result = ProjectServ.SaveProject(parameters); //InsUpdProjectInfo(parameters); if (result.Status != Status.Success) { throw new Exception(result.Message); } else { return(Json(result)); } } catch (Exception ex) { Response.StatusCode = (int)HttpStatusCode.BadRequest; Response.StatusDescription = ex.Message; return(Json(ex.Message, JsonRequestBehavior.AllowGet)); } }
// GET: SingUp public ActionResult Index() { SystemVariableServices sv = new SystemVariableServices(); SessionWeb.Key = Security.Sevices.Crypto.ToBase64(sv.GetSystemVariableValue("CryptoKey")).ToString().Substring(0, 16); SessionWeb.Iv = Security.Sevices.Crypto.ToBase64(sv.GetSystemVariableValue("CryptoIV")).ToString().Substring(0, 16); return(View()); }
public ActionResult Invitate() { SystemVariableServices SystemVariableServ = new SystemVariableServices(); UserServices userServ = new UserServices(); var role = userServ.GetRole(new User { UserId = (int)SessionWeb.User.UserId }); if (role != null ? !role.RoleId.ToString().Equals(SystemVariableServ.GetSystemVariableValue("RolAdminCompany")) : true) { return(RedirectToAction("Index")); } return(View()); }
private CloudBlobContainer Container() { SystemVariableServices conf = new SystemVariableServices(); string AzureStorage = conf.GetSystemVariableValue("AzureStorage"); string storageConnectionString = "DefaultEndpointsProtocol=https;" + AzureStorage + ";EndpointSuffix=core.windows.net"; CloudStorageAccount account = CloudStorageAccount.Parse(storageConnectionString); CloudBlobClient serviceClient = account.CreateCloudBlobClient(); return(serviceClient.GetContainerReference("files")); }
public ActionResult Index() { if (SessionWeb.User != null) { Server.ClearError(); Response.Clear(); Response.Redirect("/match/index"); } SystemVariableServices sv = new SystemVariableServices(); SessionWeb.Key = Security.Sevices.Crypto.ToBase64(sv.GetSystemVariableValue("CryptoKey")).ToString().Substring(0, 16); SessionWeb.Iv = Security.Sevices.Crypto.ToBase64(sv.GetSystemVariableValue("CryptoIV")).ToString().Substring(0, 16); return(View()); }
public ActionResult Create(int?id = 0) { ProjectTypeServices ProjectTypeServ = new ProjectTypeServices(); RegionServices RegionServ = new RegionServices(); SystemVariableServices SystemVarServ = new SystemVariableServices(); ViewBag.ProjectId = id; ViewBag.LstProjectType = ProjectTypeServ.GetSelect(null).Select(x => new SelectListItem() { Value = x.Value, Text = x.Text }); ViewBag.LstRegion = RegionServ.GetSelect(null).Select(x => new SelectListItem() { Value = x.Value, Text = x.Text }); //ViewBag.ProjectCategoryType = JsonConvert.SerializeObject(SystemVarServ.GetSystemVariableValue("ProjectCategoryClasification")); ViewBag.CabinSpecificationType = JsonConvert.SerializeObject(SystemVarServ.GetSystemVariableValue("CabinSpecificationTypes")); ViewBag.LstProjectCategoryType = JsonConvert.SerializeObject(ProjectTypeServ.Get(new ProjectTypeModel()).ToList()); return(View()); }
public ActionResult Index() { SystemVariableServices SystemVariableServ = new SystemVariableServices(); UserServices userServ = new UserServices(); var role = userServ.GetRole(new User { UserId = (int)SessionWeb.User.UserId }); CompanyServices CompServ = new CompanyServices(); CompanyModel company = new CompanyModel(); ViewData["isOwner"] = role != null?role.RoleId.ToString().Equals(SystemVariableServ.GetSystemVariableValue("RolAdminCompany")) : false; ViewData["invitations"] = UserPerson.InvitationsCompanies; if (HasCompany()) { company = CompServ.Get(new CompanyModel() { CompanyId = UserCompanyId }).FirstOrDefault(); } return(View(company)); }
public RequestResult <object> SaveProject(ProjectModel parameters) { TransactionOptions scopeOptions = new TransactionOptions(); //scopeOptions.IsolationLevel = IsolationLevel.ReadCommitted; using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, scopeOptions)) { try { //here we save basic project info var respSaveProjectBasicInfo = InsUpdProjectInfo(parameters); if (respSaveProjectBasicInfo.Status == Status.Success) { SystemVariableServices SystemVariableServ = new SystemVariableServices(); Int16 TypeProject = Convert.ToInt16(SystemVariableServ.GetSystemVariableValue("TypeProject")); var dataProjectBasicInfo = (ProjectModel)respSaveProjectBasicInfo.Data; parameters.ProjectId = dataProjectBasicInfo.ProjectId; //we save specific info SpecificInformationServices SpecificInfoServ = new SpecificInformationServices(); SpecificInformationModel SpecificInfoModel = parameters; SpecificInfoModel.MatchableId = parameters.ProjectId; SpecificInfoModel.Type = TypeProject; var respSaveProjectSpecificInfo = SpecificInfoServ.InsUpd(SpecificInfoModel); if (respSaveProjectSpecificInfo.Status == Status.Success) { //we validate project category and only save cabin specifications if project category is personnel transportation ProjectTypeServices ProjectTypeServ = new ProjectTypeServices(); ProjectTypeModel ProjectType = ProjectTypeServ.GetById(parameters.ProjectTypeId); string CategoryPersonnelTransportation = SystemVariableServ.GetSystemVariableValue("CategoryPersonnelTransportation"); if (ProjectType.Category == CategoryPersonnelTransportation) { ////at the end we save cabin specifications //CabinSpecificationServices CabinSpecificationServ = new CabinSpecificationServices(); //foreach (var item in parameters.CabinSpecification.ToList()) //{ // item.ReferenceId = parameters.ProjectId; // item.Type = TypeProject; // var respSaveCabinSpecification = CabinSpecificationServ.InsUpd(item); // if (respSaveCabinSpecification.Status == Status.Error) // throw new Exception(respSaveCabinSpecification.Message); //} } ts.Complete(); return(new RequestResult <object>() { Status = Status.Success, Data = parameters }); } else { throw new Exception(respSaveProjectSpecificInfo.Message); } } else { //return respSaveProjectBasicInfo; throw new Exception(respSaveProjectBasicInfo.Message); } } catch (Exception ex) { ts.Dispose(); return(new RequestResult <object>() { Status = Status.Error, Message = ex.Message }); } } }
/// <summary> /// Offer from Project to Vessel /// Validations /// Insert offer with Status NEW /// Send alert to Vessel company owners /// Send mail to Vessel company owners /// </summary> /// <param name="offer"></param> /// <returns></returns> public RequestResult <List <AlertModel> > InsComplete(OfferModel offer) { RequestResult <List <AlertModel> > resp = new RequestResult <List <AlertModel> >() { Status = Status.Success }; OfferDA offerDA = new OfferDA(); VesselServices vesselServices = new VesselServices(); PersonServices personServices = new PersonServices(); AlertServices alertServices = new AlertServices(); List <AlertModel> lstAlertToSend = new List <AlertModel>(); MailServices MailServ = new MailServices(); ITemplate factory = new TemplateMessagesFactory(); TransactionOptions scopeOptions = new TransactionOptions(); ////scopeOptions.IsolationLevel = IsolationLevel.ReadCommitted; using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, scopeOptions)) { try { if (offer.Vessel.VesselId == null) { throw new Exception("VesselId REQUIRED"); } if (offer.Project.ProjectId == null) { throw new Exception("ProjectId REQUIRED"); } if (offer.ProjectAdmin.PersonId == null) { throw new Exception("ProjectAdmin.PersonId REQUIRED"); } OfferModel val = new OfferModel(); List <OfferModel> lstVal = new List <OfferModel>(); val.Project.ProjectId = offer.Project.ProjectId; val.Vessel.VesselId = offer.Vessel.VesselId; lstVal = Get(val); if (lstVal.Count > 0) { throw new Exception("STATUS_NOT_VALID"); } VesselModel vessel = new VesselModel(); vessel.VesselId = offer.Vessel.VesselId; vessel = vesselServices.Get(vessel).FirstOrDefault(); // Insert offer with Status NEW var respOffer = offerDA.InsUpd(offer); if (respOffer.Status != Status.Success) { throw new Exception(respOffer.Message); } // Send alert to Vessel company owners //Listado de los usuarios de una compañía UserPersonModel person = new UserPersonModel(); person.CompanyId = vessel.Company.CompanyId; List <UserPersonModel> lst = personServices.getUserPerson(person); Dictionary <string, string> values = new Dictionary <string, string>(); values.Add("IMO", vessel.Imo); values.Add("VESSELNAME", vessel.Name); AlertModel alert = alertServices.GetWithValues(6, values); SystemVariableServices SVS = new SystemVariableServices(); Dictionary <string, string[]> param = new Dictionary <string, string[]>(); string EgulfUrl = SVS.GetSystemVariableValue("EgulfWeb"); param.Add("{Enfasis}", new string[] { vessel.Imo, vessel.Name }); param.Add("{Btn_url}", new string[] { EgulfUrl }); foreach (UserPersonModel personItem in lst) { AlertModel alertAux = alert.Clone(); alertAux.To = personItem.PersonId; lstAlertToSend.Add(alertAux); MailServ.SendMail(factory.GetTemplate(personItem.Email, "VesselOfferReceived", param)); } var respAlert = alertServices.InsUpd(lstAlertToSend); if (respAlert != null) { throw new Exception(respAlert.Message); } resp.Data = lstAlertToSend; ts.Complete(); } catch (Exception ex) { ts.Dispose(); resp = new RequestResult <List <AlertModel> >() { Status = Status.Error, Message = ex.Message }; Elmah.ErrorSignal.FromCurrentContext().Raise(ex); throw ex; } } return(resp); }
public RequestResult <List <AlertModel> > Fix(OfferModel model) { RequestResult <List <AlertModel> > resp = new RequestResult <List <AlertModel> >(); MailServices MailServ = new MailServices(); ITemplate factory = new TemplateMessagesFactory(); VesselServices vesselServices = new VesselServices(); AlertServices alertServices = new AlertServices(); AlertTemplateServices templateServices = new AlertTemplateServices(); List <AlertModel> lstAlertToSend = new List <AlertModel>(); if (model.OfferId == null) { throw new Exception("REQUIRED OfferId"); } TransactionOptions scopeOptions = new TransactionOptions(); ////scopeOptions.IsolationLevel = IsolationLevel.ReadCommitted; using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, scopeOptions)) { try { OfferModel val = GetById((int)model.OfferId); if (val == null) { throw new Exception("NOT_FOUND"); } if (val.Status != OfferModel.NEW) { throw new Exception("STATUS_NOT_VALID"); } OfferModel modelUpd = new OfferModel(); modelUpd.OfferId = model.OfferId; model.Status = OfferModel.FIX; InsUpd(model); Dictionary <string, string> values = new Dictionary <string, string>(); values.Add("FLAG", val.Vessel.Country.Name); values.Add("HOMEPORT", val.Vessel.HomePort.Name); values.Add("IMO", val.Vessel.Imo); values.Add("VESSELNAME", val.Vessel.Name); values.Add("FOLIO", val.Project.Folio); //Notify to project owner alert and mail AlertModel alertFix = alertServices.GetWithValues(7, values); alertFix.To = val.ProjectAdmin.PersonId; lstAlertToSend.Add(alertFix); var respAlert = alertServices.InsUpd(alertFix); if (respAlert != null) { throw new Exception(respAlert.Message); } SystemVariableServices SVS = new SystemVariableServices(); Dictionary <string, string[]> param = new Dictionary <string, string[]>(); string EgulfUrl = SVS.GetSystemVariableValue("EgulfWeb"); param.Add("{Enfasis}", new string[] { val.Vessel.Country.Name, val.Vessel.HomePort.Name, val.Project.Folio }); param.Add("{Btn_url}", new string[] { EgulfUrl }); MailServ.SendMail(factory.GetTemplate(val.ProjectAdmin.Email, "OfferFix", param)); resp.Data = lstAlertToSend; ts.Complete(); } catch (Exception ex) { ts.Dispose(); resp = new RequestResult <List <AlertModel> >() { Status = Status.Error, Message = ex.Message }; Elmah.ErrorSignal.FromCurrentContext().Raise(ex); throw ex; } } return(resp); }
/// <summary> /// Validate Status /// Validate Availabilty /// Update Offer /// Update availability /// Cancel other offers if exists /// Notify to vessel owners cancelled if exists /// Notify to project owner by Signal and Mail /// Generate Agreement Report and send Mail /// </summary> /// <param name="model"></param> public RequestResult <List <AlertModel> > Accept(OfferModel model, int currentPersonId) { RequestResult <List <AlertModel> > resp = new RequestResult <List <AlertModel> >(); MailServices MailServ = new MailServices(); ITemplate factory = new TemplateMessagesFactory(); VesselServices vesselServices = new VesselServices(); VesselAvailabilityServices availabilityServices = new VesselAvailabilityServices(); AlertServices alertServices = new AlertServices(); AlertTemplateServices templateServices = new AlertTemplateServices(); List <AlertModel> lstAlertToSend = new List <AlertModel>(); ProjectServices projectServices = new ProjectServices(); TransactionOptions scopeOptions = new TransactionOptions(); scopeOptions.IsolationLevel = IsolationLevel.Serializable; using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, scopeOptions)) { try { //Validate if (model.OfferId == null) { throw new Exception("REQUIRED OfferId"); } if (model.VesselAdmin.PersonId == null) { throw new Exception("VesselAdmin.PersonId REQUIRED"); } OfferModel val = GetById((int)model.OfferId); if (val == null) { throw new Exception("NOT_FOUND"); } if (val.Status != OfferModel.NEW) { if (!(val.Status == OfferModel.FIX && val.VesselAdmin.PersonId == currentPersonId)) { throw new Exception("STATUS_NOT_VALID"); } } VesselAvailabilityModel availabilityModel = new VesselAvailabilityModel() { ReasonId = VesselAvailabilityModel.DEFAULT, VesselId = val.Vessel.VesselId, StartDate = val.Project.StartDate, EndDate = val.Project.EndDate }; int val2 = vesselServices.EvalAvailability(availabilityModel); if (val2 > 0) { throw new Exception("NOT_AVAILABILITY"); } //Update Offer model.Status = OfferModel.ACCEPTED; var respOffer = InsUpd(model); if (respOffer.Status != Status.Success) { throw new Exception(respOffer.Message); } //Update vessel availabilty var respAvailability = availabilityServices.InsUpd(availabilityModel); if (respAvailability.Status != Status.Success) { throw new Exception(respAvailability.Message); } //Update Project Status var respStatus = projectServices.UpdateStatus(val.Project.ProjectId, ProjectModel.STATUS_FIXED); if (respStatus.Status != Status.Success) { throw new Exception(respStatus.Message); } //Get new values val = GetById((int)model.OfferId); // Cancel other offers if exists List <OfferModel> lstNotifyCancel = CancelOthers((int)val.OfferId); Dictionary <string, string> values = new Dictionary <string, string>(); values.Add("FLAG", val.Vessel.Country.Name); values.Add("HOMEPORT", val.Vessel.HomePort.Name); AlertTemplateModel template = templateServices.GetById(4); foreach (OfferModel offerCancelled in lstNotifyCancel) { if (!values.ContainsKey("FOLIO")) { values.Add("FOLIO", offerCancelled.Project.Folio); } else { values["FOLIO"] = offerCancelled.Project.Folio; } AlertModel alertCancelled = alertServices.GetWithValues(template, values); alertCancelled.To = offerCancelled.ProjectAdmin.PersonId; lstAlertToSend.Add(alertCancelled); } //Notify to project owner values = new Dictionary <string, string>(); values.Add("IMO", val.Vessel.Imo); values.Add("VESSELNAME", val.Vessel.Name); values.Add("FOLIO", val.Project.Folio); AlertModel alertAccepted = alertServices.GetWithValues(5, values); alertAccepted.To = val.ProjectAdmin.PersonId; lstAlertToSend.Add(alertAccepted); var respAlert = alertServices.InsUpd(lstAlertToSend); if (respAlert != null) { throw new Exception(respAlert.Message); } //Send mail //Generate Agreement Report and send to mail List <MailAttachments> agreementReportProject = new List <MailAttachments>(); SystemVariableServices SVS = new SystemVariableServices(); Dictionary <string, string[]> param = new Dictionary <string, string[]>(); string EgulfUrl = SVS.GetSystemVariableValue("EgulfWeb"); param.Add("{Enfasis}", new string[] { val.Vessel.Imo, val.Vessel.Name, val.Project.Folio }); param.Add("{Btn_url}", new string[] { EgulfUrl }); ReportServices ReportServ = new ReportServices(); agreementReportProject.Add(ReportServ.AgreementReportAttachment((int)model.OfferId, (int)TypeUser.Project)); MailServ.SendMailWithAttachment(factory.GetTemplate(val.ProjectAdmin.Email, "OfferAccepted", param), agreementReportProject); param = new Dictionary <string, string[]>(); param.Add("{Enfasis}", new string[] { val.Project.Folio }); param.Add("{Btn_url}", new string[] { EgulfUrl }); List <MailAttachments> agreementReportVessel = new List <MailAttachments>(); agreementReportVessel.Add(ReportServ.AgreementReportAttachment((int)model.OfferId, (int)TypeUser.Vessel)); MailServ.SendMailWithAttachment(factory.GetTemplate(val.VesselAdmin.Email, "YouAcceptedOffer", param), agreementReportVessel); resp.Data = lstAlertToSend; ts.Complete(); } catch (Exception ex) { ts.Dispose(); resp = new RequestResult <List <AlertModel> >() { Status = Status.Error, Message = ex.Message }; Elmah.ErrorSignal.FromCurrentContext().Raise(ex); throw ex; } } return(resp); }
public RequestResult <object> RecoverAccount(string SecureEmail) { TransactionOptions scopeOptions = new TransactionOptions(); //scopeOptions.IsolationLevel = IsolationLevel.ReadCommitted; using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, scopeOptions)) { try { SystemVariableServices SV = new SystemVariableServices(); var Key = Crypto.ToBase64(SV.GetSystemVariableValue("CryptoKey")).ToString().Substring(0, 16); var Iv = Crypto.ToBase64(SV.GetSystemVariableValue("CryptoIV")).ToString().Substring(0, 16); var Email = Crypto.DecryptString(SecureEmail, Key, Iv); RequestResult <PersonModel> ValidAccount = valExistingEmail(new PersonModel() { Email = Email }); if (ValidAccount.Data.PersonId > 0) { PersonModel PersonData = GetPerson((int)ValidAccount.Data.PersonId); const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; Random randomChar = new Random(); var NewPassword = new string(Enumerable.Repeat(chars, 10).Select(s => s[randomChar.Next(s.Length)]).ToArray()); var NewSecurePassword = Crypto.EncryptString(NewPassword, Key, Iv); UserServices UserServ = new UserServices(); User userData = UserServ.SelUser(new User() { UserId = PersonData.UserId }); userData.Password = NewSecurePassword; User responseInsUpdUser = UserServ.insUpdUser(userData); if (responseInsUpdUser.UserId > 0) { MailServices MailServ = new MailServices(); ITemplate factory = new TemplateMessagesFactory(); SystemVariableServices SVS = new SystemVariableServices(); Dictionary <string, string[]> param = new Dictionary <string, string[]>(); string EgulfUrl = SVS.GetSystemVariableValue("EgulfWeb"); param.Add("{Btn_url}", new string[] { EgulfUrl }); param.Add("{Text}", new string[] { userData.UserName, NewPassword }); MailServ.SendMail(factory.GetTemplate(Email, "ResetAccount", param)); ts.Complete(); return(new RequestResult <object> { Status = Status.Success }); } else { throw new Exception("An unexpected error occurred at restore account process"); } } else { return(new RequestResult <object> { Status = Status.Warning }); } } catch (Exception ex) { ts.Dispose(); return(new RequestResult <object> { Status = Status.Error, Message = ex.Message }); } } }
public RequestResult <object> SingUp(PersonModel personParameters, User userParameters) { TransactionOptions scopeOptions = new TransactionOptions(); //scopeOptions.IsolationLevel = IsolationLevel.ReadCommitted; using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, scopeOptions)) { try { UserServices UserServ = new UserServices(); User responseValidateUser = UserServ.valExistingUsername(userParameters); if (responseValidateUser.UserId > 0) { return(new RequestResult <object> { Status = Status.Warning, Message = "MsgUserExisting" }); } else { userParameters.UserId = 0; User responseInsUpdUser = UserServ.insUpdUser(userParameters); if (responseInsUpdUser.UserId > 0) { RequestResult <PersonModel> personIdEmailExisting = valExistingEmail(personParameters); if (personIdEmailExisting.Data.PersonId > 0) { return(new RequestResult <object> { Status = Status.Warning, Message = "MsgEmailExisting" }); } else { personParameters.UserId = responseInsUpdUser.UserId; RequestResult <object> personResponse = insUpdPerson(personParameters); if (personResponse.Status == Status.Error) { throw new Exception("An unespected error was detected on create person"); } MailServices MailServ = new MailServices(); ITemplate factory = new TemplateMessagesFactory(); SystemVariableServices SVS = new SystemVariableServices(); Dictionary <string, string[]> param = new Dictionary <string, string[]>(); string EgulfUrl = SVS.GetSystemVariableValue("EgulfWeb"); param.Add("{Btn_url}", new string[] { EgulfUrl }); MailServ.SendMail(factory.GetTemplate(personParameters.Email, "WelcomeT", param)); //MailServ.wellcomeEmail(personParameters.Email); ts.Complete(); return(personResponse); } } else { throw new Exception("An unespected error was detected on create user"); } } } catch (Exception ex) { ts.Dispose(); return(new RequestResult <object>() { Status = Status.Error, Message = ex.Message }); } } }
public RequestResult <List <ProjectModel> > GetProjectCollection(ProjectModel parameters, PagerModel pagerParameters) { SystemVariableServices SystemVariableServ = new SystemVariableServices(); CabinSpecificationServices CabinSpecificationServ = new CabinSpecificationServices(); int TypeProject = Convert.ToInt16(SystemVariableServ.GetSystemVariableValue("TypeProject")); using (var db = new EGULFEntities()) { var queryResult = db.sp_SelPagProject(parameters.CompanyId, parameters.ProjectId, parameters.ProjectTypeId, parameters.StartDate, parameters.RegionId, parameters.Status, pagerParameters.Start, pagerParameters.Offset, pagerParameters.SortBy, pagerParameters.SortDir ).Select(x => new ProjectModel() { Number = x.Number, Total = x.Total, Folio = x.Folio, ProjectId = x.ProjectId, ProjectTypeId = x.ProjectTypeId, ProjectType = x.ProjectType, StartDate = x.StartDate, Duration = x.Duration, Extension = x.Extension, RegionId = x.RegionId, Region = x.Region, Budget = x.Budget, MaxRateBudget = x.MaxRateBudget, FreeDeckArea = x.FreeDeckArea, MudCapacity = x.MudCapacity, CementTankCapacity = x.CementTankCapacity, OilRecoveryCapacity = x.OilRecoveryCapacity, DynamicPositionSystem = x.DynamicPositionSystem, Status = x.Status, StatusDescription = x.StatusDescription, //Lat = x.Lat, //Lng = x.Lng, CompanyId = (int)x.CompanyId, CompanyName = x.CompanyName, //BHP = x.BHP, SubtypeId = x.SubtypeId, BollardPull = x.BollardPull, BollardPullAhead = x.BollardPullAhead, BollardPullAstern = x.BollardPullAstern, NumberPassenger = x.NumberPassenger, CabinSpecification = CabinSpecificationServ.GetByReferenceId(x.ProjectId, TypeProject), AirCondition = x.AirCondition, MessRoom = x.MessRoom, ControlRoom = x.ControlRoom, ConferenceRoom = x.ConferenceRoom, Gymnasium = x.Gym, SwimingPool = x.Pool, Office = x.Office, Hospital = x.Hospital, CargoCapacity = x.CargoCapacity, PumpRates = x.PumpRates, TankCapacity = x.TankCapacity, DischargeRate = x.DischargeRate, PemexCheck = x.PemexCheck, DeckStrenght = x.DeckStrenght, Type = x.Type }).ToList(); if (queryResult.Count > 0) { var data = queryResult.FirstOrDefault(); pagerParameters.TotalRecords = data.Total.HasValue ? data.Total.Value : 0; } return(new RequestResult <List <ProjectModel> >() { Status = Status.Success, Data = queryResult }); } }