public FindProjectTaskCostsDataSet FindProjectTasksCosts(string strAssignedProjectID) { try { aFindProjectTaskCostsDataSet = new FindProjectTaskCostsDataSet(); aFindProjectTaskCostsTableAdapter = new FindProjectTaskCostsDataSetTableAdapters.FindProjectTaskCostsTableAdapter(); aFindProjectTaskCostsTableAdapter.Fill(aFindProjectTaskCostsDataSet.FindProjectTaskCosts, strAssignedProjectID); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Project Costing Class // Find Project Tasks Costs " + Ex.Message); } return(aFindProjectTaskCostsDataSet); }
private void btnFind_Click(object sender, RoutedEventArgs e) { string strAssignedProjectID; int intRecordsReturned; decimal decTotalCost = 0; decimal decTotalHours = 0; int intCounter; int intNumberOfRecords; double douTotalCost; try { strAssignedProjectID = txtAssignedProjectID.Text; if (strAssignedProjectID == "") { TheMessagesClass.ErrorMessage("The Assigned Project ID Was Not Entered"); return; } TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strAssignedProjectID); intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count; if (intRecordsReturned < 1) { TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strAssignedProjectID); intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count; if (intRecordsReturned < 1) { TheMessagesClass.ErrorMessage("The Project Was Not Found"); return; } else { strAssignedProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].CustomerAssignedID; } } TheFindProjectTaskCostsDataSet = TheProjectCostingClass.FindProjectTasksCosts(strAssignedProjectID); intNumberOfRecords = TheFindProjectTaskCostsDataSet.FindProjectTaskCosts.Rows.Count - 1; if (intNumberOfRecords > -1) { for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { decTotalCost += TheFindProjectTaskCostsDataSet.FindProjectTaskCosts[intCounter].LaborCost; decTotalHours += TheFindProjectTaskCostsDataSet.FindProjectTaskCosts[intCounter].TotalHours; } } dgrResults.ItemsSource = TheFindProjectTaskCostsDataSet.FindProjectTaskCosts; douTotalCost = Convert.ToDouble(decTotalCost); decTotalCost = Convert.ToDecimal(Math.Round(douTotalCost, 2)); txtTotalCost.Text = Convert.ToString(decTotalCost); txtTotalHours.Text = Convert.ToString(decTotalHours); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Employee Project Labor Report // Find Button " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }