private void searchButton_Click(object sender, EventArgs e) { shopingListView.Items.Clear(); string month = dateTimePicker1.Value.Month.ToString(); ShopingManager shopingManager = new ShopingManager(); List <MemberWithShoping> shopingList = shopingManager.GetShopingList(month); int subcost = 0; foreach (var memberShoping in shopingList) { subcost = subcost + memberShoping.Cost; ListViewItem item = new ListViewItem(); item.Text = memberShoping.Date.ToString(); item.SubItems.Add(memberShoping.MemberName); item.SubItems.Add(memberShoping.Cost.ToString()); item.SubItems.Add(subcost.ToString()); item.Tag = memberShoping; shopingListView.Items.Add(item); } LoadDailyMal(month); }
private void removeButton_Click(object sender, EventArgs e) { ShopingManager aShopingManager = new ShopingManager(); string date = shopingDateTimePicker.Text.ToString(); int memberId = Convert.ToInt32(nameComboBox.SelectedValue); string message = aShopingManager.RemoveShiopingCost(memberId, date); MessageBox.Show(message); GetShopingListWithMember(); Reset(); }
public ShopingReportCrystalReportUI(string month) { InitializeComponent(); ShopingManager aShopingManager = new ShopingManager(); HelperClass helper = new HelperClass(); List <MemberWithShoping> shopingList = aShopingManager.GetShopingList(month); ShopingCrystalReport shopingCrystalReport = new ShopingCrystalReport(); shopingCrystalReport.SetDataSource(shopingList); shopingCrystalReport.SetParameterValue("Month", helper.CurrentMonthAsString()); shopingCrystalReportViewer.ReportSource = shopingCrystalReport; }
private void LoadDailyMal() { MealManager aMealManager = new MealManager(); string month = DateTime.Now.Month.ToString(); ShopingManager shopingManager = new ShopingManager(); List <MemberWithShoping> shopingList = shopingManager.GetShopingList(month); dailyShopingReportViewer.LocalReport.DataSources.Clear(); //clear report dailyShopingReportViewer.LocalReport.ReportEmbeddedResource = "MessManagementSystem.Report.DailyShopingReport.rdlc"; // bind reportviewer with .rdlc Microsoft.Reporting.WinForms.ReportDataSource dataset = new Microsoft.Reporting.WinForms.ReportDataSource("DailyShoping", shopingList); // set the datasource dailyShopingReportViewer.LocalReport.DataSources.Add(dataset); dataset.Value = shopingList; // dailyShopingReportViewer.RefreshReport(); }