private void expProcess_Expanded(object sender, RoutedEventArgs e)
        {
            int    intCounter;
            int    intNumberOfRecords;
            int    intCategoryID;
            int    intRecordsReturned;
            string strCategory;
            bool   blnFatalError = false;

            try
            {
                expProcess.IsExpanded = false;

                TheFindSortedToolCategoryDataSet = TheToolCategoryClass.FindSortedToolCategory();

                intNumberOfRecords = TheFindSortedToolCategoryDataSet.FindSortedToolCategory.Rows.Count;

                for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                {
                    intCategoryID = TheFindSortedToolCategoryDataSet.FindSortedToolCategory[intCounter].CategoryID;
                    strCategory   = TheFindSortedToolCategoryDataSet.FindSortedToolCategory[intCounter].ToolCategory;

                    TheFindToolIDByCategoryDataSet = TheToolIDClass.FindToolIDByCategory(strCategory);

                    intRecordsReturned = TheFindToolIDByCategoryDataSet.FindToolIDByCategory.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        blnFatalError = TheToolIDClass.InsertNewToolIDForToolType(intCategoryID, "1000");

                        if (blnFatalError == true)
                        {
                            throw new Exception();
                        }
                    }
                }

                TheMessagesClass.InformationMessage("The Categories have been updated");

                TheToolIDDataSet = TheToolIDClass.GetToolIDInfo();

                dgrToolIDs.ItemsSource = TheToolIDDataSet.toolid;
            }
            catch (Exception Ex)
            {
                TheSendEmailClass.SendEventLog("New Blue Jay ERP // Add Tool Category ID // Process Button " + Ex.Message);

                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Tool Category ID // Process Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemplo n.º 2
0
        private void cboToolCategory_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //setting local variables
            int    intSelectedIndex;
            string strToolCategory;
            int    intRecordsReturned;

            try
            {
                intSelectedIndex = cboToolCategory.SelectedIndex - 1;

                if (intSelectedIndex > -1)
                {
                    gintCategoryID  = TheFindSortedToolCategoryDataSet.FindSortedToolCategory[intSelectedIndex].CategoryID;
                    strToolCategory = TheFindSortedToolCategoryDataSet.FindSortedToolCategory[intSelectedIndex].ToolCategory;

                    TheFindToolIDByCategoryDataSet = TheToolIDClass.FindToolIDByCategory(strToolCategory);

                    intRecordsReturned = TheFindToolIDByCategoryDataSet.FindToolIDByCategory.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        txtToolID.Text      = TheFindToolIDByCategoryDataSet.FindToolIDByCategory[0].ToolID;
                        gintTransactionID   = TheFindToolIDByCategoryDataSet.FindToolIDByCategory[0].TransactionID;
                        gblnNewToolCategory = false;
                    }
                    else
                    {
                        txtToolID.Text = "None Found";
                        TheMessagesClass.InformationMessage("There is not a Tool ID for this Tool in the Database, Please Look at Old Tool Spreadsheet");
                        gblnNewToolCategory = true;
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Create Tool // Tool Category Selection Changed " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemplo n.º 3
0
        private void cboAssetCategory_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //setting local variables
            int    intSelectedIndex;
            int    intRecordsReturned;
            string strToolID;
            bool   blnToolExists;
            bool   blnStringID;
            int    intToolID;
            bool   blnFatalError = false;
            string strBJCAssetID;

            try
            {
                intSelectedIndex = cboAssetCategory.SelectedIndex - 1;

                if ((intSelectedIndex > -1) && (gblnUploaded == true))
                {
                    strBJCAssetID = txtBJCAssetID.Text;

                    if (strBJCAssetID.Length < 4)
                    {
                        MainWindow.gintCategoryID = TheFindSortedToolCategoryDataSet.FindSortedToolCategory[intSelectedIndex].CategoryID;
                        gstrAssetCategory         = TheFindSortedToolCategoryDataSet.FindSortedToolCategory[intSelectedIndex].ToolCategory;

                        TheFindToolIDByCategoryDataSet = TheToolIDClass.FindToolIDByCategory(gstrAssetCategory);

                        intRecordsReturned = TheFindToolIDByCategoryDataSet.FindToolIDByCategory.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            blnToolExists = true;

                            strToolID         = TheFindToolIDByCategoryDataSet.FindToolIDByCategory[0].ToolID;
                            gintTransactionID = TheFindToolIDByCategoryDataSet.FindToolIDByCategory[0].TransactionID;

                            blnStringID = TheDataValidationClass.VerifyIntegerData(strToolID);

                            if (blnStringID == true)
                            {
                                txtBJCAssetID.Text = strToolID;
                            }
                            else if (blnStringID == false)
                            {
                                while (blnToolExists == true)
                                {
                                    intToolID = Convert.ToInt32(strToolID);

                                    intToolID = intToolID + 1;

                                    strToolID = Convert.ToString(intToolID);

                                    blnFatalError = TheToolIDClass.UpdateToolID(gintTransactionID, strToolID);

                                    TheFindActiveToolByToolIDDataSet = TheToolsClass.FindActiveToolByToolID(strToolID);

                                    intRecordsReturned = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID.Rows.Count;

                                    if (intRecordsReturned < 1)
                                    {
                                        TheFindWaspAsssetByBJCAssetIDDataSet = TheAssetClass.FindWaspAssetByBJCAssetID(strToolID);

                                        intRecordsReturned = TheFindWaspAsssetByBJCAssetIDDataSet.FindWaspAssetByBJCAssetID.Rows.Count;

                                        if (intRecordsReturned < 1)
                                        {
                                            blnToolExists = false;
                                        }
                                    }
                                }
                            }

                            txtBJCAssetID.Text = strToolID;
                        }
                        else
                        {
                            txtBJCAssetID.Text = "None Found";
                            TheMessagesClass.InformationMessage("There is not a Tool ID for this Tool in the Database, Please Look at Old Tool Spreadsheet");
                        }
                    }
                    else if (strBJCAssetID.Length > 3)
                    {
                        gstrAssetCategory         = TheFindSortedToolCategoryDataSet.FindSortedToolCategory[intSelectedIndex].ToolCategory;
                        MainWindow.gintCategoryID = TheFindSortedToolCategoryDataSet.FindSortedToolCategory[intSelectedIndex].CategoryID;
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Edit Wasp Asset // Tool Category Selection Changed " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemplo n.º 4
0
        private void cboSelectToolCategory_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //setting local variables
            int    intSelectedIndex;
            string strToolCategory;
            int    intRecordsReturned;
            string strToolID;
            int    intToolID;
            bool   blnToolFound;

            try
            {
                intSelectedIndex = cboSelectToolCategory.SelectedIndex - 1;

                if (intSelectedIndex > -1)
                {
                    MainWindow.gintCategoryID = TheFindSortedToolCategoryDataSet.FindSortedToolCategory[intSelectedIndex].CategoryID;
                    strToolCategory           = TheFindSortedToolCategoryDataSet.FindSortedToolCategory[intSelectedIndex].ToolCategory;

                    TheFindToolIDByCategoryDataSet = TheToolIDClass.FindToolIDByCategory(strToolCategory);

                    intRecordsReturned = TheFindToolIDByCategoryDataSet.FindToolIDByCategory.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        blnToolFound = true;

                        while (blnToolFound == true)
                        {
                            strToolID = TheFindToolIDByCategoryDataSet.FindToolIDByCategory[0].ToolID;

                            intToolID = Convert.ToInt32(strToolID);

                            intToolID++;

                            strToolID = Convert.ToString(intToolID);

                            TheFindActiveToolByToolIDDataSet = TheToolsClass.FindActiveToolByToolID(strToolID);

                            intRecordsReturned = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID.Rows.Count;

                            if (intRecordsReturned < 1)
                            {
                                blnToolFound = false;
                            }

                            txtToolID.Text      = strToolID;
                            gintTransactionID   = TheFindToolIDByCategoryDataSet.FindToolIDByCategory[0].TransactionID;
                            gblnNewToolCategory = false;
                        }
                    }
                    else
                    {
                        txtToolID.Text = "None Found";
                        TheMessagesClass.InformationMessage("There is not a Tool ID for this Tool in the Database, Please Contact IT");
                        gblnNewToolCategory = true;
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add New Tool // Tool Category Selection Changed " + Ex.Message);

                TheSendEmailClass.SendEventLog(Ex.ToString());

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