示例#1
0
        private void btnFind_Click(object sender, RoutedEventArgs e)
        {
            string strValueForValidation;
            string strToolID          = "";
            bool   blnFatalError      = false;
            bool   blnThereIsAProblem = false;
            string strErrorMessage    = "";
            int    intCounter;
            int    intNumberOfRecords;
            int    intWarehouseEmployee;
            string strWarehouseEmployeeName;

            try
            {
                strValueForValidation = txtStartDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Start Date is not a Date\n";
                }
                else
                {
                    gdatStartDate = Convert.ToDateTime(strValueForValidation);
                }
                strValueForValidation = txtEndDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The End Date is not a Date\n";
                }
                else
                {
                    gdatEndDate = Convert.ToDateTime(strValueForValidation);
                    gdatEndDate = TheDataSearchClass.AddingDays(gdatEndDate, 1);
                }
                if (gstrToolHistoryType == "Employee Search")
                {
                    if (cboSelectEmployee.SelectedIndex == 0)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "Employee Was Not Selected\n";
                    }
                }
                if (gstrToolHistoryType == "Tool ID Search")
                {
                    strToolID = txtEnterLastName.Text;
                    if (strToolID == "")
                    {
                        blnFatalError    = true;
                        strErrorMessage += "Tool ID Was Not Entered\n";
                    }
                }

                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                TheViewToolHistoryDataSet.toolhistory.Rows.Clear();

                if (gstrToolHistoryType == "Date Range Search")
                {
                    TheFindToolHistoryByDateRangeDataSet = TheToolHistoryClass.FindToolHistoryByDateRange(gdatStartDate, gdatEndDate);

                    intNumberOfRecords = TheFindToolHistoryByDateRangeDataSet.FindToolHistoryByDateRange.Rows.Count - 1;

                    if (intNumberOfRecords > -1)
                    {
                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            intWarehouseEmployee = TheFindToolHistoryByDateRangeDataSet.FindToolHistoryByDateRange[intCounter].WarehouseEmployeeID;

                            TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intWarehouseEmployee);

                            strWarehouseEmployeeName = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName + " " + TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].LastName;

                            ViewToolHistoryDataSet.toolhistoryRow NewHistoryRow = TheViewToolHistoryDataSet.toolhistory.NewtoolhistoryRow();

                            NewHistoryRow.LastName          = TheFindToolHistoryByDateRangeDataSet.FindToolHistoryByDateRange[intCounter].LastName;
                            NewHistoryRow.Description       = TheFindToolHistoryByDateRangeDataSet.FindToolHistoryByDateRange[intCounter].ToolDescription;
                            NewHistoryRow.FirstName         = TheFindToolHistoryByDateRangeDataSet.FindToolHistoryByDateRange[intCounter].FirstName;
                            NewHistoryRow.ToolID            = TheFindToolHistoryByDateRangeDataSet.FindToolHistoryByDateRange[intCounter].ToolID;
                            NewHistoryRow.TransactionDate   = TheFindToolHistoryByDateRangeDataSet.FindToolHistoryByDateRange[intCounter].TransactionDate;
                            NewHistoryRow.TransactionID     = TheFindToolHistoryByDateRangeDataSet.FindToolHistoryByDateRange[intCounter].TransactionID;
                            NewHistoryRow.TransactionNotes  = TheFindToolHistoryByDateRangeDataSet.FindToolHistoryByDateRange[intCounter].TransactionNotes;
                            NewHistoryRow.WarehouseEmployee = strWarehouseEmployeeName;

                            TheViewToolHistoryDataSet.toolhistory.Rows.Add(NewHistoryRow);
                        }
                    }
                }
                else if (gstrToolHistoryType == "Employee Search")
                {
                    TheFindToolHistoryByEmployeeIDDataSet = TheToolHistoryClass.FindToolHistoryByEmployeeID(gdatStartDate, gdatEndDate, MainWindow.gintEmployeeID);

                    intNumberOfRecords = TheFindToolHistoryByEmployeeIDDataSet.FindToolHistoryByEmployeeID.Rows.Count - 1;

                    if (intNumberOfRecords > -1)
                    {
                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            intWarehouseEmployee = TheFindToolHistoryByEmployeeIDDataSet.FindToolHistoryByEmployeeID[intCounter].WarehouseEmployeeID;

                            TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intWarehouseEmployee);

                            strWarehouseEmployeeName = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName + " " + TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].LastName;

                            ViewToolHistoryDataSet.toolhistoryRow NewHistoryRow = TheViewToolHistoryDataSet.toolhistory.NewtoolhistoryRow();

                            NewHistoryRow.LastName          = TheFindToolHistoryByEmployeeIDDataSet.FindToolHistoryByEmployeeID[intCounter].LastName;
                            NewHistoryRow.Description       = TheFindToolHistoryByEmployeeIDDataSet.FindToolHistoryByEmployeeID[intCounter].ToolDescription;
                            NewHistoryRow.FirstName         = TheFindToolHistoryByEmployeeIDDataSet.FindToolHistoryByEmployeeID[intCounter].FirstName;
                            NewHistoryRow.ToolID            = TheFindToolHistoryByEmployeeIDDataSet.FindToolHistoryByEmployeeID[intCounter].ToolID;
                            NewHistoryRow.TransactionDate   = TheFindToolHistoryByEmployeeIDDataSet.FindToolHistoryByEmployeeID[intCounter].TransactionDate;
                            NewHistoryRow.TransactionID     = TheFindToolHistoryByEmployeeIDDataSet.FindToolHistoryByEmployeeID[intCounter].TransactionID;
                            NewHistoryRow.TransactionNotes  = TheFindToolHistoryByEmployeeIDDataSet.FindToolHistoryByEmployeeID[intCounter].TransactionNotes;
                            NewHistoryRow.WarehouseEmployee = strWarehouseEmployeeName;

                            TheViewToolHistoryDataSet.toolhistory.Rows.Add(NewHistoryRow);
                        }
                    }
                }
                else if (gstrToolHistoryType == "Tool ID Search")
                {
                    TheFindActiveToolByToolIDDataSet = TheToolsClass.FindActiveToolByToolID(strToolID);

                    intNumberOfRecords = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID.Rows.Count;

                    if (intNumberOfRecords == 0)
                    {
                        TheMessagesClass.ErrorMessage("The Tool is not Active or Does Not Exist");
                        return;
                    }

                    MainWindow.gintToolKey = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolKey;

                    TheFindToolHistoryByToolKeyDataSet = TheToolHistoryClass.FindToolHistoryByToolKey(gdatStartDate, gdatEndDate, MainWindow.gintToolKey);

                    intNumberOfRecords = TheFindToolHistoryByToolKeyDataSet.FindToolHistoryByToolKey.Rows.Count - 1;

                    if (intNumberOfRecords > -1)
                    {
                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            intWarehouseEmployee = TheFindToolHistoryByToolKeyDataSet.FindToolHistoryByToolKey[intCounter].WarehouseEmployeeID;

                            TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intWarehouseEmployee);

                            strWarehouseEmployeeName = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName + " " + TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].LastName;

                            ViewToolHistoryDataSet.toolhistoryRow NewHistoryRow = TheViewToolHistoryDataSet.toolhistory.NewtoolhistoryRow();

                            NewHistoryRow.LastName          = TheFindToolHistoryByToolKeyDataSet.FindToolHistoryByToolKey[intCounter].LastName;
                            NewHistoryRow.Description       = TheFindToolHistoryByToolKeyDataSet.FindToolHistoryByToolKey[intCounter].ToolDescription;
                            NewHistoryRow.FirstName         = TheFindToolHistoryByToolKeyDataSet.FindToolHistoryByToolKey[intCounter].FirstName;
                            NewHistoryRow.ToolID            = TheFindToolHistoryByToolKeyDataSet.FindToolHistoryByToolKey[intCounter].ToolID;
                            NewHistoryRow.TransactionDate   = TheFindToolHistoryByToolKeyDataSet.FindToolHistoryByToolKey[intCounter].TransactionDate;
                            NewHistoryRow.TransactionID     = TheFindToolHistoryByToolKeyDataSet.FindToolHistoryByToolKey[intCounter].TransactionID;
                            NewHistoryRow.TransactionNotes  = TheFindToolHistoryByToolKeyDataSet.FindToolHistoryByToolKey[intCounter].TransactionNotes;
                            NewHistoryRow.WarehouseEmployee = strWarehouseEmployeeName;

                            TheViewToolHistoryDataSet.toolhistory.Rows.Add(NewHistoryRow);
                        }
                    }
                }

                dgrResults.ItemsSource = TheViewToolHistoryDataSet.toolhistory;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Tool History // Find Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
示例#2
0
        private void expCreateReport_Expanded(object sender, RoutedEventArgs e)
        {
            int      intCounter;
            int      intNumberOfRecords;
            int      intWarehouseID;
            int      intRecordsReturned;
            int      intToolKey;
            DateTime datEndDate   = DateTime.Now;
            DateTime datStartDate = DateTime.Now;
            string   strWarehouse;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                intNumberOfRecords = TheFindActiveToolsDataSet.FindActiveTools.Rows.Count;

                TheWASPToolsDataSet.wasptools.Rows.Clear();

                datStartDate = TheDateSearchClass.SubtractingDays(datStartDate, 365);

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        intToolKey = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolKey;

                        TheFindToolHistoryByToolKeyDataSet = TheToolHistoryClass.FindToolHistoryByToolKey(datStartDate, datEndDate, intToolKey);

                        intRecordsReturned = TheFindToolHistoryByToolKeyDataSet.FindToolHistoryByToolKey.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            WASPToolsDataSet.wasptoolsRow NewToolRow = TheWASPToolsDataSet.wasptools.NewwasptoolsRow();

                            intWarehouseID = TheFindActiveToolsDataSet.FindActiveTools[intCounter].CurrentLocation;

                            TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intWarehouseID);

                            strWarehouse = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName;

                            NewToolRow.FirstName       = TheFindActiveToolsDataSet.FindActiveTools[intCounter].FirstName;
                            NewToolRow.LastName        = TheFindActiveToolsDataSet.FindActiveTools[intCounter].LastName;
                            NewToolRow.ToolCategory    = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolCategory;
                            NewToolRow.ToolDescription = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolDescription;
                            NewToolRow.ToolID          = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolID;
                            NewToolRow.ToolKey         = intToolKey;
                            NewToolRow.ToolNotes       = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolNotes;
                            NewToolRow.Site            = strWarehouse;
                            NewToolRow.TransactionDate = TheFindActiveToolsDataSet.FindActiveTools[intCounter].TransactionDate;

                            TheWASPToolsDataSet.wasptools.Rows.Add(NewToolRow);
                        }
                        else if (intRecordsReturned < 1)
                        {
                            WASPToolsDataSet.wasptoolsRow NewNoTransaction = TheNoWASPTransactionsDataSet.wasptools.NewwasptoolsRow();

                            intWarehouseID = TheFindActiveToolsDataSet.FindActiveTools[intCounter].CurrentLocation;

                            TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intWarehouseID);

                            strWarehouse = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName;

                            NewNoTransaction.FirstName       = TheFindActiveToolsDataSet.FindActiveTools[intCounter].FirstName;
                            NewNoTransaction.LastName        = TheFindActiveToolsDataSet.FindActiveTools[intCounter].LastName;
                            NewNoTransaction.ToolCategory    = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolCategory;
                            NewNoTransaction.ToolDescription = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolDescription;
                            NewNoTransaction.ToolID          = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolID;
                            NewNoTransaction.ToolKey         = intToolKey;
                            NewNoTransaction.ToolNotes       = TheFindActiveToolsDataSet.FindActiveTools[intCounter].ToolNotes;
                            NewNoTransaction.Site            = strWarehouse;
                            NewNoTransaction.TransactionDate = TheFindActiveToolsDataSet.FindActiveTools[intCounter].TransactionDate;

                            TheNoWASPTransactionsDataSet.wasptools.Rows.Add(NewNoTransaction);
                        }
                    }
                }

                dgrTools.ItemsSource = TheNoWASPTransactionsDataSet.wasptools;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Create WASP Tool Report // Create Report Expander " + Ex.Message);

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

            PleaseWait.Close();
        }