Beispiel #1
0
        private void expProcess_Expanded(object sender, RoutedEventArgs e)
        {
            int    intCounter;
            int    intNumberOfRecords;
            string strItemDescription;
            string strManufacturer;
            string strModel;
            string strSerialNumber;
            int    intWarehouse;
            string strBJCAssetID;
            int    intAssetID;
            string strAssetCategory;
            string strAssetDescription;
            bool   blnFatalError;

            try
            {
                expProcess.IsExpanded = false;
                intNumberOfRecords    = TheMonitorsDataSet.monitors.Rows.Count;

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        strItemDescription  = TheMonitorsDataSet.monitors[intCounter].Item;
                        strManufacturer     = TheMonitorsDataSet.monitors[intCounter].Manufacturer;
                        strModel            = TheMonitorsDataSet.monitors[intCounter].Model;
                        strSerialNumber     = TheMonitorsDataSet.monitors[intCounter].SerialNumber;
                        intWarehouse        = TheMonitorsDataSet.monitors[intCounter].WarehouseID;
                        strBJCAssetID       = TheMonitorsDataSet.monitors[intCounter].BJCAssetID;
                        intAssetID          = TheMonitorsDataSet.monitors[intCounter].AssetID;
                        strAssetDescription = strItemDescription + " NO. " + strBJCAssetID;
                        strAssetCategory    = TheMonitorsDataSet.monitors[intCounter].AssetType;

                        blnFatalError = TheITAssetsClass.InsertITAsset(strItemDescription, strManufacturer, strModel, strSerialNumber, 1, 0, "NO", intWarehouse);

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

                        blnFatalError = TheAssetClass.InsertWaspAssets(intAssetID, strAssetDescription, strBJCAssetID, strAssetCategory, gstrSite, MainWindow.gstrAssetLocation, intWarehouse, DateTime.Now, strSerialNumber, strManufacturer, strModel);

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

                    CreateWaspAssetSheet();
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Wasp Monitors // Process Expander " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void expProcessImport_Expanded(object sender, RoutedEventArgs e)
        {
            int      intCounter;
            int      intNumberOfRecords;
            int      intAssetID;
            string   strAssetDescription;
            string   strAssetType;
            string   strSite;
            string   strLocation;
            string   strSerialNumber;
            string   strManufacturer;
            string   strModel;
            int      intWarehouseID;
            DateTime datTransactionDate;
            bool     blnFatalError = false;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                intNumberOfRecords = TheImportWASPITAssetsDataSet.importassets.Rows.Count;

                for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                {
                    intAssetID          = TheImportWASPITAssetsDataSet.importassets[intCounter].AssetID;
                    strAssetType        = TheImportWASPITAssetsDataSet.importassets[intCounter].AssetType;
                    strAssetDescription = TheImportWASPITAssetsDataSet.importassets[intCounter].AssetDescription;
                    strSite             = TheImportWASPITAssetsDataSet.importassets[intCounter].Site;
                    strLocation         = TheImportWASPITAssetsDataSet.importassets[intCounter].Location;
                    strSerialNumber     = TheImportWASPITAssetsDataSet.importassets[intCounter].SerialNumber;
                    strManufacturer     = TheImportWASPITAssetsDataSet.importassets[intCounter].Manufacturer;
                    strModel            = TheImportWASPITAssetsDataSet.importassets[intCounter].Model;
                    datTransactionDate  = DateTime.Now;
                    intWarehouseID      = TheImportWASPITAssetsDataSet.importassets[intCounter].WarehouseID;

                    blnFatalError = TheAssetClass.InsertWaspAssets(intAssetID, strAssetDescription, strSerialNumber, strAssetType, strSite, strLocation, intWarehouseID, datTransactionDate, strSerialNumber, strManufacturer, strModel);

                    if (blnFatalError == true)
                    {
                        throw new Exception();
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Wasp IT Assets // Proces Import Expander " + Ex.Message);

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

            PleaseWait.Close();
        }
Beispiel #3
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());
            }
        }
        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());
            }
        }
Beispiel #5
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());
            }
        }