private void btnSubmit_Click(object sender, EventArgs e) { if (cmbServiceID.Text != null && fldName.Text != "" && dtValue.Text != null) { int ServiceID = (cmbServiceID.SelectedItem as Service).Id; String fldNameValue = fldName.Text; String dtval = string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(dtValue.Text)); var tokenDao = new TokenDao(); dgvServiceReport.AutoGenerateColumns = false; var data = tokenDao.GetServiceReport(ServiceID, fldNameValue, dtval); //var totals = new Token(); //totals.DevoteeName = "Totals"; //totals.SoldQuantity = data.Sum(x => x.SoldQuantity); //totals.TotalCost = data.Sum(x => x.TotalCost); //data.Add(totals); dgvServiceReport.DataSource = data; } else { if (cmbServiceID.Text != null) { MessageBox.Show("Select Service"); } else if (fldName.Text != null) { MessageBox.Show("Select CreatedOn / ServicePerformDate"); } else if (dtValue.Text != null) { MessageBox.Show("Select Date"); } } }
private void ServicesPrintForm_Load(object sender, EventArgs e) { var tokenDao = new TokenDao(); dgvServiceReport.AutoGenerateColumns = false; var data = tokenDao.GetServiceReport(ServiceID, fldNameValue, dtval); var totals = new Token(); totals.DevoteeName = "Totals"; //totals.SoldQuantity = data.Sum(x => x.SoldQuantity); totals.TotalCost = data.Sum(x => x.TotalCost); data.Add(totals); dgvServiceReport.DataSource = data; }