private void btnFind_Click(object sender, RoutedEventArgs e)
        {
            //setting the local varialbes
            int intRecordsReturned;

            gstrToolID = txtEnterToolID.Text;

            //getting the tool information
            TheFindActiveToolByToolIDDataSet = TheToolClass.FindActiveToolByToolID(gstrToolID);

            intRecordsReturned = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID.Rows.Count;

            TheImportDocumentsDataSet.documents.Rows.Clear();

            dgrDocument.ItemsSource = TheImportDocumentsDataSet.documents;

            if (intRecordsReturned == 0)
            {
                TheMessagesClass.ErrorMessage("The Tool Was Not Found");
                return;
            }
            else if (intRecordsReturned > 0)
            {
                txtCost.Text            = Convert.ToString(TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolCost);
                txtToolDescription.Text = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolDescription;
                MainWindow.gintToolKey  = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolKey;
            }
        }
Ejemplo n.º 2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //setting up the variables
            string strToolID;
            int    intRecordsReturned;

            strToolID = txtEnterToolID.Text;
            if (strToolID == "")
            {
                TheMessagesClass.ErrorMessage("The Tool ID Was Not Entered");
                return;
            }

            TheFindActiveToolByToolIDDataSet = TheToolsClass.FindActiveToolByToolID(strToolID);

            intRecordsReturned = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID.Rows.Count;

            if (intRecordsReturned == 0)
            {
                TheMessagesClass.InformationMessage("Tool ID Was Not Found");
                return;
            }

            if (TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].Available == true)
            {
                TheMessagesClass.InformationMessage("Tool Is Already Signed In");
                return;
            }

            MainWindow.gintToolKey  = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolKey;
            txtDescription.Text     = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolDescription;
            txtFirstName.Text       = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].FirstName;
            txtLastName.Text        = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].LastName;
            mitSignInTool.IsEnabled = true;
        }
Ejemplo n.º 3
0
        private void btnFindTool_Click(object sender, RoutedEventArgs e)
        {
            //this will find the tool
            string strToolID;
            int    intRecordsReturned;
            int    intWarehouseID;
            string strCategory;

            try
            {
                strToolID = txtToolID.Text;
                if (strToolID == "")
                {
                    TheMessagesClass.ErrorMessage("Tool ID Not Entered");
                    return;
                }

                TheFindToolByToolIDDataSet = TheToolsClass.FindActiveToolByToolID(strToolID);

                intRecordsReturned = TheFindToolByToolIDDataSet.FindActiveToolByToolID.Rows.Count;

                if (intRecordsReturned == 0)
                {
                    TheMessagesClass.ErrorMessage("No Tools Found");
                    return;
                }

                txtToolCost.Text        = Convert.ToString(TheFindToolByToolIDDataSet.FindActiveToolByToolID[0].ToolCost);
                txtToolDescription.Text = TheFindToolByToolIDDataSet.FindActiveToolByToolID[0].ToolDescription;
                txtToolPartNumber.Text  = TheFindToolByToolIDDataSet.FindActiveToolByToolID[0].PartNumber;
                txtToolNotes.Text       = TheFindToolByToolIDDataSet.FindActiveToolByToolID[0].ToolNotes;
                MainWindow.gintToolKey  = TheFindToolByToolIDDataSet.FindActiveToolByToolID[0].ToolKey;
                strCategory             = TheFindToolByToolIDDataSet.FindActiveToolByToolID[0].ToolCategory;

                intWarehouseID = TheFindToolByToolIDDataSet.FindActiveToolByToolID[0].CurrentLocation;

                cboSelectWarehouse.IsEnabled = true;

                FindToolCategory(strCategory);

                FindWarehouse(intWarehouseID);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Edit Tools // Find Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 4
0
        public FindActiveToolByToolIDDataSet FindActiveToolByToolID(string strToolID)
        {
            try
            {
                aFindActiveToolByToolIDDataSet      = new FindActiveToolByToolIDDataSet();
                aFindActiveToolByToolIDTableAdapter = new FindActiveToolByToolIDDataSetTableAdapters.FindActiveToolByToolIDTableAdapter();
                aFindActiveToolByToolIDTableAdapter.Fill(aFindActiveToolByToolIDDataSet.FindActiveToolByToolID, strToolID);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Tools Class // Find Active Tool By Tool ID " + Ex.Message);
            }

            return(aFindActiveToolByToolIDDataSet);
        }
Ejemplo n.º 5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                TheFindActiveToolByToolIDDataSet = TheToolsClass.FindActiveToolByToolID(MainWindow.gstrToolID);

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

                txtToolID.Text      = MainWindow.gstrToolID;
                txtDescription.Text = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolDescription;
                txtFirstName.Text   = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].FirstName;
                txtLastName.Text    = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].LastName;

                MainWindow.gblnToolSignedIn = false;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Sign Tool In From Form // Window Loaded " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 6
0
        private void btnImportExcel_Click(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            int    intRecordsReturned;
            int    intAssetID;
            string strAssetDescription;
            string strLocation;
            string strSerialNumber;
            string strAssetType;
            string strBJCNumber;
            bool   blnFatalError   = false;
            string strErrorMessage = "";
            bool   blnItemFound;
            int    intTransactionID;
            string strModel;
            string strManufacturer;

            try
            {
                TheImportWaspToolAssetsDataSet.importassets.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                strLocation = txtEnterLocation.Text;
                if (strLocation.Length < 2)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Location is not long Enough\n";
                }
                else
                {
                    TheFindWaspAssetLocationByLocationDataSet = TheAssetClass.FindWaspAssetLocationByLocation(strLocation);

                    intRecordsReturned = TheFindWaspAssetLocationByLocationDataSet.FindWaspAssetLocationByLocation.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "There is no Such Location\n";
                    }
                }
                if (cboSelectLocation.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Site Has Not Been Selected\n";
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 1; intCounter <= intNumberOfRecords; intCounter++)
                {
                    TheWaspAssetIDDataSet = TheAssetClass.GetWaspAssetIDInfo();

                    intAssetID       = TheWaspAssetIDDataSet.waspassetid[0].CreatedAssetID;
                    intTransactionID = TheWaspAssetIDDataSet.waspassetid[0].TransactionID;

                    blnFatalError = TheAssetClass.UpdateWaspAssetID(intTransactionID, intAssetID + 1);

                    blnItemFound = false;
                    strAssetType = "UNKNOWN";

                    if (((range.Cells[intCounter, 2] as Excel.Range).Value2) == null)
                    {
                        intCounter = intNumberOfRecords;
                        break;
                    }
                    else
                    {
                        strAssetDescription = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();

                        if (((range.Cells[intCounter, 3] as Excel.Range).Value2) == null)
                        {
                            strSerialNumber = " ";
                        }
                        else
                        {
                            strSerialNumber = Convert.ToString((range.Cells[intCounter, 3] as Excel.Range).Value2).ToUpper();
                        }
                        if (((range.Cells[intCounter, 4] as Excel.Range).Value2) == null)
                        {
                            strBJCNumber = " ";
                        }
                        else
                        {
                            strBJCNumber = Convert.ToString((range.Cells[intCounter, 4] as Excel.Range).Value2).ToUpper();
                        }

                        if (strSerialNumber.Length > 2)
                        {
                            TheFindWaspAssetBySerialNumberDataSet = TheAssetClass.FindWaspAssetsBySerialNumber(strSerialNumber);

                            intRecordsReturned = TheFindWaspAssetBySerialNumberDataSet.FindWaspAssetsBySerialNumber.Rows.Count;

                            if (intRecordsReturned > 0)
                            {
                                blnItemFound = true;
                            }
                        }
                        if (strBJCNumber.Length > 2)
                        {
                            TheFindWaspAssetByBJCAssetIDDataSet = TheAssetClass.FindWaspAssetByBJCAssetID(strBJCNumber);

                            intRecordsReturned = TheFindWaspAssetByBJCAssetIDDataSet.FindWaspAssetByBJCAssetID.Rows.Count;

                            if (intRecordsReturned > 0)
                            {
                                blnItemFound = true;
                            }
                        }
                    }

                    if (blnItemFound == false)
                    {
                        if (strBJCNumber.Length > 2)
                        {
                            TheFindActiveToolByToolIDDataSet = TheToolClass.FindActiveToolByToolID(strBJCNumber);

                            intRecordsReturned = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID.Rows.Count;

                            if (intRecordsReturned > 0)
                            {
                                strAssetType        = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolCategory;
                                strAssetDescription = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolDescription;
                            }
                        }

                        ImportWaspToolAssetsDataSet.importassetsRow NewAssetRow = TheImportWaspToolAssetsDataSet.importassets.NewimportassetsRow();

                        NewAssetRow.AssetDescription = strAssetDescription;
                        NewAssetRow.AssetID          = intAssetID;
                        NewAssetRow.AssetType        = strAssetType;
                        NewAssetRow.Location         = strLocation;
                        NewAssetRow.Manufacturer     = "UNKNOWN";
                        NewAssetRow.Model            = "UNKNOWN";
                        NewAssetRow.SerialNumber     = strSerialNumber;
                        NewAssetRow.Site             = gstrSite;
                        NewAssetRow.WarehouseID      = MainWindow.gintWarehouseID;
                        NewAssetRow.BJCAssetID       = strBJCNumber;

                        TheImportWaspToolAssetsDataSet.importassets.Rows.Add(NewAssetRow);
                    }
                }

                intNumberOfRecords = TheImportWaspToolAssetsDataSet.importassets.Rows.Count;

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        strAssetDescription = TheImportWaspToolAssetsDataSet.importassets[intCounter].AssetDescription;
                        strAssetType        = TheImportWaspToolAssetsDataSet.importassets[intCounter].AssetType;
                        intAssetID          = TheImportWaspToolAssetsDataSet.importassets[intCounter].AssetID;
                        strBJCNumber        = TheImportWaspToolAssetsDataSet.importassets[intCounter].BJCAssetID;
                        strLocation         = TheImportWaspToolAssetsDataSet.importassets[intCounter].Location;
                        strManufacturer     = TheImportWaspToolAssetsDataSet.importassets[intCounter].Manufacturer;
                        strModel            = TheImportWaspToolAssetsDataSet.importassets[intCounter].Model;
                        strSerialNumber     = TheImportWaspToolAssetsDataSet.importassets[intCounter].SerialNumber;

                        blnFatalError = TheAssetClass.InsertWaspAssets(intAssetID, strAssetDescription, strBJCNumber, strAssetType, gstrSite, strLocation, MainWindow.gintWarehouseID, DateTime.Now, strSerialNumber, strManufacturer, strModel);

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

                PleaseWait.Close();

                dgrAssets.ItemsSource = TheImportWaspToolAssetsDataSet.importassets;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Vehicle Assets // Import Excel  " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 7
0
        private void expRemoveAsset_Expanded(object sender, RoutedEventArgs e)
        {
            bool   blnFatalError = false;
            string strToolID;
            int    intToolKey;
            int    intRecordsReturned;

            try
            {
                const string     message = "Are You Sure You Want To Remove This Asset?";
                const string     caption = "Are You Sure";
                MessageBoxResult result  = MessageBox.Show(message, caption, MessageBoxButton.YesNo, MessageBoxImage.Question);

                if (result == MessageBoxResult.Yes)
                {
                    blnFatalError = TheAssetClass.DeleteWaspAsset(MainWindow.gintAssetID);

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

                    const string     secmessage = "Are You Sure You Want To Remove This From The Tool Table?";
                    const string     seccaption = "Are You Sure";
                    MessageBoxResult secresult  = MessageBox.Show(secmessage, seccaption, MessageBoxButton.YesNo, MessageBoxImage.Question);

                    if (secresult == MessageBoxResult.Yes)
                    {
                        strToolID = txtBJCAssetID.Text;
                        if (strToolID.Length > 3)
                        {
                            TheFindActiveToolByToolIDDataSet = TheToolsClass.FindActiveToolByToolID(strToolID);

                            intRecordsReturned = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID.Rows.Count;

                            if (intRecordsReturned > 0)
                            {
                                intToolKey = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolKey;

                                blnFatalError = TheToolsClass.DeleteTool(intToolKey);

                                if (blnFatalError == true)
                                {
                                    throw new Exception();
                                }
                            }
                            else if (intRecordsReturned < 1)
                            {
                                TheMessagesClass.ErrorMessage("The Tool Was Not Found");
                            }
                        }
                    }

                    TheMessagesClass.InformationMessage("The Asset Has Been Deleted");

                    this.Close();
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Edit Wasp Asset // Remove Asset Expander " + Ex.Message);
            }
        }
Ejemplo n.º 8
0
        private void btnProcess_Click(object sender, RoutedEventArgs e)
        {
            //setting up the local variables;
            bool    blnFatalError   = false;
            string  strErrorMessage = "";
            string  strDescription;
            string  strBJCAssetID;
            string  strSerialNumber;
            string  strManufacturer;
            string  strModel;
            int     intRecordsReturned;
            bool    blnItemExists      = false;
            int     intToolKey         = 0;
            string  strPartNumber      = "";
            int     intCurrentLocation = 0;
            decimal decPartCost        = 0;
            string  strToolNotes       = "";

            try
            {
                strDescription = txtDescription.Text;
                if (strDescription.Length < 6)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Description is to Short\n";
                }
                if (cboAssetCategory.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Category Was Not Selected\n";
                }
                strBJCAssetID = txtBJCAssetID.Text;
                if (strBJCAssetID.Length < 4)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The BJC Asset ID is to Short\n";
                }
                else
                {
                    TheFindActiveToolByToolIDDataSet = TheToolsClass.FindActiveToolByToolID(strBJCAssetID);

                    intRecordsReturned = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        blnItemExists      = true;
                        intToolKey         = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolKey;
                        strPartNumber      = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].PartNumber;
                        intCurrentLocation = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].CurrentLocation;
                        decPartCost        = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolCost;
                        strToolNotes       = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolNotes;
                    }
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);

                    return;
                }

                strSerialNumber = txtSerialNo.Text;
                strManufacturer = txtManufacturer.Text;
                strModel        = txtModel.Text;

                blnFatalError = TheAssetClass.UpdateWaspAsset(MainWindow.gintAssetID, strDescription, gstrAssetCategory, strBJCAssetID, strSerialNumber, strManufacturer, strModel);

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

                if (blnItemExists == false)
                {
                    blnFatalError = TheToolsClass.InsertTools(strBJCAssetID, MainWindow.gintWarehouseID, strSerialNumber, MainWindow.gintCategoryID, strDescription, 0, MainWindow.gintWarehouseID);

                    if (blnFatalError == true)
                    {
                        throw new Exception();
                    }
                }
                else if (blnItemExists == true)
                {
                    blnFatalError = TheToolsClass.UpdateToolActive(intToolKey, true);

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

                    blnFatalError = TheToolsClass.UpdateToolCategory(intToolKey, MainWindow.gintCategoryID);

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

                    blnFatalError = TheToolsClass.UpdateToolInfo(intToolKey, strPartNumber, strDescription, intCurrentLocation, decPartCost, strToolNotes);

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

                TheMessagesClass.InformationMessage("The Asset has been Updated");

                this.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Edit Wasp Asset // Process Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 9
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());
            }
        }
Ejemplo n.º 10
0
        private void cboSelectLocation_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            int    intRecordsReturned;
            int    intAssetID;
            string strAssetDescription;
            string strSerialNumber;
            string strAssetType;
            string strBJCNumber;
            string strFirstName;
            string strLastName;
            bool   blnFatalError = false;
            bool   blnItemFound;
            int    intTransactionID;
            int    intSelectedIndex;
            int    intEmployeeID;

            try
            {
                intSelectedIndex = cboSelectLocation.SelectedIndex - 1;

                if (intSelectedIndex > -1)
                {
                    TheEmployeeToolAssetDataSet.employeetoolassets.Rows.Clear();

                    Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                    dlg.FileName   = "Document";             // Default file name
                    dlg.DefaultExt = ".xlsx";                // Default file extension
                    dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                    // Show open file dialog box
                    Nullable <bool> result = dlg.ShowDialog();

                    // Process open file dialog box results
                    if (result == true)
                    {
                        // Open document
                        string filename = dlg.FileName;
                    }

                    PleaseWait PleaseWait = new PleaseWait();
                    PleaseWait.Show();


                    gstrLocation = TheFindSortedWaspAssetLocationsBySiteDataSet.FindSortedWaspAssetLoctionsBySite[intSelectedIndex].AssetLocation;

                    xlDropOrder = new Excel.Application();
                    xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                    xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                    range = xlDropSheet.UsedRange;
                    intNumberOfRecords = range.Rows.Count;
                    intColumnRange     = range.Columns.Count;

                    for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        TheWaspAssetIDDataSet = TheAssetClass.GetWaspAssetIDInfo();

                        intAssetID       = TheWaspAssetIDDataSet.waspassetid[0].CreatedAssetID;
                        intTransactionID = TheWaspAssetIDDataSet.waspassetid[0].TransactionID;

                        blnFatalError = TheAssetClass.UpdateWaspAssetID(intTransactionID, intAssetID + 1);

                        blnItemFound = false;
                        strAssetType = "UNKNOWN";

                        if (((range.Cells[intCounter, 1] as Excel.Range).Value2) == null)
                        {
                            intCounter = intNumberOfRecords;
                            break;
                        }
                        else
                        {
                            strAssetDescription = Convert.ToString((range.Cells[intCounter, 3] as Excel.Range).Value2).ToUpper();

                            if (((range.Cells[intCounter, 2] as Excel.Range).Value2) == null)
                            {
                                strBJCNumber = " ";
                            }
                            else
                            {
                                strBJCNumber = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();
                            }
                            if (((range.Cells[intCounter, 5] as Excel.Range).Value2) == null)
                            {
                                strSerialNumber = " ";
                            }
                            else
                            {
                                strSerialNumber = Convert.ToString((range.Cells[intCounter, 5] as Excel.Range).Value2).ToUpper();
                            }
                            if (((range.Cells[intCounter, 4] as Excel.Range).Value2) == null)
                            {
                                strAssetType = " ";
                            }
                            else
                            {
                                strAssetType = Convert.ToString((range.Cells[intCounter, 4] as Excel.Range).Value2).ToUpper();
                            }

                            strFirstName = Convert.ToString((range.Cells[intCounter, 8] as Excel.Range).Value2).ToUpper();
                            strLastName  = Convert.ToString((range.Cells[intCounter, 9] as Excel.Range).Value2).ToUpper();

                            if (strSerialNumber.Length > 2)
                            {
                                TheFindWaspAssetBySerialNumberDataSet = TheAssetClass.FindWaspAssetsBySerialNumber(strSerialNumber);

                                intRecordsReturned = TheFindWaspAssetBySerialNumberDataSet.FindWaspAssetsBySerialNumber.Rows.Count;

                                if (intRecordsReturned > 0)
                                {
                                    blnItemFound = true;
                                }
                            }
                            if (strBJCNumber.Length > 2)
                            {
                                TheFindWaspAssetByBJCAssetIDDataSet = TheAssetClass.FindWaspAssetByBJCAssetID(strBJCNumber);

                                intRecordsReturned = TheFindWaspAssetByBJCAssetIDDataSet.FindWaspAssetByBJCAssetID.Rows.Count;

                                if (intRecordsReturned > 0)
                                {
                                    blnItemFound = true;
                                }
                            }
                        }

                        if (blnItemFound == false)
                        {
                            if (strBJCNumber.Length > 2)
                            {
                                TheFindActiveToolByToolIDDataSet = TheToolClass.FindActiveToolByToolID(strBJCNumber);

                                intRecordsReturned = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID.Rows.Count;

                                if (intRecordsReturned > 0)
                                {
                                    strAssetType        = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolCategory;
                                    strAssetDescription = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolDescription;
                                }
                            }
                        }

                        TheComboEmployeeDataSet = TheEmployeeClass.FillEmployeeComboBox(strLastName);

                        EmployeeToolAssetDataSet.employeetoolassetsRow NewToolRow = TheEmployeeToolAssetDataSet.employeetoolassets.NewemployeetoolassetsRow();

                        NewToolRow.AssetID         = intAssetID;
                        NewToolRow.BJCAssetID      = strBJCNumber;
                        NewToolRow.EmployeeID      = TheComboEmployeeDataSet.employees[0].EmployeeID;
                        NewToolRow.FirstName       = strFirstName;
                        NewToolRow.LastName        = strLastName;
                        NewToolRow.Office          = gstrSite;
                        NewToolRow.ToolLocation    = gstrLocation;
                        NewToolRow.ToolCategory    = strAssetType;
                        NewToolRow.ToolDescription = strAssetDescription;

                        TheEmployeeToolAssetDataSet.employeetoolassets.Rows.Add(NewToolRow);
                    }

                    xlDropOrder.Quit();
                    PleaseWait.Close();
                }


                dgrAssets.ItemsSource = TheEmployeeToolAssetDataSet.employeetoolassets;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Vehicle Assets // Import Excel  " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 11
0
        private void mitCreateTool_Click(object sender, RoutedEventArgs e)
        {
            //creating local variables
            int     intSelectedIndex;
            string  strValueForValidation;
            string  strPartNumber;
            string  strDescription;
            string  strToolID;
            decimal decToolCost        = 0;
            string  strErrorMessage    = "";
            bool    blnThereIsAProblem = false;
            bool    blnFatalError      = false;
            int     intRecordsReturned;

            try
            {
                //data validation
                intSelectedIndex = cboSelectWarehouse.SelectedIndex;
                if (intSelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Warehouse Was Not Selected\n";
                }
                intSelectedIndex = cboToolCategory.SelectedIndex;
                if (intSelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Tool Category Was Not Selected\n";
                }
                strToolID = txtToolID.Text;
                if (strToolID == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "Tool ID Was Not Entered\n";
                }
                else
                {
                    TheFindActiveToolByToolIdDataSet = TheToolsClass.FindActiveToolByToolID(strToolID);

                    intRecordsReturned = TheFindActiveToolByToolIdDataSet.FindActiveToolByToolID.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "There is Already an Active Tool With This ID\n";
                    }
                }
                strPartNumber = txtPartNumber.Text;
                if (strPartNumber == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Tool Part Number Was Not Added\n";
                }
                strDescription = txtDescription.Text;
                if (strDescription == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Tool Description Was Not Added\n";
                }
                strValueForValidation = txtPartCost.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDoubleData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Tool Cost is not Numeric\n";
                }
                else
                {
                    decToolCost = Convert.ToDecimal(strValueForValidation);
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                if (gblnNewToolCategory == true)
                {
                    blnFatalError = TheToolIDClass.InsertNewToolIDForToolType(gintCategoryID, strToolID);

                    if (blnFatalError == true)
                    {
                        throw new Exception();
                    }
                }
                else if (gblnNewToolCategory == false)
                {
                    blnFatalError = TheToolIDClass.UpdateToolID(gintTransactionID, strToolID);

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

                blnFatalError = TheToolsClass.InsertTools(strToolID, gintWarehouseID, strPartNumber, gintCategoryID, strDescription, decToolCost, gintWarehouseID);

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

                ResetControls();

                TheMessagesClass.InformationMessage("The Tool Has Been Created");
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Create Tool // Create Tool Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 12
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());
            }
        }
Ejemplo n.º 13
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //this will load up the controls
            int    intCounter;
            int    intNumberOfRecords;
            int    intRecordsReturned;
            string strCategory;

            try
            {
                TheFindSortedToolCategoryDataSet = TheToolCategoryClass.FindSortedToolCategory();
                gblnItemEntered = false;

                intNumberOfRecords = TheFindSortedToolCategoryDataSet.FindSortedToolCategory.Rows.Count;
                cboSelectToolCategory.Items.Clear();
                cboSelectToolCategory.Items.Add("Select Tool Category");

                cboSelectEmployee.Items.Clear();

                for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                {
                    cboSelectToolCategory.Items.Add(TheFindSortedToolCategoryDataSet.FindSortedToolCategory[intCounter].ToolCategory);
                }

                cboSelectToolCategory.SelectedIndex = 0;

                txtAssetID.Text         = Convert.ToString(MainWindow.gintAssetID);
                txtSite.Text            = ImportToolSheets.gstrSite;
                txtLocation.Text        = ImportToolSheets.gstrLocation;
                txtBJCAssetID.Text      = ImportToolSheets.gstrBJCAssetID;
                txtLastName.Text        = ImportToolSheets.gstrLastName;
                txtToolDescription.Text = ImportToolSheets.gstrToolDescription;

                TheFindActiveToolByToolIDDataSet = TheToolClass.FindActiveToolByToolID(ImportToolSheets.gstrBJCAssetID);

                intRecordsReturned = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    intNumberOfRecords = TheFindSortedToolCategoryDataSet.FindSortedToolCategory.Rows.Count;

                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        strCategory = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolCategory;

                        if (strCategory == TheFindSortedToolCategoryDataSet.FindSortedToolCategory[intCounter].ToolCategory)
                        {
                            cboSelectToolCategory.SelectedIndex = intCounter + 1;
                            txtPartNumber.Text      = "NOT NEEDED";
                            gblnItemEntered         = true;
                            txtToolNotes.Text       = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolNotes;
                            txtToolDescription.Text = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolDescription;
                            MainWindow.gintToolKey  = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolKey;
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Assign Tool Asset // Window Loaded Method " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 14
0
        private void btnProcess_Click(object sender, RoutedEventArgs e)
        {
            string strPartNumber;
            string strSerialNumber = "";
            string strToolNotes;
            bool   blnFatalError   = false;
            string strErrorMessage = "";
            int    intRecordsReturned;
            int    intToolKey;
            int    intEmployeeID;

            try
            {
                intEmployeeID = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID;

                if (cboSelectToolCategory.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Tool Category was not Selected\n";
                }
                ImportToolSheets.gstrBJCAssetID = txtBJCAssetID.Text;
                if (ImportToolSheets.gstrBJCAssetID.Length < 4)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The BJC Number Was Not Assigned\n";
                }
                ImportToolSheets.gstrToolDescription = txtToolDescription.Text;
                if (ImportToolSheets.gstrToolDescription.Length < 10)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Tool Description was not Long Enough\n";
                }
                if (cboSelectEmployee.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Employee Was Not Selected\n";
                }
                strPartNumber = txtPartNumber.Text;
                if (strPartNumber.Length < 4)
                {
                    strPartNumber = "";
                }
                strToolNotes = txtToolNotes.Text;
                if (strToolNotes.Length < 10)
                {
                    strToolNotes = "NO NOTES ENTERED";
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                TheFindActiveToolByToolIDDataSet = TheToolClass.FindActiveToolByToolID(ImportToolSheets.gstrBJCAssetID);

                intRecordsReturned = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID.Rows.Count;

                if (intRecordsReturned < 1)
                {
                    blnFatalError = TheToolClass.InsertTools(ImportToolSheets.gstrBJCAssetID, MainWindow.gintEmployeeID, strPartNumber, MainWindow.gintCategoryID, ImportToolSheets.gstrToolDescription, 0, MainWindow.gintWarehouseID);

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

                    TheFindActiveToolByToolIDDataSet = TheToolClass.FindActiveToolByToolID(ImportToolSheets.gstrBJCAssetID);
                }

                intToolKey = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolKey;

                blnFatalError = TheToolClass.UpdateToolSignOut(intToolKey, MainWindow.gintEmployeeID, false);

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

                blnFatalError = TheToolHistoryClass.InsertToolHistory(intToolKey, MainWindow.gintEmployeeID, intEmployeeID, "ASSIGNED FROM TOOL SHEEET DURING WASP ASSET IMPORT");

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

                TheFindWaspAssetByBJCAssetIDDataSet = TheAssetClass.FindWaspAssetByBJCAssetID(ImportToolSheets.gstrBJCAssetID);

                intRecordsReturned = TheFindWaspAssetByBJCAssetIDDataSet.FindWaspAssetByBJCAssetID.Rows.Count;

                if (intRecordsReturned < 1)
                {
                    blnFatalError = TheAssetClass.InsertWaspAssets(MainWindow.gintAssetID, ImportToolSheets.gstrToolDescription, ImportToolSheets.gstrBJCAssetID, ImportToolSheets.gstrToolCategory, ImportToolSheets.gstrSite, ImportToolSheets.gstrLocation, MainWindow.gintWarehouseID, DateTime.Now, strSerialNumber, " ", " ");

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

                TheMessagesClass.InformationMessage("The Tool Has Been Updated and Imported");

                this.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Assigned Tool Asset // Process Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 15
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());
            }
        }
Ejemplo n.º 16
0
        private void btnProcess_Click(object sender, RoutedEventArgs e)
        {
            //SETTING UP LOCAL VARIABLES
            int      intAssetID;
            DateTime datTransactionDate = DateTime.Now;
            string   strDescription;
            string   strBJCAssetID;
            string   strSite;
            string   strLocation;
            string   strSerialNumber;
            string   strManufacturer;
            string   strModel;
            string   strErrorMessage = "";
            bool     blnFatalError   = false;
            int      intRecordsReturned;
            int      intEmployeeID;

            try
            {
                intEmployeeID  = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID;
                intAssetID     = Convert.ToInt32(txtAssetID.Text);
                strDescription = txtDescription.Text;
                if (strDescription.Length < 10)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Description is not Long Enough\n";
                }
                if (cboAssetCategory.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Category was not Selected\n";
                }
                strBJCAssetID = txtBJCAssetID.Text;
                if (strBJCAssetID.Length < 3)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The BJC Asset ID is not Long Enough\n";
                }
                else
                {
                    TheFindActiveToolByToolIDDataSet = TheToolsClass.FindActiveToolByToolID(strBJCAssetID);

                    intRecordsReturned = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The BJC Asset ID Is Already in the Data Base\n";
                    }
                }
                strSite         = txtSite.Text;
                strSerialNumber = txtSerialNo.Text;
                strManufacturer = txtManufacturer.Text;
                strModel        = txtModel.Text;

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

                blnFatalError = TheAssetClass.InsertWaspAssets(intAssetID, strDescription, strBJCAssetID, gstrAssetCategory, strSite, MainWindow.gstrAssetLocation, MainWindow.gintWarehouseID, datTransactionDate, strSerialNumber, strManufacturer, strModel);

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

                if (gblnTool == true)
                {
                    blnFatalError = TheToolsClass.InsertTools(strBJCAssetID, MainWindow.gintWarehouseID, " ", MainWindow.gintCategoryID, strDescription, 0, MainWindow.gintWarehouseID);

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


                TheMessagesClass.InformationMessage("The Asset Has Been Added");

                this.Close();
            }
            catch (Exception Ex)
            {
                TheSendEmailClass.SendEventLog("New Blue Jay ERP // Add Wasp Asset // Process Button " + Ex.Message);

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

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 17
0
        private void btnFind_Click(object sender, RoutedEventArgs e)
        {
            //setting up local variables
            string strToolID;
            int    intRecordsReturned;
            string strMessage;
            string strCaption;

            try
            {
                strToolID = txtEnterToolID.Text;
                if (strToolID == "")
                {
                    TheMessagesClass.ErrorMessage("Tool ID Was Not Entered");
                    return;
                }

                TheFindActiveToolByToolIDDataSet = TheToolsClass.FindActiveToolByToolID(strToolID);
                intRecordsReturned = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID.Rows.Count;
                if (intRecordsReturned == 0)
                {
                    TheMessagesClass.ErrorMessage("Tool is not Active or Does Not Exist");
                    return;
                }
                if (TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].Available == false)
                {
                    strMessage            = "Tool Is Currently Signed Out, Do You Want To Sign Tool In";
                    strCaption            = "Please Select";
                    MainWindow.gstrToolID = strToolID;

                    MessageBoxResult result = MessageBox.Show(strMessage, strCaption, MessageBoxButton.YesNo, MessageBoxImage.Question);

                    if (result == MessageBoxResult.Yes)
                    {
                        SignToolInFromForm SignToolInFromForm = new SignToolInFromForm();
                        SignToolInFromForm.ShowDialog();

                        if (MainWindow.gblnToolSignedIn == false)
                        {
                            TheMessagesClass.InformationMessage("The Tool Was Not Signed In, the Transaction Will Not Proceed");
                            mitSignOutTool.IsEnabled = false;
                            return;
                        }

                        TheFindActiveToolByToolIDDataSet = TheToolsClass.FindActiveToolByToolID(strToolID);
                    }
                    else
                    {
                        return;
                    }
                }

                MainWindow.gintToolKey      = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolKey;
                MainWindow.gblnToolSignedIn = true;
                txtDescription.Text         = TheFindActiveToolByToolIDDataSet.FindActiveToolByToolID[0].ToolDescription;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Sign Out Tool // Find Button " + Ex.Message);

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