Пример #1
0
        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;
            //}
        }
Пример #2
0
        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);
        }
Пример #3
0
        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
            });
        }
Пример #4
0
        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;
        }
Пример #5
0
        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);
        }
Пример #6
0
 public void LoadData()
 {
     _model      = new CompanyInformationModel();
     _controller = new CompanyInformationController(this, _model);
 }
Пример #7
0
 public static CompanyInformation ToEntity(this CompanyInformationModel model, CompanyInformation destination)
 {
     return(Mapper.Map(model, destination));
 }
Пример #8
0
 public static CompanyInformation ToEntity(this CompanyInformationModel model)
 {
     return(Mapper.Map <CompanyInformationModel, CompanyInformation>(model));
 }
Пример #9
0
 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));
        }