private void RefreshData()
        {
            ICountAndAdjustStockListRepository casRepository = new CountAndAdjustStockListRepository();

            this.DateFormat   = casRepository.GetDateFormat();
            this.ShowAllCount = casRepository.GetAllStockCount().Count();
            GetOptionsandTaxValues();
            this.JsonData = casRepository.GetLastSelectionData(Convert.ToInt32(ScreenId.PurchaseQuotationList));
            this.CountAndAdjustStockList    = casRepository.GetAllStockCountJson(this.JsonData).OrderBy(e => e.CountAndAdjustStockNo).ToList();
            this.ShowSelectedCount          = this.CountAndAdjustStockList.Count();
            this.CountAndAdjustStockListcmb = casRepository.GetAllStockCount().OrderBy(x => x.CountAndAdjustStockNo).ToList();


            this.YearRange = casRepository.GetYearRange().ToList();
            //changedateformat(this.PurchaseQuotationList);
            changeNumberformat(this.CountAndAdjustStockList);
            changeNumberformat(this.CountAndAdjustStockListcmb);
            this.CountAndAdjustStockListDate   = this.CountAndAdjustStockList.GroupBy(x => x.CountAndAdjustStockDateDatetime).Select(y => y.First()).OrderBy(x => x.CountAndAdjustStockDateDatetime).Distinct().ToList();
            this.CountAndAdjustStockListSCNo   = casRepository.GetAllStockCount().OrderBy(e => e.CountAndAdjustStockListSCNo).ToList();
            this.CountAndAdjustStockListAmount = casRepository.GetAllStockCount().GroupBy(x => x.AdjustedAmountd).Select(y => y.First()).OrderBy(x => x.AdjustedAmountd).Distinct().ToList();
            DefaultList = this.CountAndAdjustStockListcmb;
            FullPQList  = this.CountAndAdjustStockListcmb;
            //this.ShowAllCount = this.PurchaseQuotationListcmb.Count();
            SetDefaultSearchSelection(this.JsonData);
            var    Updateddate = this.CountAndAdjustStockListcmb.Max(x => x.CreatedDateList);
            string date        = this.DateFormat as string;

            this.LastUpdateDate = Convert.ToDateTime(Updateddate).ToString(date);
            TotalStockAmount    = Convert.ToString(CountAndAdjustStockList.Sum(e => e.AdjustedAmountd));
            //this.GetData(this.SelectedSearchSupplier);
        }
        void Search(object param)
        {
            if (Count != 0)
            {
                SearchValues = new List <SearchEntity>();
                //this.ShowSelectedTrue = true;
                //this.ShowAllTrue = false;
                if (this.SelectedSearchYear != null || this.SelectedSearchYear == string.Empty)
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Year";
                    value.FieldValue = this.SelectedSearchYear;
                    SearchValues.Add(value);
                    var year = Convert.ToInt32(this.SelectedSearchYear);
                    //DefaultList = FullPQList.Where(x => x.CreatedDate.Value.Year == year).ToList();
                    //if (this.IncludingGSTTrue == true)
                    //    this.PurchaseQuotationListInternal = DefaultList.Where(x => x.ExcIncGST == true).ToList();
                    //else
                    //    this.PurchaseQuotationListInternal = DefaultList.Where(x => x.ExcIncGST == false).ToList();
                    //this.PurchaseQuotationListcmb = DefaultList;
                }
                if (this.SelectedSearchQuarter != null || this.SelectedSearchQuarter == string.Empty)
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Quarter";
                    value.FieldValue = this.SelectedSearchQuarter;
                    int month1;
                    int month2;
                    int month3;
                    if (Convert.ToInt32(this.SelectedSearchQuarter) == 1)
                    {
                        month1 = 1;
                        month2 = 2;
                        month3 = 3;
                    }
                    else if (Convert.ToInt32(this.SelectedSearchQuarter) == 2)
                    {
                        month1 = 4;
                        month2 = 5;
                        month3 = 6;
                    }
                    else if (Convert.ToInt32(this.SelectedSearchQuarter) == 3)
                    {
                        month1 = 7;
                        month2 = 8;
                        month3 = 9;
                    }
                    else
                    {
                        month1 = 10;
                        month2 = 11;
                        month3 = 12;
                    }
                    //DefaultList = FullPQList.Where(x => x.CreatedDate.Value.Month == month1 || x.CreatedDate.Value.Month == month2 || x.CreatedDate.Value.Month == month3).ToList();
                    //if (this.IncludingGSTTrue == true)
                    //    this.PurchaseQuotationListInternal = DefaultList.Where(x => x.ExcIncGST == true).ToList();
                    //else
                    //    this.PurchaseQuotationListInternal = DefaultList.Where(x => x.ExcIncGST == false).ToList();
                    //this.PurchaseQuotationListcmb = DefaultList;
                    SearchValues.Add(value);
                }
                if (this.SelectedSearchMonth != null || this.SelectedSearchMonth == string.Empty)
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Month";
                    value.FieldValue = this.SelectedSearchMonth;
                    SearchValues.Add(value);
                    var month = Convert.ToInt32(this.SelectedSearchMonth);
                    //DefaultList = FullPQList.Where(x => x.CreatedDate.Value.Month == month).ToList();
                    //if (this.IncludingGSTTrue == true)
                    //    this.PurchaseQuotationListInternal = DefaultList.Where(x => x.ExcIncGST == true).ToList();
                    //else
                    //    this.PurchaseQuotationListInternal = DefaultList.Where(x => x.ExcIncGST == false).ToList();
                    //this.PurchaseQuotationListcmb = DefaultList;
                }
                if (this.SelectedSearchStartDate != null && this.SelectedSearchEndDate != null)
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "StartDate";
                    value.FieldValue = this.SelectedSearchStartDate.ToString();
                    value.FieldValue = string.Format("{0:MMM/dd/yyyy}", this.SelectedSearchStartDate);
                    SearchValues.Add(value);
                    //string[] value = new string[2];
                    SearchEntity value1 = new SearchEntity();
                    value1.FieldName = "EndDate";
                    //value1.FieldValue = this.SelectedSearchEndDate.ToString();
                    value1.FieldValue = string.Format("{0:MMM/dd/yyyy}", this.SelectedSearchEndDate);

                    //DefaultList = FullPQList.Where(x => x.CreatedDate > this.SelectedSearchStartDate && x.CreatedDate < this.SelectedSearchEndDate).ToList();
                    //if (this.IncludingGSTTrue == true)
                    //    this.PurchaseQuotationListInternal = DefaultList.Where(x => x.ExcIncGST == true).ToList();
                    //else
                    //    this.PurchaseQuotationListInternal = DefaultList.Where(x => x.ExcIncGST == false).ToList();
                    //this.PurchaseQuotationListcmb = DefaultList;
                    SearchValues.Add(value);
                    SearchValues.Add(value1);
                }

                jsonSearch    = JsonConvert.SerializeObject(SearchValues);
                this.JsonData = jsonSearch;

                ICountAndAdjustStockListRepository casRepository = new CountAndAdjustStockListRepository();
                var results = casRepository.SaveSearchJson(jsonSearch, Convert.ToInt32(ScreenId.PurchaseQuotationList), "CountAndAdjustStock_List");
                if (Count != 0)
                {
                    this.CountAndAdjustStockList = casRepository.GetAllStockCountJson(jsonSearch);
                    //changedateformat(this.PurchaseQuotationList);
                    changeNumberformat(this.CountAndAdjustStockList);
                }

                this.CountAndAdjustStockListcmb    = this.CountAndAdjustStockList.OrderBy(e => e.CountAndAdjustStockNo).ToList();
                this.CountAndAdjustStockListDate   = this.CountAndAdjustStockList.GroupBy(x => x.CountAndAdjustStockDateDatetime).Select(y => y.First()).OrderBy(x => x.CountAndAdjustStockDateDatetime).Distinct().ToList();
                this.CountAndAdjustStockListSCNo   = casRepository.GetAllStockCount().OrderBy(e => e.CountAndAdjustStockListSCNo).ToList();
                this.CountAndAdjustStockListAmount = casRepository.GetAllStockCount().GroupBy(x => x.AdjustedAmountd).Select(y => y.First()).OrderBy(x => x.AdjustedAmountd).Distinct().ToList();
                if (this.ShowAllTrue == true)
                {
                    this.ShowSelectedCount = 0;
                }
                else
                {
                    this.ShowSelectedCount = this.CountAndAdjustStockList.Count();
                }
                DefaultList = this.CountAndAdjustStockListcmb;

                TotalStockAmount = Convert.ToString(this.CountAndAdjustStockList.Sum(e => e.AdjustedAmountd));
            }
        }