public UninvoiceWork GetAllUninvoicedWork(int identityID) { Facade.IOrganisation facOrg = new Facade.Organisation(); DateTime endDate = DateTime.Today.AddMonths(-1); // this has been amended to look up to the end of the previous month System.Globalization.Calendar cal = System.Globalization.CultureInfo.CurrentCulture.Calendar; endDate = new DateTime(endDate.Year, endDate.Month, cal.GetDaysInMonth(endDate.Year, endDate.Month)); DataSet ds = facOrg.GetAllUninvoicedWorkForOrganisation(identityID, DateTime.Today.AddYears(-1), endDate, true, true, true); try { int orderCount = 0; decimal orderValue = 0; foreach (DataRow row in ds.Tables[1].Rows) { orderCount += (int)row["CountOfJobs"]; orderValue += (decimal)row["Total Charge Amount"]; } UninvoiceWork retVal = new UninvoiceWork() { NumberOfOrders = orderCount, ValueOfOrders = orderValue }; return(retVal); } catch (Exception ex) { throw ex; } }
void btnRefresh_Click(object sender, EventArgs e) { Facade.IOrganisation facOrg = new Facade.Organisation(); int identityID = 0; int.TryParse(cboClient.SelectedValue, out identityID); AllUninvoicedWorkForOrganisation = facOrg.GetAllUninvoicedWorkForOrganisation(identityID, this.rdiStartDate.SelectedDate.Value, this.rdiEndDate.SelectedDate.Value, cboSearchAgainstWorker.Items[0].Selected || cboSearchAgainstWorker.Items[3].Selected, cboSearchAgainstWorker.Items[1].Selected || cboSearchAgainstWorker.Items[3].Selected, cboSearchAgainstWorker.Items[2].Selected || cboSearchAgainstWorker.Items[3].Selected); this.grdUninvoiceExtras.Rebind(); BindRepeater(); }