示例#1
0
        //public ICommand PrintSummaryCommandView
        //{
        //    get { return _printListCommandView ?? (_printListCommandView = new RelayCommand<Object>(PrintList)); }
        //}
        //public void PrintList(object obj)
        //{
        //    var myReport4 = new PinnaFit.WPF.Reports.Summary.NumberSummay();
        //    myReport4.SetDataSource(GetNumberListDataSet());

        //    //MenuItem menu = obj as MenuItem;
        //    //if (menu != null)
        //    //    new ReportUtility().DirectPrinter(myReport4);
        //    //else
        //    //{
        //    var report = new ReportViewerCommon(myReport4);
        //    report.Show();
        //    //}
        //}
        //public FitnessDataSet GetNumberListDataSet()
        //{
        //    var myDataSet = new FitnessDataSet();
        //    var serNo = 1;
        //    var selectedCompany = new CompanyService(true).GetCompany();

        //    MemberSubscriptionListForNumberSummary = MemberSubscriptionListForNumberSummary.Where(m => !m.IsExpired).ToList();

        //    #region Group By Facility
        //    var querFacility = from memberSubscriptionList in MemberSubscriptionListForNumberSummary
        //                       group memberSubscriptionList by memberSubscriptionList.FacilityName
        //                           into newGroup
        //                           orderby newGroup.Key
        //                           select newGroup;

        //    MemberCategorySubList = querFacility.Select(nameGroup => new SubscriptionSumModel
        //    {
        //        Category = nameGroup.Key,
        //        SubscriptionModels = nameGroup
        //    }).ToList();


        //    foreach (var subscriptionSumModel in MemberCategorySubList)
        //    {
        //        string cat = subscriptionSumModel.Category;
        //        var subModels = subscriptionSumModel.SubscriptionModels;

        //        var querSubscription = from memberSubscriptionList in subModels
        //                               group memberSubscriptionList by memberSubscriptionList.SubscriptionName
        //                                   into newGroup
        //                                   orderby newGroup.Key
        //                                   select newGroup;

        //        var memberCategorySubList2 = querSubscription.Select(nameGroup => new SubscriptionSumModel
        //        {
        //            Category = nameGroup.Key,
        //            SubscriptionModels = nameGroup
        //        }).ToList();

        //        int permonth = 0, threemonth = 0, sixmonth = 0, oneyear = 0;

        //        var firstOrDefault = memberCategorySubList2.FirstOrDefault(a => a.Category == "Per Month");
        //        if (firstOrDefault != null)
        //        {
        //            permonth = firstOrDefault.TotalNumber;
        //        }

        //        firstOrDefault = memberCategorySubList2.FirstOrDefault(a => a.Category == "3 Months");
        //        if (firstOrDefault != null)
        //        {
        //            threemonth = firstOrDefault.TotalNumber;
        //        }

        //        firstOrDefault = memberCategorySubList2.FirstOrDefault(a => a.Category == "6 Months");
        //        if (firstOrDefault != null)
        //        {
        //            sixmonth = firstOrDefault.TotalNumber;
        //        }

        //        firstOrDefault = memberCategorySubList2.FirstOrDefault(a => a.Category == "1 Year");
        //        if (firstOrDefault != null)
        //        {
        //            oneyear = firstOrDefault.TotalNumber;
        //        }

        //        var tot = oneyear + permonth + threemonth + sixmonth;

        //        myDataSet.SummaryReport.Rows.Add(
        //          serNo,
        //          ReportUtility.GetEthCalendarFormated(DateTime.Now, "-") + "(" +
        //            DateTime.Now.ToShortDateString() + ")",
        //          cat,
        //          0,
        //          permonth,
        //          threemonth,
        //          sixmonth,
        //          oneyear,
        //          tot,
        //          "",
        //          "",
        //          0, 0, selectedCompany.Header, "");

        //        serNo++;
        //    }



        //    #endregion


        //    return myDataSet;
        //}

        //public ICommand PrintDailySummaryCommandView
        //{
        //    get { return _printDailySummaryCommandView ?? (_printDailySummaryCommandView = new RelayCommand<Object>(PrintDailySummaryList)); }
        //}
        //public void PrintDailySummaryList(object obj)
        //{
        //    var myReport4 = new Reports.Summary.DailySummay();
        //    var dSet = GetSummaryDataSet();
        //    if (dSet == null)
        //        return;

        //    myReport4.SetDataSource(dSet);

        //    var report = new ReportViewerCommon(myReport4);
        //    report.Show();

        //}
        //public FitnessDataSet GetSummaryDataSet()
        //{
        //    try
        //    {
        //        var selectDate = SelectedEthioDay.Value + "/" + SelectedEthioMonth.Value + "/" + SelectedEthioYear.Display;

        //        var selectedDate = ReportUtility.GetGregorCalendar(SelectedEthioYear.Value, SelectedEthioMonth.Value,
        //            SelectedEthioDay.Value);

        //        var myDataSet = new FitnessDataSet();
        //        var serNo = 1;
        //        var selectedCompany = new CompanyService(true).GetCompany();

        //        var MemberSubsList = MemberSubscriptionList.Where(
        //            m => m.TransactionDate.Day == selectedDate.Day &&
        //            m.TransactionDate.Month == selectedDate.Month &&
        //            m.TransactionDate.Year == selectedDate.Year).ToList();

        //        if (MemberSubsList.Count == 0)
        //        {
        //            MessageBox.Show("No Data found on: " + Environment.NewLine + selectDate + "(" +
        //                selectedDate.ToShortDateString() + ")" + "(" + SelectedShiftType.Display + ")", "No Data",
        //                MessageBoxButtons.OK, MessageBoxIcon.Error);
        //            return null;
        //        }

        //        #region Group By Facility
        //        var querFacility = from memberSubscriptionList in MemberSubsList
        //                           group memberSubscriptionList by memberSubscriptionList.PackageName
        //                               into newGroup
        //                               orderby newGroup.Key
        //                               select newGroup;

        //        MemberCategorySubList = querFacility.Select(nameGroup => new SubscriptionSumModel
        //        {
        //            Category = nameGroup.Key,
        //            SubscriptionModels = nameGroup
        //        }).ToList();

        //        foreach (var subscriptionSumModel in MemberCategorySubList)
        //        {
        //            var subtototal = subscriptionSumModel.TotalAmount / (decimal)1.15;
        //            var tax = subtototal * (decimal)0.15;

        //            myDataSet.DailySummaryReport.Rows.Add(
        //              serNo,
        //              ReportUtility.GetEthCalendarFormated(selectedDate, "-") + "(" +
        //                selectedDate.ToShortDateString() + ") - (" + SelectedShiftType.Display + ")",
        //              subscriptionSumModel.Category,
        //              subscriptionSumModel.TotalUnit,
        //              subtototal,
        //              tax,
        //              subscriptionSumModel.TotalAmount,
        //              "",
        //              "",
        //              0, 0, selectedCompany.Header, "");

        //            serNo++;
        //        }



        //        #endregion


        //        return myDataSet;
        //    }
        //    catch
        //    {
        //        return null;
        //    }
        //}

        #endregion

        #region Filter List
        public void FillCalendar()
        {
            #region Initialize
            _ethioDays          = new ObservableCollection <ListDataItem>();
            _ethioMonths        = new ObservableCollection <ListDataItem>();
            _ethioYears         = new ObservableCollection <ListDataItem>();
            _selectedEthioDay   = new ListDataItem();
            _selectedEthioMonth = new ListDataItem();
            _selectedEthioYear  = new ListDataItem();
            #endregion

            for (var i = 1; i <= 30; i++)
            {
                EthioDays.Add(new ListDataItem {
                    Display = i.ToString(), Value = i
                });
            }

            for (var i = 1; i <= 12; i++)
            {
                EthioMonths.Add(new ListDataItem {
                    Display = ReportUtility.GetAmhMonth(i - 1), Value = i
                });
            }
            EthioMonths.Add(new ListDataItem {
                Display = ReportUtility.GetAmhMonth(12), Value = 13
            });

            for (var i = 2008; i <= 2020; i++)
            {
                EthioYears.Add(new ListDataItem {
                    Display = i.ToString(), Value = i
                });
            }
        }
示例#2
0
        public CalendarConvertorViewModel()
        {
            DurationHeader = "Calendar Convertor";

            #region Initialize

            _gregorDays          = new ObservableCollection <ListDataItem>();
            _gregorMonths        = new ObservableCollection <ListDataItem>();
            _gregorYears         = new ObservableCollection <ListDataItem>();
            _selectedGregorDay   = new ListDataItem();
            _selectedGregorMonth = new ListDataItem();
            _selectedGregorYear  = new ListDataItem();
            _ethioDays           = new ObservableCollection <ListDataItem>();
            _ethioMonths         = new ObservableCollection <ListDataItem>();
            _ethioYears          = new ObservableCollection <ListDataItem>();
            _selectedEthioDay    = new ListDataItem();
            _selectedEthioMonth  = new ListDataItem();
            _selectedEthioYear   = new ListDataItem();

            #endregion

            #region Load Properties

            for (var i = 1; i <= 30; i++)
            {
                GregorDays.Add(new ListDataItem {
                    Display = i.ToString(), Value = i
                });
                EthioDays.Add(new ListDataItem {
                    Display = i.ToString(), Value = i
                });
            }
            GregorDays.Add(new ListDataItem {
                Display = "31", Value = 31
            });

            for (var i = 1; i <= 12; i++)
            {
                string monthNo = " (" + i + ")"; //"";
                GregorMonths.Add(new ListDataItem {
                    Display = ReportUtility.GetEngMonth(i - 1) + monthNo, Value = i
                });
                EthioMonths.Add(new ListDataItem {
                    Display = ReportUtility.GetAmhMonth(i - 1) + monthNo, Value = i
                });
            }
            EthioMonths.Add(new ListDataItem {
                Display = ReportUtility.GetAmhMonth(12) + " (13)", Value = 13
            });

            for (var i = 1900; i <= 2020; i++)
            {
                GregorYears.Add(new ListDataItem {
                    Display = i.ToString(), Value = i
                });
            }
            for (var i = 1900; i <= 2020; i++)
            {
                EthioYears.Add(new ListDataItem {
                    Display = i.ToString(), Value = i
                });
            }


            //try
            //{
            //    SelectedGregorDay = GregorDays[DateTime.Now.Day - 1];
            //    SelectedGregorMonth = GregorMonths[DateTime.Now.Month - 1];
            //    SelectedGregorYear = GregorYears[DateTime.Now.Year - 1900];

            //    SetEthioValues();
            //}
            //catch
            //{
            //}

            #endregion

            Messenger.Default.Register <DateTime>(this, (message) =>
            {
                SelectedDateParam = message;
            });
            //SetGregor();
        }