public FindProjectMaterialCostingDataSet FindProjectMaterialCosting(string strAssignedProjectID)
        {
            try
            {
                aFindProjectMaterialCostingDataSet      = new FindProjectMaterialCostingDataSet();
                aFindProjectMaterialCostingTableAdapter = new FindProjectMaterialCostingDataSetTableAdapters.FindProjectMaterialCostingTableAdapter();
                aFindProjectMaterialCostingTableAdapter.Fill(aFindProjectMaterialCostingDataSet.FindProjectMaterialCosting, strAssignedProjectID);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Project Costing Class // Find Project Material Costing " + Ex.Message);
            }

            return(aFindProjectMaterialCostingDataSet);
        }
Exemplo n.º 2
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            string strAssignedpProjectID;
            int    intRecordsReturned;
            int    intCounter;
            int    intNumberOfRecords;
            double douPrice;
            double douTotalPrice;

            try
            {
                TheProjectMaterialCostingDataSet.projectmateriacosting.Rows.Clear();
                gdecTotalCost         = 0;
                gdecTotalHours        = 0;
                strAssignedpProjectID = txtEnterAssignedProjectID.Text;
                if (strAssignedpProjectID == "")
                {
                    TheMessagesClass.ErrorMessage("The Assigned Project ID Was Not Entered");
                    return;
                }

                TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strAssignedpProjectID);

                intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

                if (intRecordsReturned < 1)
                {
                    TheMessagesClass.ErrorMessage("Project Not Found");
                    return;
                }

                TheFindProjectHoursCostingDataSet = TheProjectCostingClass.FindProjectHoursCosting(strAssignedpProjectID);

                intNumberOfRecords = TheFindProjectHoursCostingDataSet.FindProjectHoursCosting.Rows.Count - 1;

                if (intNumberOfRecords > -1)
                {
                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        gdecTotalHours += TheFindProjectHoursCostingDataSet.FindProjectHoursCosting[intCounter].TotalHours;
                    }
                }

                txtTotalHOurs.Text = Convert.ToString(gdecTotalHours);

                dgrHours.ItemsSource = TheFindProjectHoursCostingDataSet.FindProjectHoursCosting;

                TheFindProjectMaterialCostingDataSet = TheProjectCostingClass.FindProjectMaterialCosting(strAssignedpProjectID);

                intNumberOfRecords = TheFindProjectMaterialCostingDataSet.FindProjectMaterialCosting.Rows.Count - 1;

                if (intNumberOfRecords > -1)
                {
                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        douPrice = TheFindProjectMaterialCostingDataSet.FindProjectMaterialCosting[intCounter].Price;
                        douPrice = Math.Round(douPrice, 2);

                        douTotalPrice = TheFindProjectMaterialCostingDataSet.FindProjectMaterialCosting[intCounter].PartPrice;
                        douTotalPrice = Math.Round(douTotalPrice, 2);

                        gdecTotalCost += Convert.ToDecimal(douTotalPrice);

                        ProjectMaterialCostingDataSet.projectmateriacostingRow NewPartCost = TheProjectMaterialCostingDataSet.projectmateriacosting.NewprojectmateriacostingRow();

                        NewPartCost.PartID          = TheFindProjectMaterialCostingDataSet.FindProjectMaterialCosting[intCounter].PartID;
                        NewPartCost.PartNumber      = TheFindProjectMaterialCostingDataSet.FindProjectMaterialCosting[intCounter].PartNumber;
                        NewPartCost.PartDescription = TheFindProjectMaterialCostingDataSet.FindProjectMaterialCosting[intCounter].PartDescription;
                        NewPartCost.TotalQuantity   = TheFindProjectMaterialCostingDataSet.FindProjectMaterialCosting[intCounter].TotalQuantity;
                        NewPartCost.TotalCost       = Convert.ToDecimal(douTotalPrice);
                        NewPartCost.Cost            = Convert.ToDecimal(douPrice);

                        //adding the row
                        TheProjectMaterialCostingDataSet.projectmateriacosting.Rows.Add(NewPartCost);
                    }
                }

                txtTotalMaterialCost.Text = Convert.ToString(gdecTotalCost);

                dgrMaterials.ItemsSource = TheProjectMaterialCostingDataSet.projectmateriacosting;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Project Costing // Search Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }