public CompanyInformationModel GetCompanyInformationModel() { //if (getcompanyInformationModel==null) //{ var companyInformationModel = new CompanyInformationModel(); var pr = new PropertyReflector(); var dict = companyInformationModel.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly) .ToDictionary(prop => prop.Name, prop => prop?.GetValue(companyInformationModel, null)?.ToString() ?? ""); var keyValues = _keyValues.Where(x => dict.Keys.Contains(x.Key)).ToList(); if (keyValues.Any()) { //keyValues.ForEach(x => x.Value = dict[x.Key]); foreach (var keyValue in keyValues) { pr.SetValue(companyInformationModel, keyValue.Key, keyValue.Value); } } getcompanyInformationModel = companyInformationModel; return(companyInformationModel); //} //else //{ // return getcompanyInformationModel; //} }
public static CompanyInformationModel ToModel(this CompanyInformation entity, int languageId) { if (entity == null) { throw new ArgumentNullException("company"); } var model = new CompanyInformationModel() { CompanyName = entity.CompanyName, CompanyDescription = entity.CompanyDescription, AccountNumbers = entity.AccountNumbers, BankAddress = entity.BankAddress, BankName = entity.BankName, LegalAddress = entity.LegalAddress, SWIFT = entity.SWIFT, TaxRegistrationNumber = entity.TaxRegistrationNumber, TopExecutiveName = entity.TopExecutiveName, SeName = entity.GetSeName(languageId, returnDefaultValue: true), }; var customer = entity.Customers.FirstOrDefault(); model.CustomerId = customer.Id; if (customer.IsSeller()) { model.Seller = true; } return(model); }
public GOSICertificateInquiryResponseModel GetGOSICertificateInquiryResponseModel() { List <CompanyInformationModel> companyInformationModels = new List <CompanyInformationModel>(); CompanyInformationModel company = new CompanyInformationModel() { BusinessNameAr = "nameAr", BusinessNameEn = "nameen", GOSIRegistrationId = "1" }; companyInformationModels.Add(company); return(new GOSICertificateInquiryResponseModel() { CompanyInformationList = companyInformationModels }); }
public void SubmitChanges(CompanyInformationDTO companyInformationDTO) { if (_controller == null) { if (_model == null) { _model = new CompanyInformationModel(); } _controller = new CompanyInformationController(this, _model); _model.NotifySuccessfulOperation += new NotifySuccessfulOperationEventHandler(NotifySuccess); } _controller.CompanyInformation = companyInformationDTO; }
public bool SaveCompanyInformationModel(CompanyInformationModel companyInformationModel) { var dict = companyInformationModel.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly) .ToDictionary(prop => prop.Name, prop => prop?.GetValue(companyInformationModel, null)?.ToString() ?? ""); var keyValues = _keyValues.Where(x => dict.Keys.Contains(x.Key)).ToList(); if (keyValues.Any()) { keyValues.ForEach(x => x.Value = dict[x.Key]); } else { foreach (var item in dict) { _keyValues.Add(new KeyValue { Key = item.Key, Value = item.Value }); } //_uow.SaveChanges(); } return(_uow.SaveChanges() != 0); }
public void LoadData() { _model = new CompanyInformationModel(); _controller = new CompanyInformationController(this, _model); }
public static CompanyInformation ToEntity(this CompanyInformationModel model, CompanyInformation destination) { return(Mapper.Map(model, destination)); }
public static CompanyInformation ToEntity(this CompanyInformationModel model) { return(Mapper.Map <CompanyInformationModel, CompanyInformation>(model)); }
protected bool CheckCompanyLocale(CompanyInformationModel model) { return(model.CompanyDescription != null && model.CompanyName != null); }
public ActionResult Index(CompanyInformationPage currentPage, CompanyInformationModel companyInformation) { if (string.IsNullOrEmpty(SiteUser?.SerialNumber)) { return(HttpNotFound()); } if (!ModelState.IsValid) { Response.StatusCode = 400; ViewBag.Message = "Some fields have invalid value. Please try again!"; return(View("~/Views/Organization/CompanyInformation.cshtml", new CompanyInformationViewModel(currentPage) { CompanyInformation = companyInformation, IsLoginBankId = !string.IsNullOrEmpty(SiteUser.SerialNumber) })); } var organization = UserManager.GetActiveCustomer(HttpContext); if (organization != null) { var result = _organizationRepository.UpdateCompanyInformation(new OrganisationInformation { OrganisationId = organization.CustomerId, Address = companyInformation.Address, City = companyInformation.City, Zip = companyInformation.ZipCode, OrganisationName = companyInformation.CompanyName, Email = companyInformation.Email, PhoneMobile = companyInformation.PhoneMobile, PhoneWork = companyInformation.PhoneWork, Comment = companyInformation.Comment }); if (result) { var startPage = _contentRepo.Get <StartPage>(ContentReference.StartPage); if (startPage != null) { if (!PageReference.IsNullOrEmpty(startPage.SettingsPage)) { var settingPage = _contentRepo.Get <SettingsPage>(startPage.SettingsPage); if (settingPage != null) { TempData["UpdateCompanyInformationSuccess"] = true; return(RedirectToAction("Index", new { node = settingPage.MyAccountLink })); } } } } } var viewModel = new CompanyInformationViewModel(currentPage) { CompanyInformation = companyInformation, IsLoginBankId = !string.IsNullOrEmpty(SiteUser.SerialNumber) }; ViewBag.Message = "Update company information is not successful. Please try again!"; return(View("~/Views/Organization/CompanyInformation.cshtml", viewModel)); }