Пример #1
0
        private void searchButton_Click(object sender, EventArgs e)
        {
            int    memberId = (int)nameComboBox.SelectedValue;
            string date     = DateTime.Now.Month.ToString();
            List <MemberWithDeposit> depositList        = aDepositManager.MemberdDeposits(memberId, date);
            List <MemberWithMeal>    memberWithMealList = aMealManager.GetMeals(memberId, date);

            int    depositAmount = 0;
            double totalMeal     = 0;

            foreach (var deposit in depositList)
            {
                depositAmount = depositAmount + deposit.Amount;
            }


            foreach (var meal in memberWithMealList)
            {
                totalMeal += meal.TotalMeal;
            }


            totalDepositAmountLabel.Text = depositAmount.ToString();
            totalMealMemberlabel.Text    = totalMeal.ToString();

            double totalCost = totalMeal * GetPerMealCost();

            totalMealCostLabel.Text   = (totalCost).ToString();
            remainingAmountLabel.Text = (depositAmount - totalCost).ToString();
        }
Пример #2
0
        private void viewButton_Click(object sender, EventArgs e)
        {
            // mealListView.Items.Clear();
            MealManager aMealManager = new MealManager();
            int         memberId     = (int)nameComboBox.SelectedValue;

            DateTime input = Convert.ToDateTime(searchTimePicker.Text);
            string   date  = input.Month.ToString();
            List <MemberWithMeal> meals = aMealManager.GetMeals(memberId, date);



            //reportViewer1.ProcessingMode = ProcessingMode.Local;
            ////Providing DataSource for the Report
            //ReportDataSource rds = new ReportDataSource("GetMealReport", meals);
            //reportViewer1.LocalReport.DataSources.Clear();
            //reportViewer1.LocalReport.DataSources.Add(rds);
            //this.reportViewer1.RefreshReport();


            reportViewer1.LocalReport.DataSources.Clear();                                                                                     //clear report
            reportViewer1.LocalReport.ReportEmbeddedResource = "MessManagementSystem.Report.MealReport.rdlc";                                  // bind reportviewer with .rdlc
            Microsoft.Reporting.WinForms.ReportDataSource dataset = new Microsoft.Reporting.WinForms.ReportDataSource("GetMealReport", meals); // set the datasource
            reportViewer1.LocalReport.DataSources.Add(dataset);
            dataset.Value = meals;
            //
            reportViewer1.RefreshReport();
        }
Пример #3
0
        public void ShowMemberInformation(int memberId, String date)
        {
            MealManager           aMealManager   = new MealManager();
            List <MemberWithMeal> mealList       = aMealManager.GetMeals(memberId, date);
            MemberManager         aMemberManager = new MemberManager();
            MemberGateway         aGateway       = new MemberGateway();
            Member member = aGateway.GetMemberById(memberId);

            // CrystalReport crystalReport=new CrystalReport();
            MealCrystalReport mealCrystal = new MealCrystalReport();

            mealCrystal.SetDataSource(mealList);
            mealCrystal.SetParameterValue("mName", member.MemberName.ToString());
            mealCrystal.SetParameterValue("mPhone", member.Phone.ToString());
            mealCrystal.SetParameterValue("date", DateTime.Today);
            mealCrystalReportViewer.ReportSource = mealCrystal;
        }
Пример #4
0
        private void viewButton_Click(object sender, EventArgs e)
        {
            mealListView.Items.Clear();
            MealManager aMealManager = new MealManager();
            int         memberId     = (int)nameComboBox.SelectedValue;

            string date = DateTime.Now.Month.ToString();
            List <MemberWithMeal> meals = aMealManager.GetMeals(memberId, date);


            double subtotal = 0;
            int    count    = 1;

            foreach (var meal in meals)
            {
                subtotal = subtotal + meal.TotalMeal;
                ListViewItem item = new ListViewItem();
                item.Text = count++.ToString();
                item.SubItems.Add(meal.Date.ToString());
                item.SubItems.Add(meal.TotalMeal.ToString());
                item.SubItems.Add(subtotal.ToString());
                mealListView.Items.Add(item);
            }
        }