public void ResizeLogos(OrganisationModel organisationModel, IConfiguration configuration, string rootPath, string currentUrl) { string tempPhysicalTempDirectory = rootPath + configuration.OrganisationNormalTempDirectory(); string logoFileName = FileHandler.GetPhysicalFileName(tempPhysicalTempDirectory, organisationModel.LogoFileName); FileHandler.ResizeImage(logoFileName, organisationModel.LogoFileName, new ImageModel { Width = configuration.OrganisationNormalImageWidth(), Height = configuration.OrganisationNormalImageHeight(), PhysicalDirectory = rootPath + configuration.OrganisationNormalDirectory(), RelativeDirectory = new Uri(currentUrl + configuration.OrganisationNormalDirectory()).AbsoluteUri }); FileHandler.ResizeImage(logoFileName, organisationModel.LogoFileName, new ImageModel { Width = configuration.OrganisationThumbnailImageWidth(), Height = configuration.OrganisationThumbnailImageHeight(), PhysicalDirectory = rootPath + configuration.OrganisationThumbnailDirectory(), RelativeDirectory = new Uri(currentUrl + configuration.OrganisationThumbnailDirectory()).AbsoluteUri }); FileHandler.ResizeImage(logoFileName, organisationModel.LogoFileName, new ImageModel { Width = configuration.OrganisationPreviewImageWidth(), Height = configuration.OrganisationPreviewImageHeight(), PhysicalDirectory = rootPath + configuration.OrganisationPreviewDirectory(), RelativeDirectory = new Uri(currentUrl + configuration.OrganisationPreviewDirectory()).AbsoluteUri }); }
public void CreateEntity(string EntityName, string EntityCode, string ManagerName, string Email, string Mobile, string Landline, string Address) { OrganisationModel OrgObj = new OrganisationModel(); SqlParameter[] SParam = new SqlParameter[8]; SParam[0] = new SqlParameter("@UserID", SqlDbType.Int); SParam[0].Value = Convert.ToInt32(Session["USER_ID"]); SParam[1] = new SqlParameter("@EntityName", SqlDbType.VarChar); SParam[1].Value = EntityName; SParam[2] = new SqlParameter("@EntityCode", SqlDbType.VarChar); SParam[2].Value = EntityCode; SParam[3] = new SqlParameter("@ManagerName", SqlDbType.VarChar); SParam[3].Value = ManagerName; SParam[4] = new SqlParameter("@Email", SqlDbType.VarChar); SParam[4].Value = Email; SParam[5] = new SqlParameter("@Mobile", SqlDbType.VarChar); SParam[5].Value = Mobile; SParam[6] = new SqlParameter("@Landline", SqlDbType.VarChar); SParam[6].Value = Landline; SParam[7] = new SqlParameter("@Address", SqlDbType.Text); SParam[7].Value = Address; try { OrgObj.CreateEntity(SParam); } catch (Exception ex) { } }
public ActionResult ViewOrganisation(Guid?staffCode, FormCollection form) { var model = GetUpdatedModel(); //Set flags false //Establish which organisation is to be added to the staff list //find lowest level with an organistion selected OrganisationModel selectedOrganisation = null; List <string> path = new List <string>(); foreach (var item in model.OrganisationsByTypesList) { if (!String.IsNullOrEmpty(item.SelectedOrganisationCode)) { selectedOrganisation = item.OrganisationList.Single(x => x.Code == Guid.Parse(item.SelectedOrganisationCode)); path.Add(selectedOrganisation.Name); } } if (selectedOrganisation != null) { SessionManager.OrganisationCode = selectedOrganisation.Code.ToString(); SessionManager.ApplicationCode = model.SelectedApplicationCode.ToString(); return(RedirectToAction("Edit")); //Redirect to OrganisationEditScreen using path } return(View(model)); }
public void EditEntity(int EntityID, string EntityName, string EntityCode, string ManagerName, string Email, string Mobile, string Landline, string Address) { OrganisationModel OrgObj = new OrganisationModel(); SqlParameter[] SParam = new SqlParameter[8]; SParam[0] = new SqlParameter("@EntityID", SqlDbType.Int); SParam[0].Value = EntityID; SParam[1] = new SqlParameter("@EntityName", SqlDbType.VarChar); SParam[1].Value = EntityName; SParam[2] = new SqlParameter("@EntityCode", SqlDbType.VarChar); SParam[2].Value = EntityCode; SParam[3] = new SqlParameter("@ManagerName", SqlDbType.VarChar); SParam[3].Value = ManagerName; SParam[4] = new SqlParameter("@Email", SqlDbType.VarChar); SParam[4].Value = Email; SParam[5] = new SqlParameter("@Mobile", SqlDbType.VarChar); SParam[5].Value = Mobile; SParam[6] = new SqlParameter("@Landline", SqlDbType.VarChar); SParam[6].Value = Landline; SParam[7] = new SqlParameter("@Address", SqlDbType.Text); SParam[7].Value = Address; try { OrgObj.EditEntity(SParam); } catch (Exception ex) { } }
public void AddEntityUser(int EntityID, string UserName, string Password, string FullName, string EmailID, string Mobile, int RoleID) { OrganisationModel OrgObj = new OrganisationModel(); SqlParameter[] SParam = new SqlParameter[8]; SParam[0] = new SqlParameter("@UserID", SqlDbType.Int); SParam[0].Value = Convert.ToInt32(Session["USER_ID"]); SParam[1] = new SqlParameter("@UserName", SqlDbType.VarChar); SParam[1].Value = UserName; SParam[2] = new SqlParameter("@Password", SqlDbType.VarChar); SParam[2].Value = EDHelper.EncryptTripleDES(Password); SParam[3] = new SqlParameter("@FullName", SqlDbType.VarChar); SParam[3].Value = FullName; SParam[4] = new SqlParameter("@EmailID", SqlDbType.VarChar); SParam[4].Value = EmailID; SParam[5] = new SqlParameter("@Mobile", SqlDbType.VarChar); SParam[5].Value = Mobile; SParam[6] = new SqlParameter("@RoleID", SqlDbType.VarChar); SParam[6].Value = RoleID; SParam[7] = new SqlParameter("@EntityID", SqlDbType.VarChar); SParam[7].Value = EntityID; try { OrgObj.AddEntityUser(SParam); } catch (Exception ex) { } }
public void SetUpOrganisationTests() { var databaseConnection = new SqlConnection(_databaseService.WebConfiguration.SqlConnectionString); var unitOfWork = new UnitOfWork(databaseConnection); _repository = new RegisterRepository(unitOfWork, new Mock <ILogger <RegisterRepository> >().Object); _validationRepository = new RegisterValidationRepository(unitOfWork); _organisationIdCreated = "EPA0987"; _ukprnCreated = 123321; _org2IdCreated = "EPA0001"; _organisationTypeId = 5; OrganisationTypeHandler.InsertRecord(new OrganisationTypeModel { Id = _organisationTypeId, Status = "new", Type = "organisation type 1" }); _id = Guid.NewGuid(); _organisation = new OrganisationModel { Id = _id, CreatedAt = DateTime.Now, EndPointAssessorName = "name 2", EndPointAssessorOrganisationId = _organisationIdCreated, EndPointAssessorUkprn = _ukprnCreated, PrimaryContact = null, OrganisationTypeId = _organisationTypeId, OrganisationData = null, Status = OrganisationStatus.New }; _organisation2 = new OrganisationModel { Id = Guid.NewGuid(), CreatedAt = DateTime.Now, EndPointAssessorName = "name 1", EndPointAssessorOrganisationId = _org2IdCreated, OrganisationTypeId = null, Status = OrganisationStatus.New }; _username = "******"; OrganisationHandler.InsertRecord(_organisation); OrganisationHandler.InsertRecord(_organisation2); _contactId = Guid.NewGuid(); _contact = new EpaContact { Id = _contactId, EndPointAssessorOrganisationId = _organisationIdCreated, Username = _username, DisplayName = "Joe Cool", Email = "*****@*****.**", PhoneNumber = "555 55555", Status = OrganisationStatus.New, SigninType = "", FirstName = "zzz", LastName = "Ftagn" }; }
public GameModel() { dbHelper = DBHelper.Instance; organisationModel = new OrganisationModel(); publisherModel = new PublisherModel(); ; }
public void setup_organisation_is_added() { _organisationStatusId1 = 1; _providerTypeId1 = 10; _organisationTypeId1 = 100; _organisationUkprn = 11114433; _legalName = "Legal name 1"; _organisationId = Guid.NewGuid(); _repository = new OrganisationRepository(_databaseService.WebConfiguration); _status1 = new OrganisationStatusModel { Id = _organisationStatusId1, Status = "Live", CreatedAt = DateTime.Now, CreatedBy = "TestSystem" }; OrganisationStatusHandler.InsertRecord(_status1); _providerType1 = new ProviderTypeModel { Id = _providerTypeId1, ProviderType = "provider type 10", Description = "provider type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live" }; ProviderTypeHandler.InsertRecord(_providerType1); _organisationTypeModel1 = new OrganisationTypeModel { Id = _organisationTypeId1, Type = "organisation type 10", Description = "organisation type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live" }; OrganisationTypeHandler.InsertRecord(_organisationTypeModel1); _organisation = new OrganisationModel { UKPRN = _organisationUkprn, OrganisationTypeId = _organisationTypeId1, ProviderTypeId = _providerTypeId1, StatusId = _organisationStatusId1, StatusDate = DateTime.Today.AddDays(5), LegalName = _legalName, Id = _organisationId, CreatedAt = DateTime.Now, CreatedBy = "Test" }; OrganisationHandler.InsertRecord(_organisation); }
public void EditUser(string UserName, string Password, string FullName, string EmailID, string Mobile, int RoleID, int UserID) { OrganisationModel OrgObj = new OrganisationModel(); SqlParameter[] SParam = new SqlParameter[7]; SParam[0] = new SqlParameter("@UserID", SqlDbType.Int); SParam[0].Value = UserID; SParam[1] = new SqlParameter("@UserName", SqlDbType.VarChar); SParam[1].Value = UserName; SParam[2] = new SqlParameter("@Password", SqlDbType.VarChar); SParam[2].Value = EDHelper.EncryptTripleDES(Password); SParam[3] = new SqlParameter("@FullName", SqlDbType.VarChar); SParam[3].Value = FullName; SParam[4] = new SqlParameter("@EmailID", SqlDbType.VarChar); SParam[4].Value = EmailID; SParam[5] = new SqlParameter("@Mobile", SqlDbType.VarChar); SParam[5].Value = Mobile; SParam[6] = new SqlParameter("@RoleID", SqlDbType.Int); SParam[6].Value = RoleID; try { OrgObj.EditUser(SParam); } catch (Exception ex) { } }
public void Update(Organisation organisation, OrganisationModel organisationModel) { organisation.Name = organisationModel.Name; organisation.Description = organisationModel.Description; organisation.FaxNumber = organisationModel.FaxNumber; organisation.ContactNumber = organisationModel.ContactNumber; organisation.EmailAddress = organisationModel.EmailAddress; organisation.LogoFilename = organisationModel.LogoFileName; if (organisation.PostalAddressId == null) { organisation.PostalAddress = addressBuilder.Build(organisationModel.PostalAddress); } else { addressAdapter.Update(organisation.PostalAddress, organisationModel.PostalAddress); } if (organisation.PhysicalAddress == null) { organisation.PhysicalAddress = addressBuilder.Build(organisationModel.PhysicalAddress); } else { addressAdapter.Update(organisation.PhysicalAddress, organisationModel.PhysicalAddress); } }
/// <summary> /// Gets data from open API edr.data-gov-ua.org/api /// </summary> /// <param name="edrpou">Input EDRPOU code to get info about</param> /// <returns>String with basic info like: FullName, Occupation and Status.</returns> private static OrganisationModel EdrpouDetailParser(OrganisationModel organisationModel) { var edrpou = organisationModel.EdrpouCode; using (WebClient client = new WebClient()) { client.Encoding = Encoding.UTF8; string linkEdrpou = "http://edr.data-gov-ua.org/api/companies?where={\"edrpou\":{\"contains\":\"" + edrpou + "\"}}"; string pageEdrpou = client.DownloadString(linkEdrpou); Regex regexOrgInfo = new Regex( @"officialName"":(?<ofName>.+)"",""address"" | address"":(?<address>.+)"",""mainPerson"" | mainPerson"":(?<mainPerson>.+)"",""occupation"" | occupation"":(?<occupation>.+)"",""status"" | status"":(?<status>.+)"",""id"" "); Match matchInfo = regexOrgInfo.Match(pageEdrpou); organisationModel.OfficialName = matchInfo.Groups["ofName"].Value.ToString(); organisationModel.Address = matchInfo.Groups["address"].Value.ToString(); organisationModel.MainPerson = matchInfo.Groups["mainPerson"].Value.ToString(); organisationModel.Occupation = matchInfo.Groups["occupation"].Value.ToString(); organisationModel.Status = matchInfo.Groups["status"].Value.ToString(); } return(organisationModel); }
public IActionResult FetchOrganisation(long organisationId) { OrganisationModel organisationModel = ogranisationService.Find(organisationId); ogranisationService.MapRelativeLogoPath(organisationModel, configuration, HttpContext.Request.CurrentUrl()); return(Ok(organisationModel)); }
public void DeleteOrganisation(OrganisationModel organisation) { if (organisation == null) { throw new ArgumentNullException(nameof(organisation)); } _context.Organisations.Remove(organisation); }
public void Set_up_and_run_update() { _organisationStatusId1 = 1; _organisationStatusId0 = 0; _providerTypeId1 = 10; _organisationTypeId1 = 100; _organisationUkprn = 11114433; _legalName = "Legal name 1"; _organisationId = Guid.NewGuid(); _updateOrganisationRepository = new UpdateOrganisationRepository(_databaseService.DbConnectionHelper); _repository = new OrganisationRepository(_databaseService.DbConnectionHelper); _status1 = new OrganisationStatusModel { Id = _organisationStatusId1, Status = "Live", CreatedAt = DateTime.Now, CreatedBy = "TestSystem" }; OrganisationStatusHandler.InsertRecord(_status1); _status2 = new OrganisationStatusModel { Id = _organisationStatusId0, Status = "Live", CreatedAt = DateTime.Now, CreatedBy = "TestSystem" }; OrganisationStatusHandler.InsertRecord(_status2); _reason1 = new RemovedReasonModel { Id = 1, CreatedBy = "System", Reason = "Test reason", Status = "Live" }; RemovedReasonHandler.InsertRecord(_reason1); _reason2 = new RemovedReasonModel { Id = 2, CreatedBy = "System", Reason = "Test reason 2", Status = "Live" }; RemovedReasonHandler.InsertRecord(_reason2); _providerType1 = new ProviderTypeModel { Id = _providerTypeId1, ProviderType = "provider type 10", Description = "provider type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live" }; ProviderTypeHandler.InsertRecord(_providerType1); _organisationTypeModel1 = new OrganisationTypeModel { Id = _organisationTypeId1, Type = "organisation type 10", Description = "organisation type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live" }; OrganisationTypeHandler.InsertRecord(_organisationTypeModel1); var json = "{ \"CompanyNumber\":\"12345678\",\"CharityNumber\":\"1234567\",\"ParentCompanyGuarantee\":false,\"FinancialTrackRecord\":true,\"NonLevyContract\":false,\"StartDate\":\"2019-03-27 00:00:00\",\"RemovedReason\":{\"Id\":1,\"Reason\":\"Test reason\",\"Description\":null,\"CreatedBy\":\"System\",\"CreatedAt\":\"2019-02-11 15:47:23\",\"UpdatedBy\":null,\"UpdatedAt\":null,\"Status\":\"Live\"}}"; _organisation = new OrganisationModel { UKPRN = _organisationUkprn, OrganisationTypeId = _organisationTypeId1, ProviderTypeId = _providerTypeId1, StatusId = _organisationStatusId1, StatusDate = DateTime.Today.AddDays(5), LegalName = _legalName, Id = _organisationId, CreatedAt = DateTime.Now, CreatedBy = "Test", OrganisationData = json }; OrganisationHandler.InsertRecord(_organisation); _changedBy = "SystemChange"; var _updatedReason = _updateOrganisationRepository.UpdateStatusWithRemovedReason(_organisationId, _organisationStatusId0, _reason2.Id, _changedBy).Result; _successfulUpdate = (_updatedReason != null); _newOrganisationStatusId = _repository.GetOrganisationStatus(_organisationId).Result; }
public void MapRelativeLogoPath(OrganisationModel organisationModel, IConfiguration configuration, string currentUrl) { if (string.IsNullOrEmpty(organisationModel.LogoFileName)) { return; } organisationModel.LogoFileNamePath = FileHandler.GetRelativeFileName(new Uri(currentUrl + configuration.OrganisationPreviewDirectory()).AbsoluteUri, organisationModel.LogoFileName); }
public OrganisationModel Add(OrganisationModel organisationModel) { var organisation = organisationBuilder.Build(organisationModel); unitOfWork.Organisation.Insert(organisation); unitOfWork.Save(); return(organisationBuilder.BuildModel(unitOfWork.Organisation.GetById(o => o.Id == organisation.Id, "PhysicalAddress, PostalAddress"))); }
public static void InsertRecord(OrganisationModel organisation) { var sql = "INSERT INTO [Organisations] ([Id] ,[CreatedAt],[DeletedAt],[EndPointAssessorName],[EndPointAssessorOrganisationId], " + "[EndPointAssessorUkprn],[PrimaryContact],[Status],[UpdatedAt],[OrganisationTypeId],[OrganisationData]) VALUES " + $@"(@id,@createdAt, @deletedAt, @endPointAssessorName, @endPointAssessorOrganisationId, @endPointAssessorUkprn, @primaryContact, @status, @updatedAt, @organisationTypeId, @organisationData); "; DatabaseService.Execute(sql, organisation); }
public static OrganisationViewModel ToViewModel(this OrganisationModel model) { return(new OrganisationViewModel { Id = model.Id, OrganisationName = model.OrganisationName, Address = model.Address }); }
private static OrganisationModel EdrpouDetailParser2(OrganisationModel organisationModel) { var edrpou = organisationModel.EdrpouCode; string linkEdrpou = "http://edr.data-gov-ua.org/api/companies?where={\"edrpou\":{\"contains\":\"" + edrpou + "\"}}"; var parser = new HtmlParser(); var doc = parser.ParseDocument(linkEdrpou); return(organisationModel); }
public static List <OrganisationModel> GetAvailableOrganisations(this ClaimsPrincipal user) { var organisationClaims = user.Claims.Where(c => c.Type == InssClaimTypes.Organisation).ToList(); return(organisationClaims .Select(claim => OrganisationClaimType.FromClaim(claim)) .Select(claimType => OrganisationModel.FromClaimType(claimType)) .ToList()); }
public static void InsertRecord(OrganisationModel organisation) { var sql = @"INSERT INTO [Organisations] ([Id] ,[CreatedAt],[CreatedBy],[UpdatedAt],[UpdatedBy],[StatusId],[ProviderTypeId],[OrganisationTypeId], [UKPRN],[LegalName],[TradingName],[StatusDate],[OrganisationData]) VALUES " + $@"(@id,@createdAt, @createdBy, @updatedAt, @updatedBy, @statusId, @providerTypeId, @organisationTypeId, @ukprn, @legalName, @tradingName,@statusDate, @organisationData); "; DatabaseService.Execute(sql, organisation); }
public IHttpActionResult Put(OrganisationModel org) { Organization dbOrg = uow.OrganizationRepository.GetById(org.Id); org.CopyToEntity(dbOrg); uow.OrganizationRepository.PromoteOrDemote(dbOrg); uow.OrganizationRepository.Save(dbOrg); return(Ok(dbOrg)); }
public void CanSerialise_OrganisationModel_ToJson_AndBack() { // arrange OrganisationModel model = _factory.CreateOrganisation(); // act var json = model.SerializeToJson <OrganisationModel>(); var model2 = json.DeSerializeFromJson <OrganisationModel>(); // assert model2.Should().BeEquivalentTo(model); }
public IHttpActionResult GetOrganisation(int orgId) { try { using (MaxMasterDbEntities db = new MaxMasterDbEntities()) { var org = db.Organisations.Find(orgId); OrganisationModel organisation = new OrganisationModel(); organisation.Id = org.Id; organisation.OrgName = org.OrgName; organisation.Email = org.Email; organisation.PrimaryPhone = org.PrimaryPhone; organisation.Website = org.WebSite; organisation.SecondaryPhone = org.SecondaryPhone; organisation.PAN = org.PAN; organisation.TIN = org.TIN; organisation.GST = org.GST; organisation.EmpPrefix = org.EmpPrefix; organisation.OrgLogo = org.Logo; organisation.OrgLocation = new List <OrganisationLocation>(); var OrgLocations = db.OrgansationLocations.Where(x => x.OrgId == orgId).ToList(); for (int i = 0; i < OrgLocations.Count(); i++) { OrganisationLocation orgLoc = new OrganisationLocation(); orgLoc.LocId = OrgLocations[i].Id; orgLoc.AddressLine1 = OrgLocations[i].AddressLine1; orgLoc.AddressLine2 = OrgLocations[i].AddressLine2; orgLoc.City = OrgLocations[i].CityId; orgLoc.CityName = OrgLocations[i].City.Name; orgLoc.State = OrgLocations[i].StateId; orgLoc.StateName = OrgLocations[i].City.State.Name; orgLoc.Country = OrgLocations[i].CountryId; orgLoc.CountryName = OrgLocations[i].City.State.Country.Name; orgLoc.ZIP = OrgLocations[i].ZIP; organisation.OrgLocation.Add(orgLoc); } return(Content(HttpStatusCode.OK, new { organisation })); } } catch (Exception ex) { new Error().logAPIError(System.Reflection.MethodBase.GetCurrentMethod().Name, ex.ToString(), ex.StackTrace); return(Content(HttpStatusCode.InternalServerError, "An error occured, please try again later")); } }
public IActionResult UpdateOrganisation([FromBody] OrganisationModel organisationModel) { if (!ModelState.IsValid) { return(new ValidationActionResult(ModelState)); } OrganisationModel model = ogranisationService.Update(organisationModel); ImageFixing(model, organisationModel.LogoFileNamePath); return(Ok(model)); }
public void Set_up_and_run_update() { _organisationStatusId1 = 1; _providerTypeId1 = 10; _providerTypeId2 = 20; _organisationTypeId1 = 100; _organisationTypeId2 = 111; _organisationUkprn = 11114433; _legalName = "Legal name 1"; _organisationId = Guid.NewGuid(); _updateOrganisationRepository = new UpdateOrganisationRepository(_databaseService.DbConnectionHelper); _repository = new OrganisationRepository(_databaseService.DbConnectionHelper); _status1 = new OrganisationStatusModel { Id = _organisationStatusId1, Status = "Live", CreatedAt = DateTime.Now, CreatedBy = "TestSystem" }; OrganisationStatusHandler.InsertRecord(_status1); _providerType1 = new ProviderTypeModel { Id = _providerTypeId1, ProviderType = "provider type 10", Description = "provider type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live" }; ProviderTypeHandler.InsertRecord(_providerType1); _providerType2 = new ProviderTypeModel { Id = _providerTypeId2, ProviderType = "provider type 12", Description = "provider type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live" }; ProviderTypeHandler.InsertRecord(_providerType2); _organisationTypeModel1 = new OrganisationTypeModel { Id = _organisationTypeId1, Type = "organisation type 10", Description = "organisation type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live" }; OrganisationTypeHandler.InsertRecord(_organisationTypeModel1); _organisationTypeModel2 = new OrganisationTypeModel { Id = _organisationTypeId2, Type = "organisation type 22", Description = "organisation type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live" }; OrganisationTypeHandler.InsertRecord(_organisationTypeModel2); _organisation = new OrganisationModel { UKPRN = _organisationUkprn, OrganisationTypeId = _organisationTypeId1, ProviderTypeId = _providerTypeId1, StatusId = _organisationStatusId1, StatusDate = DateTime.Today.AddDays(5), LegalName = _legalName, Id = _organisationId, CreatedAt = DateTime.Now, CreatedBy = "Test" }; OrganisationHandler.InsertRecord(_organisation); _changedBy = "SystemChange"; _successfulUpdate = _updateOrganisationRepository.UpdateProviderTypeAndOrganisationType(_organisationId, _providerTypeId2, _organisationTypeId2, _changedBy).Result; _newProviderType = _repository.GetProviderType(_organisationId).Result; _newOrganisationType = _repository.GetOrganisationType(_organisationId).Result; }
private void ImageFixing(OrganisationModel organisationModel, string logoFileNamePath) { if (organisationModel == null || string.IsNullOrEmpty(logoFileNamePath)) { return; } if (logoFileNamePath.Contains(configuration.OrganisationNormalTempDirectory())) { ogranisationService.ResizeLogos(organisationModel, configuration, environment.WebRootPath, HttpContext.Request.CurrentUrl()); } ogranisationService.MapRelativeLogoPath(organisationModel, configuration, HttpContext.Request.CurrentUrl()); }
/// <summary> /// Gives OrganisationModel info /// </summary> /// <param name="edrpou"></param> /// <returns></returns> public static OrganisationModel Parser(OrganisationModel organisationModel, string edrpou) { if (edrpou.Length == 8) { return(EdrpouDetailParser(organisationModel)); } else if (edrpou.Length == 10) { return(FopDataParser(organisationModel)); } else { return(null); } }
public OrganisationModel Update(OrganisationModel organisationModel) { var organisation = unitOfWork.Organisation.GetById(o => o.Id == organisationModel.Id.Value, "PhysicalAddress, PostalAddress"); if (organisation == null) { throw new ResponseValidationException(ResponseMessage.ToError("Organisation you trying to update does not exist.")); } organisationAdapter.Update(organisation, organisationModel); unitOfWork.Organisation.Update(organisation); unitOfWork.Save(); return(organisationBuilder.BuildModel(unitOfWork.Organisation.GetById(o => o.Id == organisation.Id, "PhysicalAddress, PostalAddress"))); }
public IHttpActionResult Post(OrganisationModel org) { try { Organization dbOrg = new Organization(); org.CopyToEntity(dbOrg); OrganisationModel newOrg = new OrganisationModel(dbOrg); uow.OrganizationRepository.Save(dbOrg); return(Ok(newOrg)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }