コード例 #1
0
 public void  RefreshData()
 {
     try
     {
         this.StartEndDateTrue = false;
         this.ShowAllTrue      = false;
         this.JsonData         = journalListRepositoty.GetLastSelectionData(Convert.ToInt32(ScreenId.JournalList));
         JournalListEntity     = journalListRepositoty.getJournalDetails(this.JsonData);
         //var v = JournalListEntity.Last().Amount1Str;
         FullList              = JournalListEntity;
         this.ShowAllCount     = this.JournalListEntity.Count();
         this.ComboDateList    = JournalListEntity.GroupBy(x => x.JournalDate).Select(x => x.FirstOrDefault()).OrderBy(x => x.JournalDate).ToList();
         this.ComboJNumberList = JournalListEntity.GroupBy(x => x.JNumber).Select(x => x.FirstOrDefault()).OrderBy(x => x.JNumber).ToList();
         this.ComboAmountList  = JournalListEntity.GroupBy(x => x.Amount1Str).Select(x => x.FirstOrDefault()).OrderBy(x => x.Amount1Str).ToList();
         ShowSelectedCount     = JournalListEntity.Count();
         this.TotalAmount      = Convert.ToString(JournalListEntity.Sum(k => k.JoAmount));
         //TotalAmount = v;
     }
     catch (Exception e)
     {
         throw e;
     }
     this.YearRange = purchaseRepository.GetYearRange().ToList();
     SetDefaultSearchSelection();
     GetOptionsandTaxValues();
 }
コード例 #2
0
        //public void SetDefaultSearchSelection(string jsondata)
        //{
        //    if (jsondata != null && jsondata != "[]")
        //    {

        //        this.ShowSelectedTrue = true;
        //        ShowSelectedCount = JournalListEntity.Count();
        //        //this.ShowAllTrue = false;
        //        var objResponse1 = JsonConvert.DeserializeObject<List<SearchEntity>>(jsondata);
        //        foreach (var item in objResponse1)
        //        {
        //            switch (item.FieldName)
        //            {
        //                case "Year":
        //                    this.SelectedSearchYear = item.FieldValue;
        //                    this.YearmonthQuartTrue = true;
        //                    this.StartEndDateTrue = false;
        //                    this.EnableYearDropDown = true;
        //                    this.EnableMonthDropDown = true;
        //                    this.EnableQuarterDropDown = true;
        //                    break;
        //                case "Quarter":
        //                    this.SelectedSearchQuarter = item.FieldValue;
        //                    this.YearmonthQuartTrue = true;
        //                    this.StartEndDateTrue = false;
        //                    this.EnableYearDropDown = true;
        //                    this.EnableMonthDropDown = true;
        //                    this.EnableQuarterDropDown = true;
        //                    break;
        //                case "Month":
        //                    this.SelectedSearchMonth = item.FieldValue;
        //                    this.YearmonthQuartTrue = true;
        //                    this.StartEndDateTrue = false;
        //                    this.EnableYearDropDown = true;
        //                    this.EnableMonthDropDown = true;
        //                    this.EnableQuarterDropDown = true;
        //                    break;
        //                case "StartDate":
        //                    this.SelectedSearchStartDate = Convert.ToDateTime(item.FieldValue);
        //                    this.YearmonthQuartTrue = false;
        //                    this.StartEndDateTrue = true;
        //                    this.EnableYearDropDown = false;
        //                    this.EnableMonthDropDown = false;
        //                    this.EnableQuarterDropDown = false;
        //                    break;
        //                case "EndDate":
        //                    this.SelectedSearchEndDate = Convert.ToDateTime(item.FieldValue);
        //                    this.YearmonthQuartTrue = false;
        //                    this.StartEndDateTrue = true;
        //                    this.EnableYearDropDown = false;
        //                    this.EnableMonthDropDown = false;
        //                    this.EnableQuarterDropDown = false;
        //                    break;
        //            }
        //        }
        //        Search(null);
        //    }
        //    else
        //    {
        //        this.ShowAllTrue = true;
        //        this.YearmonthQuartTrue = false;//change to false after feedback on 22 may
        //        this.ShowSelectedTrue = false;
        //        this.StartEndDateTrue = false;
        //        ShowSelectedCount = JournalListEntity.Count();

        //    }
        //}
        protected override void OnPropertyChanged(string name)
        {
            var eventHandler = this.PropertyChanged;

            if (eventHandler != null)
            {
                eventHandler(this, new PropertyChangedEventArgs(name));
            }
            switch (name)
            {
            case "SelectedSearchQuarter":
                SetData(this.SelectedSearchQuarter, "Quarter");
                this.TotalAmount = Convert.ToString(JournalListEntity.Sum(k => k.JoAmount));
                break;

            case "SelectedSearchMonth":
                SetData(this.SelectedSearchMonth, "Month");
                this.TotalAmount = Convert.ToString(JournalListEntity.Sum(k => k.JoAmount));
                break;

            case "SelectedSearchYear":
                SetData(this.SelectedSearchYear, "Year");
                this.TotalAmount = Convert.ToString(JournalListEntity.Sum(k => k.JoAmount));
                break;

            case "SelectedSearchStartDate":
                SetData(this.SelectedSearchStartDate.ToString(), "StartDate");
                this.TotalAmount = Convert.ToString(JournalListEntity.Sum(k => k.JoAmount));
                break;

            case "SelectedSearchEndDate":
                SetData(this.SelectedSearchEndDate.ToString(), "EndDate");
                this.TotalAmount = Convert.ToString(JournalListEntity.Sum(k => k.JoAmount));
                break;

            case "SelectedJournalDate":
                GetData(this.SelectedJournalDate, "SelectedJournalDate");
                ShowSelectedCount = JournalListEntity.Count();
                this.TotalAmount  = Convert.ToString(JournalListEntity.Sum(k => k.JoAmount));
                break;

            case "SelectedJNumber":
                GetData(this.SelectedJNumber, "SelectedJNumber");
                ShowSelectedCount = JournalListEntity.Count();
                this.TotalAmount  = Convert.ToString(JournalListEntity.Sum(k => k.JoAmount));
                break;

            case "SelectedAmount":
                GetData(this.SelectedAmount, "SelectedAmount");
                ShowSelectedCount = JournalListEntity.Count();
                this.TotalAmount  = Convert.ToString(JournalListEntity.Sum(k => k.JoAmount));
                break;
            }

            base.OnPropertyChanged(name);
        }
コード例 #3
0
        void Search(object param)
        {
            //UIServices.SetBusyState();
            //DoProcessing();
            if (Count != 0)
            {
                SearchValues = new List <SearchEntity>();
                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);
                }
                else
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Year";
                    value.FieldValue = "0";
                    SearchValues.Add(value);
                }

                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;
                    }
                    SearchValues.Add(value);
                }
                else
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Quarter";
                    value.FieldValue = "0";
                    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);
                }
                else
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Month";
                    value.FieldValue = "0";
                    SearchValues.Add(value);
                }
                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);
                    SearchValues.Add(value1);
                }
                else
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "StartDate";
                    value.FieldValue = "";
                    SearchValues.Add(value);
                    SearchEntity value1 = new SearchEntity();
                    value1.FieldName  = "EndDate";
                    value1.FieldValue = "";
                    SearchValues.Add(value1);
                }
                //if (this.ID != 0)
                //{
                //    SearchEntity value = new SearchEntity();
                //    value.FieldName = "PandS";
                //    value.FieldValue = this.PandS.ToString();
                //    SearchValues.Add(value);
                //}
                //else
                //{
                //    SearchEntity value = new SearchEntity();
                //    value.FieldName = "PandS";
                //    value.FieldValue = "0";
                //    SearchValues.Add(value);
                //}
                if (this.ShowAllTrue == true)
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "ShowAll";
                    value.FieldValue = this.ShowAllTrue.ToString();
                    SearchValues.Add(value);
                }
                else
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "ShowAll";
                    value.FieldValue = "false";
                    SearchValues.Add(value);
                }
                jsonSearch    = JsonConvert.SerializeObject(SearchValues);
                this.JsonData = jsonSearch;
                var results = journalListRepositoty.SaveSearchJson(jsonSearch, Convert.ToInt32(ScreenId.JournalList), "JournalList");
                this.TotalAmount = Convert.ToString(JournalListEntity.Sum(k => k.JoAmount));
                if (Count != 0)
                {
                    if (JsonData != null)
                    {
                        JournalListEntity = journalListRepositoty.getJournalDetails(jsonSearch);
                        FullList          = JournalListEntity;
                        ShowSelectedCount = JournalListEntity.Count();
                    }
                }
            }
        }