Exemplo n.º 1
0
        /// <summary>
        /// Creates the company registration view.
        /// </summary>
        /// <param name="companyCollection">The company collection.</param>
        /// <param name="industryCollection"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">
        /// companyCollection
        /// or
        /// industryCollection
        /// </exception>
        public ICompanyRegistrationView CreateCompanyRegistrationView(IList <ICompanyDetail> companyCollection, IList <IIndustry> industryCollection, IList <ICountry> countryCollection)
        {
            if (companyCollection == null)
            {
                throw new ArgumentNullException(nameof(companyCollection));
            }

            if (industryCollection == null)
            {
                throw new ArgumentNullException(nameof(industryCollection));
            }

            if (countryCollection == null)
            {
                throw new ArgumentNullException(nameof(countryCollection));
            }

            // get parentcompany  drop down list
            var parentCompanytDDL = GetDropDownList.CompanyListItems(companyCollection, -1);

            var industryDDl = GetDropDownList.IIndsutryListItems(industryCollection, -1);

            var countryDDL = GetDropDownList.CountryListItem(countryCollection, 161);

            var model = new CompanyRegistrationView()
            {
                IndustryDropDownList      = industryDDl,
                ParentCompanyDropDownList = parentCompanytDDL,
                CountryDropDownList       = countryDDL,
                CompanyCountryId          = 161
            };

            return(model);
        }
Exemplo n.º 2
0
        public ActionResult EditCompany(CompanyRegistrationView companyInfo, HttpPostedFileBase compLogo)
        {
            if (companyInfo == null)
            {
                throw new ArgumentNullException(nameof(companyInfo));
            }

            if (!ModelState.IsValid)
            {
                // call service to update the view
                var viewModel = this.adminService.GetRegisterCompanyViewModel(companyInfo, string.Empty);

                // return view
                return(this.View("EditCompany", viewModel));
            }

            //Update Company Information
            var processingMessage = this.adminService.UpdateCompanyRegistrationInfo(companyInfo, compLogo);

            if (!string.IsNullOrEmpty(processingMessage))
            {
                // If Error, Call service to generate an updated view
                var viewModel = this.adminService.GetRegisterCompanyViewModel(companyInfo, processingMessage);

                // return the view
                return(this.View("EditCompany", viewModel));
            }


            //Successful Update
            var returnMessage = string.Format("{0} - Company Modified", companyInfo.CompanyName);

            //Redirect to company Lists
            return(this.RedirectToAction("CompanyList", new { message = returnMessage }));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates the company registration view.
        /// </summary>
        /// <param name="companyInfo">The company information.</param>
        /// <param name="companyCollection">The company collection.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">companyCollection</exception>
        public ICompanyRegistrationView CreateCompanyRegistrationView(ICompanyDetail companyInfo,
                                                                      IList <ICompanyDetail> companyCollection, IList <IIndustry> industryCollection, IList <ICountry> countryCollection)
        {
            if (companyCollection == null)
            {
                throw new ArgumentNullException(nameof(companyCollection));
            }

            if (industryCollection == null)
            {
                throw new ArgumentNullException(nameof(industryCollection));
            }

            // get parentcompany  drop down list
            var parentCompanytDDL =
                GetDropDownList.CompanyListItems(companyCollection, companyInfo.ParentCompanyId ?? -1);

            var industryDDL =
                GetDropDownList.IIndsutryListItems(industryCollection, companyInfo.IndustryId);

            var countryDDL =
                GetDropDownList.CountryListItem(countryCollection, 161);

            var model = new CompanyRegistrationView()
            {
                ParentCompanyDropDownList = parentCompanytDDL,
                CountryDropDownList       = countryDDL,
                ProcessingMessage         = string.Empty,
                CompanyCountry            = companyInfo.CompanyCountry,
                CACRegistrationNumber     = companyInfo.CACRegistrationNumber,
                CompanyAddressLine1       = companyInfo.CompanyAddressLine1,
                CompanyAddressLine2       = companyInfo.CompanyAddressLine2,
                CompanyCity          = companyInfo.CompanyCity,
                CompanyCountryId     = 161,
                CompanyEmail         = companyInfo.CompanyEmail,
                CompanyId            = companyInfo.CompanyId,
                CompanyName          = companyInfo.CompanyName,
                CompanyPhone         = companyInfo.CompanyPhone,
                CompanyState         = companyInfo.CompanyState,
                CompanyWebsite       = companyInfo.CompanyWebsite,
                CompanyZipCode       = companyInfo.CompanyZipCode,
                DateCreated          = companyInfo.DateCreated,
                ParentCompanyId      = companyInfo.ParentCompanyId,
                LogoDigitalFileId    = companyInfo.LogoDigitalFileId,
                CompanyAlias         = companyInfo.CompanyAlias,
                IsActive             = companyInfo.IsActive,
                IndustryDropDownList = industryDDL,
                IndustryId           = companyInfo.IndustryId,
                CompanyLogo          = companyInfo.CompanyLogo
            };

            return(model);
        }
Exemplo n.º 4
0
        public ActionResult DeleteCompany(CompanyRegistrationView companyInfo)
        {
            //Check that Grade Info is Not Null
            if (companyInfo == null)
            {
                throw new ArgumentNullException(nameof(companyInfo));
            }

            var returnModel = adminService.DeleteCompanyInfo(companyInfo);

            return(this.RedirectToAction("CompanyList", "Administration", new { companyId = companyInfo.CompanyId }));
        }
Exemplo n.º 5
0
        public ActionResult RegisterCompany(CompanyRegistrationView companyInfo, HttpPostedFileBase compLogo)
        {
            if (companyInfo == null)
            {
                throw new ArgumentNullException(nameof(companyInfo));
            }

            if (!ModelState.IsValid)
            {
                // call service to generate the View and return Back
                var viewModel = this.adminService.GetRegisterCompanyViewModel(companyInfo, string.Empty);

                // return view
                return(this.View("RegisterCompany", viewModel));
            }

            //Register New Company
            var processingMessage = this.adminService.ProcessCompanyRegistrationInfo(companyInfo, compLogo);

            //Check If there is a Message from the Service
            if (!string.IsNullOrEmpty(processingMessage))
            {
                // call service to update parentCompany drop down list
                var viewModel = this.adminService.GetRegisterCompanyViewModel(companyInfo, processingMessage);

                // return the view
                return(this.View("RegisterCompany", viewModel));
            }


            //New Company Successfully created
            var returnMessage = string.Format("{0} - Company Registered", companyInfo.CompanyName);

            //Redirect to company List
            return(this.RedirectToAction("CompanyList", new { message = returnMessage }));
        }