//private void GetCustomerCreditLimit()
        //{
        //    ICustomerRepository customerRepository = new CustomerRepository();
        //    this.CreditLimitDays = customerRepository.GetCatagoryType("CCLD").ToList();
        //    this.CreditLimitAmount = customerRepository.GetCatagoryType("CCLA").ToList();
        //    this.Discount = customerRepository.GetCatagoryType("CD").ToList();
        //    if (this.ID == -1)
        //    {
        //        var data = CreditLimitDays.Where(y => y.SetDefault == true).Select(x => x.ID).FirstOrDefault();
        //        if (data != null)
        //        {
        //            SelectedCreditLimitDays = Convert.ToInt32(data);
        //        }
        //        var data2 = CreditLimitAmount.Where(y => y.SetDefault == true).Select(x => x.ID).FirstOrDefault();
        //        if (data2 != null)
        //        {
        //            SelectedCreditLimitAmount = Convert.ToInt32(data2);
        //        }
        //        var data3 = Discount.Where(y => y.SetDefault == true).Select(x => x.ID).FirstOrDefault();
        //        if (data3 != null)
        //        {
        //            SelectedDiscount = Convert.ToInt32(data3);
        //        }
        //    }

        //}
        private void RefreshData()
        {
            ISupplierRepository supplierRepository = new SupplierRepository();

            this.TotalSupplier    = supplierRepository.GetAllSupplier().Count();
            this.InActiveSupplier = supplierRepository.GetSupplierCount("Y");
            this.ActiveSupplier   = TotalSupplier - InActiveSupplier;
            this.SearchSupplier   = supplierRepository.GetAllSupplier().ToList();
            this.IsAllowedToChangeCLA_and_Discount = supplierRepository.AllowedToChangeLimit();
            string   setdateFormat = this.DateFormat == null ? "{0:dd/MM/yyyy}" : "{0:" + this.DateFormat + "}";
            int      supId         = 0;
            DateTime?dtRefresh     = DateTime.UtcNow;

            if (SearchSupplier.Count > 0)
            {
                int SupplierSelectedId = 0;
                if (SharedValues.getValue != null)
                {
                    bool isValid = Int32.TryParse(SharedValues.getValue, out SupplierSelectedId);
                }
                // int SupplierSelectedId = Convert.ToInt32(SharedValues.getValue);
                if (SupplierSelectedId != 0)
                {
                    this.SelectedSearchSupplier = SupplierSelectedId;
                }
                else
                {
                    //var dataRefresh = SearchSupplier.Find(x => x.IsRefreshed != null && x.IsRefreshed == true);
                    //if (dataRefresh != null)
                    //{
                    //    supId = dataRefresh.ID;
                    //    this.SelectedSearchSupplier = supId;
                    //    dtRefresh = (dataRefresh.RefreshedDate != null) ? DateTime.UtcNow : dataRefresh.RefreshedDate;
                    //}
                    //else
                    //{

                    supId = SearchSupplier[0].ID;
                    this.SelectedSearchSupplier = supId;
                    this.LastUpdateDate         = String.Format(setdateFormat, this.SearchSupplier.OrderByDescending(x => x.Createddate).FirstOrDefault().Createddate);
                    //}
                    this.LastUpdateDate = String.Format(setdateFormat, dtRefresh);
                }
            }
            else
            {
                this.SelectedSearchSupplier = supId;
                //this.ChangeCustomerGST = IsCompanyRegisteredForGST;
                this.LastUpdateDate = String.Format(setdateFormat, System.DateTime.Now);
            }
            this.GetData(this.SelectedSearchSupplier);
        }