Ejemplo n.º 1
0
        public ActionResult EditDetails(string id)
        {
            ViewBag.BranchDetails      = new BranchMasterEntity();
            ViewBag.CountryList        = CountryHelper.GetCountryData();
            ViewBag.StateByCountryList = StateByCountryHelper.GetStateByCountryData("0");
            List <BranchMasterEntity> _branchEntity = BranchHelper.GetBranchData(id);

            return(View("Index", _branchEntity.FirstOrDefault()));
        }
Ejemplo n.º 2
0
        public string GetRegionInfo(string nativeName)
        {
            var helper = new CountryHelper();
            var data   = helper.GetCountryData();


            var region = data.Where(country => country.CountryName == nativeName)
                         .Select(r => r.CountryShortCode).FirstOrDefault();

            Console.WriteLine("Region :" + region);
            return(region);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Converts a boolean type object from the CSV's text string
        /// </summary>
        /// <param name="text">The text to convert</param>
        /// <param name="row">The row the data is on</param>
        /// <param name="memberMapData">A Helper object given by CsvHelper</param>
        /// <returns>The boolean value that corresponds to the string</returns>
        public override object?ConvertFromString(string text, IReaderRow row, MemberMapData memberMapData)
        {
            foreach (var country in CountryHelper.GetCountryData())
            {
                if (text.ToLower() == country.CountryName.ToLower() || text.ToLower() == country.CountryShortCode.ToLower())
                {
                    return(country.CountryName);
                }
            }

            return(null);
        }
Ejemplo n.º 4
0
        // GET: Company

        public ActionResult Index()
        {
            CompanyEntity _companyEntity = new CompanyEntity();

            ViewBag.companyDetails = _companyEntity;

            ViewBag.CountryList = CountryHelper.GetCountryData();

            ViewBag.StateByCountryList = StateByCountryHelper.GetStateByCountryData("0");

            return(View());
        }
Ejemplo n.º 5
0
        // GET: Branch

        public ActionResult Index()
        {
            //BranchMasterEntity _BranchMasterEntity = new BranchMasterEntity();
            //return View(_BranchMasterEntity);

            BranchMasterEntity _BranchMasterEntity = new BranchMasterEntity();

            ViewBag.BranchDetails = _BranchMasterEntity;

            ViewBag.CountryList = CountryHelper.GetCountryData();

            ViewBag.StateByCountryList = StateByCountryHelper.GetStateByCountryData("0");

            return(View());
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Transfers what could be a full name, abbreviation, or alternate abbreviation to a full region name
        /// </summary>
        /// <param name="text">The input string</param>
        /// <returns>The name of the region specified (null if not possible)</returns>
        public static string?NameOrAbbreviationToString(string text)
        {
            foreach (var country in CountryHelper.GetCountryData())
            {
                foreach (var region in country.Regions)
                {
                    if (text.ToLower() == region.Name.ToLower() || text.ToLower() == region.ShortCode.ToLower())
                    {
                        return(region.Name);
                    }
                }
            }

            return(null);
        }
Ejemplo n.º 7
0
        public ActionResult Save(CompanyEntity companyEntity)
        {
            string FileName      = "";
            string FileExtension = "";
            string UploadPath    = "";

            if (companyEntity.ImageFile != null)
            {
                //Use Namespace called :  System.IO
                FileName = Path.GetFileNameWithoutExtension(companyEntity.ImageFile.FileName);

                //To Get File Extension
                FileExtension = Path.GetExtension(companyEntity.ImageFile.FileName);

                //Add Current Date To Attached File Name
                FileName = DateTime.Now.ToString("MM-dd-yyyy-HH-mm-ss") + "-" + FileName.Trim() + FileExtension;

                //Get Upload path from Web.Config file AppSettings.
                //string UploadPath = ConfigurationManager.AppSettings["UserImagePath"].ToString();
                UploadPath = Server.MapPath("~/CompanyLogo/");

                //Its Create complete path to store in server.
                companyEntity.LogoPath = UploadPath + FileName;

                //To copy and save file into server.
                companyEntity.ImageFile.SaveAs(companyEntity.LogoPath);
            }



            ViewBag.CountryList        = CountryHelper.GetCountryData();
            ViewBag.StateByCountryList = StateByCountryHelper.GetStateByCountryData("0");

            bool saveStatus;

            companyEntity.IsActive    = true;
            companyEntity.CreatedDate = DateTime.Now;
            companyEntity.CreatedBy   = 1;
            companyEntity.is_default  = 1;
            companyEntity.ImageFile   = null;                        //TO UPDATE MODEL SO THAT IT CAN BE SEND AS STRING TO API//
            companyEntity.LogoPath    = "~/CompanyLogo/" + FileName; //TO RESET THE FULL PATH ONLY TO FOLDER AND IMAGE NAME//

            companyEntity      = CompanyHelper.SaveCompanyData(companyEntity, out saveStatus);
            ViewBag.SaveStatus = saveStatus;
            return(View("Index", companyEntity));
        }
        /// <inheritdoc/>
        public new void Validate()
        {
            // Validate base
            base.Validate();

            // User must have a name
            this.FirstName = Ensure.IsNotNullOrWhitespace(() => this.FirstName);

            // Country & state validation
            if (this.Region != null)
            {
                // Country cannot be null if Region is
                Ensure.IsNotNull(() => this.Country);

                var country = CountryHelper.GetCountryData()
                              .Where(country => country.CountryName == this.Country)
                              .Single();

                Ensure.AreEqual(
                    () => 1,
                    country.Regions.Where(region => region.Name == this.Region).Count);
            }
        }
Ejemplo n.º 9
0
        public ActionResult EditDetails(BranchMasterEntity branchEntity)
        {
            ViewBag.BranchDetails = new BranchMasterEntity();

            ViewBag.CountryList        = CountryHelper.GetCountryData();
            ViewBag.StateByCountryList = StateByCountryHelper.GetStateByCountryData("0");

            if (ModelState.IsValid)
            {
                //Use Namespace called :  System.IO
                //string FileName = Path.GetFileNameWithoutExtension(branchEntity.ImageFile.FileName);

                ////To Get File Extension
                //string FileExtension = Path.GetExtension(branchEntity.ImageFile.FileName);

                ////Add Current Date To Attached File Name
                //FileName = DateTime.Now.ToString("yyyyMMdd") + "-" + FileName.Trim() + FileExtension;

                ////Get Upload path from Web.Config file AppSettings.
                ////string UploadPath = ConfigurationManager.AppSettings["UserImagePath"].ToString();

                ////Its Create complete path to store in server.
                //branchEntity.ImagePath = Path.Combine(Server.MapPath("~/Content/BranchLogo"),
                //                           Path.GetFileName(FileName)); // UploadPath + FileName;

                ////To copy and save file into server.
                //branchEntity.ImageFile.SaveAs(branchEntity.ImagePath);


                bool saveStatus = false;
                saveStatus         = BranchHelper.EditBranchData(branchEntity, saveStatus);
                ViewBag.SaveStatus = saveStatus;
            }

            return(View(branchEntity));
        }