private void btnFindPartNumber_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            string strPartNumber;
            int    intRecordsReturned;

            try
            {
                //data validation
                strPartNumber = txtEnterPartNumber.Text;
                if (strPartNumber == "")
                {
                    TheMessagesClass.ErrorMessage("Part Number Not Entered");
                    return;
                }

                TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                if (intRecordsReturned == 0)
                {
                    TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strPartNumber);

                    intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        TheMessagesClass.InformationMessage("Part Number Was Not Found");

                        ClearControls();
                    }
                    else if (intRecordsReturned > 0)
                    {
                        txtDescription.Text   = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription;
                        txtJDEPartNumber.Text = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].JDEPartNumber;
                        txtPartID.Text        = Convert.ToString(TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID);
                        txtPartNumber.Text    = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartNumber;
                        txtPrice.Text         = Convert.ToString(TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].Price);
                        mitSave.IsEnabled     = true;
                    }
                }
                else if (intRecordsReturned > 0)
                {
                    txtDescription.Text   = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription;
                    txtJDEPartNumber.Text = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber;
                    txtPartID.Text        = Convert.ToString(TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID);
                    txtPartNumber.Text    = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartNumber;
                    txtPrice.Text         = Convert.ToString(TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].Price);
                    mitSave.IsEnabled     = true;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Edit Parts // Find Part Number Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Beispiel #2
0
        private void btnFindPart_Click(object sender, RoutedEventArgs e)
        {
            string strPartNumber;
            int    intRecordCount;

            try
            {
                strPartNumber = txtPartNumber.Text;
                gblnItemFound = false;

                TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                intRecordCount = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                if (intRecordCount > 0)
                {
                    MainWindow.gintPartID   = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID;
                    txtPartDescription.Text = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription;
                    gblnItemFound           = true;
                }
                else if (intRecordCount < 1)
                {
                    TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strPartNumber);

                    intRecordCount = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count;

                    if (intRecordCount > 0)
                    {
                        MainWindow.gintPartID   = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID;
                        txtPartDescription.Text = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription;
                        gblnItemFound           = true;
                    }
                    else
                    {
                        TheMessagesClass.ErrorMessage("The Part Was Not Found");
                        return;
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Inventory Location // Find Part Button " + Ex.Message);

                TheSendEmailClass.SendEventLog(Ex.ToString());

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void expCheckPartNumber_Expanded(object sender, RoutedEventArgs e)
        {
            string strPartNumber;
            int    intRecordsReturned;

            try
            {
                expCheckPartNumber.IsExpanded = false;
                strPartNumber = txtPartNumber.Text;

                TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    txtPartDescription.Text = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription;

                    MainWindow.gintPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID;
                }
                else if (intRecordsReturned < 1)
                {
                    TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strPartNumber);

                    intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        txtPartDescription.Text = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription;

                        MainWindow.gintPartID = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID;
                    }
                    else
                    {
                        TheMessagesClass.ErrorMessage("The Part Number Was Not Found");
                        return;
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Cable Reel // Check Cable Reel " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Beispiel #4
0
        private void btnFindPart_Click(object sender, RoutedEventArgs e)
        {
            string strPartNumber;
            int    intNumberOfRecords;
            int    intCounter;
            int    intPartID;
            bool   blnFatalError = false;
            string strJDEPartNumber;
            string strPartDescription;
            int    intRecordsReturned;
            string strOldPartNumber;

            try
            {
                blnFatalError = TheEmployeeDateEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Part Lookup");

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

                ThePartLookupDataSet.partlookup.Rows.Clear();

                strPartNumber = txtEnterPartInformation.Text;

                if (strPartNumber.Length < 1)
                {
                    TheMessagesClass.ErrorMessage("The Part Information Was Not Entered");
                    return;
                }

                //part number search
                TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                intNumberOfRecords = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                if (intNumberOfRecords > 0)
                {
                    intPartID          = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID;
                    strJDEPartNumber   = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber;
                    strPartDescription = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription;

                    TheFindMasterPartListPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID);

                    strOldPartNumber = "NONE FOUND";

                    intRecordsReturned = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        strOldPartNumber = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber;
                    }

                    PartLookupDataSet.partlookupRow NewPartRow = ThePartLookupDataSet.partlookup.NewpartlookupRow();

                    NewPartRow.JDEPartNumber   = strJDEPartNumber;
                    NewPartRow.OldPartNumber   = strOldPartNumber;
                    NewPartRow.PartDescription = strPartDescription;
                    NewPartRow.PartID          = intPartID;
                    NewPartRow.PartNumber      = strPartNumber;

                    ThePartLookupDataSet.partlookup.Rows.Add(NewPartRow);
                }
                else if (intNumberOfRecords < 1)
                {
                    strJDEPartNumber = strPartNumber;

                    TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber);

                    intNumberOfRecords = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count;

                    if (intNumberOfRecords > 0)
                    {
                        strPartNumber      = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartNumber;
                        intPartID          = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID;
                        strPartDescription = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription;

                        TheFindMasterPartListPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID);

                        strOldPartNumber = "NONE FOUND";

                        intRecordsReturned = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            strOldPartNumber = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber;
                        }

                        PartLookupDataSet.partlookupRow NewPartRow = ThePartLookupDataSet.partlookup.NewpartlookupRow();

                        NewPartRow.JDEPartNumber   = strJDEPartNumber;
                        NewPartRow.OldPartNumber   = strOldPartNumber;
                        NewPartRow.PartDescription = strPartDescription;
                        NewPartRow.PartID          = intPartID;
                        NewPartRow.PartNumber      = strPartNumber;

                        ThePartLookupDataSet.partlookup.Rows.Add(NewPartRow);
                    }
                    else if (intNumberOfRecords < 1)
                    {
                        strPartDescription = strPartNumber;

                        TheFindPartByDescriptionKeyWordDataSet = ThePartNumberClass.FindPartByDescriptionKeyWord(strPartDescription);

                        intNumberOfRecords = TheFindPartByDescriptionKeyWordDataSet.FindPartByDescriptionKeyWord.Rows.Count;

                        if (intNumberOfRecords < 1)
                        {
                            TheMessagesClass.ErrorMessage("The Part Was Not Found");
                            return;
                        }
                        else if (intNumberOfRecords > 1)
                        {
                            for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                            {
                                intPartID          = TheFindPartByDescriptionKeyWordDataSet.FindPartByDescriptionKeyWord[intCounter].PartID;
                                strPartNumber      = TheFindPartByDescriptionKeyWordDataSet.FindPartByDescriptionKeyWord[intCounter].PartNumber;
                                strJDEPartNumber   = TheFindPartByDescriptionKeyWordDataSet.FindPartByDescriptionKeyWord[intCounter].JDEPartNumber;
                                strPartDescription = TheFindPartByDescriptionKeyWordDataSet.FindPartByDescriptionKeyWord[intCounter].PartDescription;

                                TheFindMasterPartListPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID);

                                strOldPartNumber = "NONE FOUND";

                                intRecordsReturned = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count;

                                if (intRecordsReturned > 0)
                                {
                                    strOldPartNumber = TheFindMasterPartListPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber;
                                }

                                PartLookupDataSet.partlookupRow NewPartRow = ThePartLookupDataSet.partlookup.NewpartlookupRow();

                                NewPartRow.JDEPartNumber   = strJDEPartNumber;
                                NewPartRow.OldPartNumber   = strOldPartNumber;
                                NewPartRow.PartDescription = strPartDescription;
                                NewPartRow.PartID          = intPartID;
                                NewPartRow.PartNumber      = strPartNumber;

                                ThePartLookupDataSet.partlookup.Rows.Add(NewPartRow);
                            }
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Part Lookup // Find Part Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Beispiel #5
0
        private void AddSaveRecord()
        {
            //setting local variables
            string strPartNumber;
            string strProject;
            int    intPartID    = 0;
            string strMSRNumber = "NOT REQUIRED";
            string strValueForValidation;
            int    intQuantity        = 0;
            bool   blnThereIsAProblem = false;
            bool   blnFatalError      = false;
            string strErrorMessage    = "";
            int    intRecordsFound;
            bool   blnProjectNotFound = false;
            bool   blnPartNotFound    = true;
            bool   blnKeyWordNotFound;
            int    intTotalQuantity;
            int    intProjectID       = 0;
            string strJDEPartNumber   = "";
            int    intEmployeeID      = 0;
            int    intEnterEmployeeID = 0;

            try
            {
                if (btnAdd.Content.ToString() == "Add")
                {
                    //loading controls
                    txtDateEntryComplete.Text = "NO";
                    txtDate.Text = Convert.ToString(DateTime.Now);

                    btnAdd.Content = "Save";
                }
                else
                {
                    if (MainWindow.gstrMenuSelection == "Issue")
                    {
                        if (cboSelectEmployee.SelectedIndex < 1)
                        {
                            blnFatalError    = true;
                            strErrorMessage += "Employee Was Not Selected\n";
                        }
                    }

                    //data validation
                    strProject = txtProjectID.Text;
                    if (strProject == "")
                    {
                        blnFatalError    = true;
                        strErrorMessage += "Project ID Was Not Entered\n";
                    }
                    else
                    {
                        TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProject);

                        intRecordsFound = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

                        if (intRecordsFound == 0)
                        {
                            TheFindProjectByProjectNameDataSet = TheProjectClass.FindProjectByProjectName(strProject);

                            intRecordsFound = TheFindProjectByProjectNameDataSet.FindProjectByProjectName.Rows.Count;

                            if (intRecordsFound == 0)
                            {
                                blnThereIsAProblem = TheDataValidationClass.VerifyIntegerData(strProject);

                                if (blnThereIsAProblem == true)
                                {
                                    blnProjectNotFound = true;
                                }
                                else
                                {
                                    TheFindProjectByProjectIDDataSet = TheProjectClass.FindProjectByProjectID(Convert.ToInt32(strProject));

                                    intRecordsFound = TheFindProjectByProjectIDDataSet.FindProjectByProjectID.Rows.Count;

                                    if (intRecordsFound == 0)
                                    {
                                        blnProjectNotFound = true;
                                    }
                                    else
                                    {
                                        intProjectID = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].ProjectID;
                                        strProject   = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].AssignedProjectID;
                                    }
                                }
                            }
                            else
                            {
                                strProject   = TheFindProjectByProjectNameDataSet.FindProjectByProjectName[0].AssignedProjectID;
                                intProjectID = TheFindProjectByProjectNameDataSet.FindProjectByProjectName[0].ProjectID;
                            }
                        }
                        else
                        {
                            intProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;
                        }

                        if (blnProjectNotFound == true)
                        {
                            blnFatalError    = true;
                            strErrorMessage += "Project Was Not Found\n";
                        }
                    }
                    if (MainWindow.gstrMenuSelection == "Receive")
                    {
                        strMSRNumber = txtMSRPONumber.Text;
                        if (strMSRNumber == "")
                        {
                            blnFatalError    = true;
                            strErrorMessage += "MSR or PO Number Was Not Entered\n";
                        }
                        else if (strMSRNumber == "NO MSR NUMBER PROVIDED")
                        {
                            blnFatalError    = true;
                            strErrorMessage += "NO MSR NUMBER PROVIDED Cannot Be Entered\n";
                        }
                    }
                    strPartNumber = txtPartNumber.Text;
                    if (strPartNumber == "")
                    {
                        blnFatalError    = true;
                        strErrorMessage += "Part Number Was Not Entered\n";
                    }
                    else
                    {
                        blnPartNotFound = true;

                        blnThereIsAProblem = TheDataValidationClass.VerifyIntegerData(strPartNumber);
                        if (blnThereIsAProblem == false)
                        {
                            intPartID = Convert.ToInt32(strPartNumber);

                            TheFindPartByPartIDDataSet = ThePartNumberClass.FindPartByPartID(intPartID);

                            intRecordsFound = TheFindPartByPartIDDataSet.FindPartByPartID.Rows.Count;

                            if (intRecordsFound == 1)
                            {
                                blnPartNotFound  = false;
                                strPartNumber    = TheFindPartByPartIDDataSet.FindPartByPartID[0].PartNumber;
                                strJDEPartNumber = TheFindPartByPartIDDataSet.FindPartByPartID[0].JDEPartNumber;
                            }
                        }

                        if (blnPartNotFound == true)
                        {
                            TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                            intRecordsFound = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                            if (intRecordsFound == 1)
                            {
                                blnPartNotFound  = false;
                                intPartID        = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID;
                                strJDEPartNumber = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber;
                            }

                            if (blnPartNotFound == true)
                            {
                                TheFindPartByJDEPartNumber = ThePartNumberClass.FindPartByJDEPartNumber(strPartNumber);

                                intRecordsFound = TheFindPartByJDEPartNumber.FindPartByJDEPartNumber.Rows.Count;

                                if (intRecordsFound == 1)
                                {
                                    blnPartNotFound  = false;
                                    intPartID        = TheFindPartByJDEPartNumber.FindPartByJDEPartNumber[0].PartID;
                                    strPartNumber    = TheFindPartByJDEPartNumber.FindPartByJDEPartNumber[0].PartNumber;
                                    strJDEPartNumber = TheFindPartByJDEPartNumber.FindPartByJDEPartNumber[0].JDEPartNumber;
                                }
                            }
                        }

                        if (MainWindow.gstrWarehouseName != "TRAINING")
                        {
                            //checking to see if non charter number
                            blnKeyWordNotFound = TheKeyWordClass.FindKeyWord("JH", MainWindow.gstrWarehouseName);

                            if (blnKeyWordNotFound == true)
                            {
                                if (strJDEPartNumber == "NOT REQUIRED")
                                {
                                    blnFatalError    = true;
                                    strErrorMessage += "Using Non Charter Part Number for Charter Warehouse\n";
                                }

                                if (strJDEPartNumber == "NOT PROVIDED")
                                {
                                    blnFatalError    = true;
                                    strErrorMessage += "Using Non Charter Part Number for Charter Warehouse\n";
                                }
                            }
                        }

                        if (blnPartNotFound == true)
                        {
                            blnFatalError    = true;
                            strErrorMessage += "Part Number Not Found\n";
                        }
                    }

                    //validating the Quantity
                    strValueForValidation = txtQuantity.Text;
                    blnThereIsAProblem    = TheDataValidationClass.VerifyIntegerData(strValueForValidation);
                    if (blnThereIsAProblem == true)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Quantity Entered is not an Integer\n";
                    }
                    else
                    {
                        intQuantity = Convert.ToInt32(strValueForValidation);
                    }

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

                    //checking quantity for issuing
                    if (MainWindow.gstrMenuSelection == "Issue")
                    {
                        TheFindWarehouseInventoryPartDataSet = TheInventoryClass.FindWarehouseInventoryPart(intPartID, MainWindow.gintWarehouseID);

                        intRecordsFound = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart.Rows.Count;

                        if (intRecordsFound == 0)
                        {
                            intTotalQuantity = 0;
                        }
                        else
                        {
                            intTotalQuantity = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].Quantity;
                        }

                        intTotalQuantity = CalculateWIPCount(intPartID, MainWindow.gintWarehouseID, intTotalQuantity);

                        if (intQuantity > intTotalQuantity)
                        {
                            TheMessagesClass.ErrorMessage("The Quantity Issued is greater than the Quantity On The Shelf");
                            return;
                        }
                    }

                    if (MainWindow.gstrMenuSelection == "Issue")
                    {
                        intEmployeeID      = gintSelectedEmployeeID;
                        intEnterEmployeeID = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID;
                    }
                    else
                    {
                        intEmployeeID = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID;
                    }

                    blnFatalError = TheInventoryWIPClass.InsertDataEntryWIP(MainWindow.gintSessionID, intPartID, strPartNumber, intProjectID, strProject, strMSRNumber, MainWindow.gintWarehouseID, intQuantity, intEmployeeID, MainWindow.gstrMenuSelection.ToUpper());

                    if (blnFatalError == true)
                    {
                        TheMessagesClass.ErrorMessage("There Has Been A Problem. Contact IT");
                        return;
                    }

                    ClearControls();
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Enter Inventory \\ Enter Material \\ Add Button During Save " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Beispiel #6
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            string strPartNumber;
            bool   blnIsNotInteger = false;
            int    intRecordsReturned;
            bool   blnItemFound = false;


            strPartNumber = txtEnterPartNumber.Text;
            if (strPartNumber == "")
            {
                TheMessagesClass.ErrorMessage("Part Number Was Not Added");
                return;
            }

            blnIsNotInteger = TheDataValidationClass.VerifyIntegerData(strPartNumber);
            if (blnIsNotInteger == false)
            {
                MainWindow.gintPartID = Convert.ToInt32(strPartNumber);

                TheFindPartByPartIDDataSet = ThePartNumberClass.FindPartByPartID(MainWindow.gintPartID);

                intRecordsReturned = TheFindPartByPartIDDataSet.FindPartByPartID.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    blnItemFound = true;
                }
            }
            if (blnItemFound == false)
            {
                TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    blnItemFound          = true;
                    MainWindow.gintPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID;
                }

                if (blnItemFound == false)
                {
                    TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strPartNumber);

                    intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        blnItemFound          = true;
                        MainWindow.gintPartID = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID;
                    }
                }
            }

            if (blnItemFound == false)
            {
                TheMessagesClass.ErrorMessage("Part Information Does Not Exist");
                return;
            }

            blnItemFound = false;

            TheFindWarehouseInventoryPartDataSet = TheInventoryClass.FindWarehouseInventoryPart(MainWindow.gintPartID, MainWindow.gintWarehouseID);

            intRecordsReturned = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart.Rows.Count;

            if (intRecordsReturned == 0)
            {
                TheMessagesClass.ErrorMessage("No Information for this Part, You Cannoot Change The Count");
                return;
            }
            else
            {
                txtCurrentCount.Text = Convert.ToString(TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].Quantity);
                gintTransactionID    = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].TransactionID;
            }


            btnUpdate.IsEnabled = true;
        }
        private void mitSave_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            string strPartNumber;
            int    intRecordsReturned;
            bool   blnFatalError = false;

            try
            {
                //data validation
                strPartNumber = txtEnterPartNumber.Text;
                if (strPartNumber == "")
                {
                    TheMessagesClass.ErrorMessage("Part Number Was Not Entered");
                    return;
                }

                //checking to see if the part number exists within the part table
                //checking JDE Part Number
                TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strPartNumber);

                intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    TheMessagesClass.InformationMessage("The Part Currently Exists Within The Part Number Table");
                    return;
                }

                //checking part number
                TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    TheMessagesClass.InformationMessage("The Part Currently Exists Within The Part Number Table");
                    return;
                }


                TheFindPartFromMasterPartListByJDEPartNumberDataSet = ThePartNumberClass.FindPartFromMasterPartListByJDEPartNumber(strPartNumber);

                intRecordsReturned = TheFindPartFromMasterPartListByJDEPartNumberDataSet.FindPartFromMasterPartListByJDEPartNumber.Rows.Count;

                if (intRecordsReturned == 0)
                {
                    TheFindPartFromMasterPartListByPartNumberDataSet = ThePartNumberClass.FindPartFromMasterPartListByPartNumber(strPartNumber);

                    intRecordsReturned = TheFindPartFromMasterPartListByPartNumberDataSet.FindPartFromMasterPartListByPartNumber.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        TheMessagesClass.ErrorMessage("The Part Number Entered is not in the Master Part List");
                        return;
                    }
                }

                blnFatalError = ThePartNumberClass.InsertPartIntoPartNumbers(Convert.ToInt32(txtPartID.Text), txtPartNumber.Text, txtJDEPartNumber.Text, txtDescription.Text, float.Parse(txtPrice.Text));

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

                TheMessagesClass.InformationMessage("The Part Number Has Been Added");

                ClearControls();
            }
            catch (Exception Ex)
            {
                TheEventlogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Add Part From Master List // Save Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void btnFind_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            string strPartNumber;
            int    intRecordsReturned;

            try
            {
                //data validation
                strPartNumber = txtEnterPartNumber.Text;
                if (strPartNumber == "")
                {
                    TheMessagesClass.ErrorMessage("Part Number Was Not Entered");
                    return;
                }

                //checking to see if the part number exists within the part table
                //checking JDE Part Number
                TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strPartNumber);

                intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    TheMessagesClass.InformationMessage("The Part Currently Exists Within The Part Number Table");
                    return;
                }

                //checking part number
                TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    TheMessagesClass.InformationMessage("The Part Currently Exists Within The Part Number Table");
                    return;
                }


                TheFindPartFromMasterPartListByJDEPartNumberDataSet = ThePartNumberClass.FindPartFromMasterPartListByJDEPartNumber(strPartNumber);

                intRecordsReturned = TheFindPartFromMasterPartListByJDEPartNumberDataSet.FindPartFromMasterPartListByJDEPartNumber.Rows.Count;

                if (intRecordsReturned == 0)
                {
                    TheFindPartFromMasterPartListByPartNumberDataSet = ThePartNumberClass.FindPartFromMasterPartListByPartNumber(strPartNumber);

                    intRecordsReturned = TheFindPartFromMasterPartListByPartNumberDataSet.FindPartFromMasterPartListByPartNumber.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        TheMessagesClass.ErrorMessage("The Part Number Entered is not in the Master Part List");
                        return;
                    }
                    else
                    {
                        txtDescription.Text   = TheFindPartFromMasterPartListByPartNumberDataSet.FindPartFromMasterPartListByPartNumber[0].PartDescription;
                        txtJDEPartNumber.Text = TheFindPartFromMasterPartListByPartNumberDataSet.FindPartFromMasterPartListByPartNumber[0].JDEPartNumber;
                        txtPartID.Text        = Convert.ToString(TheFindPartFromMasterPartListByPartNumberDataSet.FindPartFromMasterPartListByPartNumber[0].PartID);
                        txtPartNumber.Text    = TheFindPartFromMasterPartListByPartNumberDataSet.FindPartFromMasterPartListByPartNumber[0].PartNumber;
                        txtPrice.Text         = Convert.ToString(TheFindPartFromMasterPartListByPartNumberDataSet.FindPartFromMasterPartListByPartNumber[0].Price);
                    }
                }
                else
                {
                    txtDescription.Text   = TheFindPartFromMasterPartListByJDEPartNumberDataSet.FindPartFromMasterPartListByJDEPartNumber[0].PartDescription;
                    txtJDEPartNumber.Text = TheFindPartFromMasterPartListByJDEPartNumberDataSet.FindPartFromMasterPartListByJDEPartNumber[0].JDEPartNumber;
                    txtPartID.Text        = Convert.ToString(TheFindPartFromMasterPartListByJDEPartNumberDataSet.FindPartFromMasterPartListByJDEPartNumber[0].PartID);
                    txtPartNumber.Text    = TheFindPartFromMasterPartListByJDEPartNumberDataSet.FindPartFromMasterPartListByJDEPartNumber[0].PartNumber;
                    txtPrice.Text         = Convert.ToString(TheFindPartFromMasterPartListByJDEPartNumberDataSet.FindPartFromMasterPartListByJDEPartNumber[0].Price);
                }
            }
            catch (Exception Ex)
            {
                TheEventlogClass.InsertEventLogEntry(DateTime.Now, "Add Parts Part From Master List Find Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void btnFind_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            string strValueForValidation;
            string strErrorMessage    = "";
            bool   blnThereIsAProblem = false;
            bool   blnFatalError      = false;
            int    intSelectedIndex;
            int    intRecordsReturned;
            string strPartDescription;

            try
            {
                intSelectedIndex = cboSendingWarehouse.SelectedIndex;

                if (intSelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Sending Warehouse Not Selected\n";
                }
                MainWindow.gstrPartNumber = txtEnterPartNumber.Text;
                if (MainWindow.gstrPartNumber == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "Part Number Was Not Entered\n";
                }
                strValueForValidation = txtEnterQuantity.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyIntegerData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Quantity is not an Integer\n";
                }
                else
                {
                    gintQuantity = Convert.ToInt32(strValueForValidation);
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(MainWindow.gstrPartNumber);

                intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                if (intRecordsReturned == 0)
                {
                    TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(MainWindow.gstrPartNumber);

                    intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        TheMessagesClass.InformationMessage("Part Number Was Not Found");
                        return;
                    }
                    else
                    {
                        MainWindow.gintPartID = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID;
                        strPartDescription    = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription;
                    }
                }
                else
                {
                    MainWindow.gintPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID;
                    strPartDescription    = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription;
                }

                TheFindWarehouseInventoryPartDataSet = TheInventoryClass.FindWarehouseInventoryPart(MainWindow.gintPartID, gintSendingWarehouseID);

                intRecordsReturned = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart.Rows.Count;

                if (intRecordsReturned == 0)
                {
                    TheMessagesClass.InformationMessage("The Part in this Warehouse Does Not Exist");
                    return;
                }
                else if (gintQuantity > TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].Quantity)
                {
                    TheMessagesClass.ErrorMessage("Quantity Transfered Cannot Be Greater that Warehouse Quantity");
                    return;
                }
                else
                {
                    txtPartDescription.Text  = strPartDescription;
                    gintSendingTransactionID = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].TransactionID;
                    gintSendingQuantity      = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].Quantity;
                }


                cboReceivingWarehouse.IsEnabled = true;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Transfer Inventory // Find Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void expImportExcel_Expanded(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            string strPartNumber;
            string strPartLocation;
            string strJDEPartNumber;
            int    intPartID;
            string strOldPartNumber;
            string strPartDescription;
            int    intRecordsReturned;

            try
            {
                TheImportInventoryLocationdDataSet.importinventorylocations.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();

                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++)
                {
                    strPartNumber   = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    strPartLocation = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();

                    TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                    intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        intPartID          = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID;
                        strJDEPartNumber   = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber;
                        strPartDescription = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription;

                        TheFindMasterPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID);

                        intRecordsReturned = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count;

                        strOldPartNumber = "NONE FOUND";

                        if (intRecordsReturned > 0)
                        {
                            strOldPartNumber = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber;
                        }

                        ImportInventoryLocationsDataSet.importinventorylocationsRow NewPartRow = TheImportInventoryLocationdDataSet.importinventorylocations.NewimportinventorylocationsRow();

                        NewPartRow.JDEPartNumber   = strJDEPartNumber;
                        NewPartRow.Location        = strPartLocation;
                        NewPartRow.OldPartNumber   = strOldPartNumber;
                        NewPartRow.PartDescription = strPartDescription;
                        NewPartRow.PartID          = intPartID;
                        NewPartRow.PartNumber      = strPartNumber;
                        NewPartRow.ToBeImported    = true;

                        TheImportInventoryLocationdDataSet.importinventorylocations.Rows.Add(NewPartRow);
                    }
                    else if (intRecordsReturned < 1)
                    {
                        strJDEPartNumber = strPartNumber;

                        TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber);

                        intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            intPartID          = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID;
                            strPartNumber      = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartNumber;
                            strPartDescription = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription;

                            TheFindMasterPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID);

                            intRecordsReturned = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count;

                            strOldPartNumber = "NONE FOUND";

                            if (intRecordsReturned > 0)
                            {
                                strOldPartNumber = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber;
                            }

                            ImportInventoryLocationsDataSet.importinventorylocationsRow NewPartRow = TheImportInventoryLocationdDataSet.importinventorylocations.NewimportinventorylocationsRow();

                            NewPartRow.JDEPartNumber   = strJDEPartNumber;
                            NewPartRow.Location        = strPartLocation;
                            NewPartRow.OldPartNumber   = strOldPartNumber;
                            NewPartRow.PartDescription = strPartDescription;
                            NewPartRow.PartID          = intPartID;
                            NewPartRow.PartNumber      = strPartNumber;
                            NewPartRow.ToBeImported    = true;

                            TheImportInventoryLocationdDataSet.importinventorylocations.Rows.Add(NewPartRow);
                        }
                    }
                }

                PleaseWait.Close();

                dgrImportedInformation.ItemsSource = TheImportInventoryLocationdDataSet.importinventorylocations;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Inventory Locations // Import Excel  " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Beispiel #11
0
        private void mitSave_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            bool   blnFatalError      = false;
            bool   blnThereIsAProblem = false;
            string strErrorMessage    = "";
            string strValueForValidation;
            string strPartNumber;
            string strJDEPartNumber;
            string strDescription;
            string strCharterPart;
            double douPrice = 0;
            int    intRecordsReturned;

            try
            {
                //beginning data validation
                strPartNumber = txtPartNumber.Text;
                if (strPartNumber == "")
                {
                    strErrorMessage += "The Part Number Was Not Entered\n";
                    blnFatalError    = true;
                }
                strJDEPartNumber = txtJDEPartNumber.Text;
                if (strJDEPartNumber == "")
                {
                    strErrorMessage += "The JDE Part Number Was Not Entered\n";
                    blnFatalError    = true;
                }
                strDescription = txtDescription.Text;
                if (strDescription == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Description Was Not Entered\n";
                }
                strCharterPart     = txtCharter.Text;
                blnThereIsAProblem = TheDataValidationClass.VerifyYesNoData(strCharterPart);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Charter Part in not a Yes or No\n";
                }
                strValueForValidation = txtPrice.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDoubleData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Price is not a Valid Format\n";
                }
                else
                {
                    douPrice = Convert.ToDouble(strValueForValidation);
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                //checking to see if the part number exists
                TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    TheMessagesClass.ErrorMessage("Part Number Exists");
                    return;
                }

                if (strJDEPartNumber != "NOT REQUIRED")
                {
                    TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber);

                    if (intRecordsReturned > 0)
                    {
                        TheMessagesClass.ErrorMessage("JDE Part Number Exists");
                        return;
                    }
                }

                //searching the master parts list
                TheFindPartFromMasterPartListByPartNumberDataSet = ThePartNumberClass.FindPartFromMasterPartListByPartNumber(strPartNumber);

                intRecordsReturned = TheFindPartFromMasterPartListByPartNumberDataSet.FindPartFromMasterPartListByPartNumber.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    TheMessagesClass.ErrorMessage("Part Number Exists with the Master Part List Table");
                    return;
                }

                if (strJDEPartNumber != "NOT REQUIRED")
                {
                    TheFindPartFromMasterPartLitByJDEPartNumberDataSet = ThePartNumberClass.FindPartFromMasterPartListByJDEPartNumber(strJDEPartNumber);

                    if (intRecordsReturned > 0)
                    {
                        TheMessagesClass.ErrorMessage("JDE Part Number Exists within the Master Part List");
                        return;
                    }
                }

                //saving the record
                blnFatalError = ThePartNumberClass.InsertPartIntoPartNumbers(-1, strPartNumber, strJDEPartNumber, strDescription, float.Parse(txtPrice.Text));

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

                ClearControls();
                SetControlsReadOnly(true);
            }

            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Add Part // Save Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Beispiel #12
0
        private void expImportExcel_Expanded(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            string strPartNumber;
            string strJDEPartNumber;
            int    intPartID = 0;
            string strPartDescription;
            int    intQuantity = 0;
            int    intRecordsReturned;
            bool   blnItemFound;
            bool   blnItemInTable;
            bool   blnFatalError = false;
            int    intSecondCounter;
            string strOldPartNumber = "";

            try
            {
                expImportExcel.IsExpanded = false;

                blnFatalError = TheEmployeeDataEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Create Spectrum Report // Import Spectrum Count");

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

                if (cboSelectWarehouse.SelectedIndex < 1)
                {
                    TheMessagesClass.ErrorMessage("The Warehouse Was Not Selected");
                    return;
                }

                TheSpectrumCountDataSet.spectrumcount.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();

                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;
                gintCounter         = 0;
                gintNumberOfRecords = 0;

                for (intCounter = 1; intCounter <= intNumberOfRecords; intCounter++)
                {
                    blnItemFound       = false;
                    strPartNumber      = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    strJDEPartNumber   = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    strPartDescription = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();

                    TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                    intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        intPartID        = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID;
                        strJDEPartNumber = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber;
                        blnItemFound     = true;
                    }
                    else if (intRecordsReturned < 1)
                    {
                        TheFindPartByJDEPartNUmberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber);

                        intRecordsReturned = TheFindPartByJDEPartNUmberDataSet.FindPartByJDEPartNumber.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            strPartNumber = TheFindPartByJDEPartNUmberDataSet.FindPartByJDEPartNumber[0].PartNumber;
                            intPartID     = TheFindPartByJDEPartNUmberDataSet.FindPartByJDEPartNumber[0].PartID;
                            blnItemFound  = true;
                        }
                        else if (intRecordsReturned < 1)
                        {
                            if (strPartNumber == "NONE")
                            {
                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = 0;
                                NewPartCount.JDEPartNumber   = strPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intCounter * -1;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = "UNKNOWN";

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                        }
                    }


                    if (blnItemFound == true)
                    {
                        TheFindWarehouseInventoryByPartDataSet = TheInventoryClass.FindWarehouseInventoryPart(intPartID, MainWindow.gintWarehouseID);

                        intRecordsReturned = TheFindWarehouseInventoryByPartDataSet.FindWarehouseInventoryPart.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            blnItemInTable = false;

                            if (gintCounter > 0)
                            {
                                for (intSecondCounter = 0; intSecondCounter <= gintNumberOfRecords; intSecondCounter++)
                                {
                                    if (intPartID == TheSpectrumCountDataSet.spectrumcount[intSecondCounter].PartID)
                                    {
                                        blnItemInTable = true;
                                    }
                                }
                            }

                            if (blnItemInTable == false)
                            {
                                intQuantity = TheFindWarehouseInventoryByPartDataSet.FindWarehouseInventoryPart[0].Quantity;

                                TheFindMasterPartByPartIDDataSet = ThePartNumberClass.FindMasterPartByPartID(intPartID);

                                intRecordsReturned = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID.Rows.Count;

                                if (intRecordsReturned > 0)
                                {
                                    strOldPartNumber = TheFindMasterPartByPartIDDataSet.FindMasterPartListPartByPartID[0].PartNumber;
                                }
                                else
                                {
                                    strOldPartNumber = "NOT FOUND";
                                }

                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = intQuantity;
                                NewPartCount.JDEPartNumber   = strJDEPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intPartID;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = strOldPartNumber;

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                        }
                        else if (intRecordsReturned < 1)
                        {
                            if (strPartDescription.Contains("CABLE RG6") == true)
                            {
                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = 0;
                                NewPartCount.JDEPartNumber   = strJDEPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intPartID;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = strOldPartNumber;

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                            else if (strPartDescription.Contains("CABLE RG11") == true)
                            {
                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = 0;
                                NewPartCount.JDEPartNumber   = strJDEPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intPartID;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = strOldPartNumber;

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                            else if (strPartDescription.Contains("CABLE 875") == true)
                            {
                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = 0;
                                NewPartCount.JDEPartNumber   = strJDEPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intPartID;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = strOldPartNumber;

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                            else if (strPartDescription.Contains("CABLE 625") == true)
                            {
                                SpectrumCountDataSet.spectrumcountRow NewPartCount = TheSpectrumCountDataSet.spectrumcount.NewspectrumcountRow();

                                NewPartCount.ERPQuantity     = 0;
                                NewPartCount.JDEPartNumber   = strJDEPartNumber;
                                NewPartCount.PartDescription = strPartDescription;
                                NewPartCount.PartID          = intPartID;
                                NewPartCount.PartNumber      = strPartNumber;
                                NewPartCount.OldPartNumber   = strOldPartNumber;

                                TheSpectrumCountDataSet.spectrumcount.Rows.Add(NewPartCount);
                            }
                        }
                    }
                }

                dgrResult.ItemsSource = TheSpectrumCountDataSet.spectrumcount;

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Create Spectrum Report // Import Excel Expander " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Beispiel #13
0
        private void btnFind_Click(object sender, RoutedEventArgs e)
        {
            //this will load up the controls and search for the part number
            string strPartNumber;
            int    intRecordsReturned;
            bool   blnFatalError = false;
            int    intPartID     = 0;
            bool   blnItemFound  = false;

            try
            {
                strPartNumber = txtEnterPartNumber.Text;
                if (strPartNumber == "")
                {
                    TheMessagesClass.ErrorMessage("Part Number Not Entered");
                    return;
                }

                blnFatalError = TheDataValidationClass.VerifyIntegerData(strPartNumber);

                if (blnFatalError == false)
                {
                    intPartID = Convert.ToInt32(strPartNumber);

                    TheFindPartByPartIDataSet = ThePartNumberClass.FindPartByPartID(intPartID);

                    intRecordsReturned = TheFindPartByPartIDataSet.FindPartByPartID.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        blnItemFound = true;

                        //loading the controls
                        txtJDEPartNumber.Text   = TheFindPartByPartIDataSet.FindPartByPartID[0].JDEPartNumber;
                        txtPartDescription.Text = TheFindPartByPartIDataSet.FindPartByPartID[0].PartDescription;
                        txtPartID.Text          = Convert.ToString(intPartID);
                        txtPartNumber.Text      = TheFindPartByPartIDataSet.FindPartByPartID[0].PartNumber;
                        blnItemFound            = true;
                    }
                }

                if (blnItemFound == false)
                {
                    TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strPartNumber);

                    intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        txtJDEPartNumber.Text   = strPartNumber;
                        txtPartDescription.Text = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription;
                        txtPartID.Text          = Convert.ToString(TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID);
                        txtPartNumber.Text      = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartNumber;
                    }
                    else
                    {
                        TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                        intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            txtJDEPartNumber.Text   = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber;
                            txtPartDescription.Text = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription;
                            txtPartID.Text          = Convert.ToString(TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID);
                            txtPartNumber.Text      = strPartNumber;
                        }
                        else
                        {
                            TheMessagesClass.ErrorMessage("Part Number Not Found");
                            return;
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Part Number Lookup // Find Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        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    intPartID = 0;
            string strPartNumber;
            string strJDEPartNumber;
            string strPartDescription;
            int    intNewQuantity;
            int    intRecordsReturned;
            string strLocation;

            try
            {
                TheImportInventoryDataSet.importinventory.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;
                }

                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;

                strLocation = txtEnterLocation.Text;

                if (strLocation.Length < 2)
                {
                    TheMessagesClass.ErrorMessage("The Location is not Long Enough");
                    return;
                }

                for (intCounter = 2; intCounter < intNumberOfRecords; intCounter++)
                {
                    strPartNumber      = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    strJDEPartNumber   = strPartNumber;
                    strPartDescription = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();
                    intNewQuantity     = Convert.ToInt32((range.Cells[intCounter, 3] as Excel.Range).Value2);

                    TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                    intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        intPartID          = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID;
                        strJDEPartNumber   = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber;
                        strPartDescription = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartDescription;
                    }
                    else if (intRecordsReturned < 1)
                    {
                        TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber);

                        intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            intPartID          = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartID;
                            strPartNumber      = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartNumber;
                            strPartDescription = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[0].PartDescription;
                        }
                        else if (intRecordsReturned < 1)
                        {
                            intPartID = intCounter * -1;
                        }
                    }

                    ImportInventoryDataSet.importinventoryRow NewPartRow = TheImportInventoryDataSet.importinventory.NewimportinventoryRow();

                    NewPartRow.CurrentCount    = intNewQuantity;
                    NewPartRow.JDEPartNumber   = strJDEPartNumber;
                    NewPartRow.OldCount        = 0;
                    NewPartRow.OldPartNumber   = "NO PART FOUND";
                    NewPartRow.PartDescription = strPartDescription;
                    NewPartRow.PartID          = intPartID;
                    NewPartRow.PartNumber      = strPartNumber;
                    NewPartRow.Location        = strLocation;

                    TheImportInventoryDataSet.importinventory.Rows.Add(NewPartRow);
                }

                dgrInventory.ItemsSource = TheImportInventoryDataSet.importinventory;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Convert Inventoryt // Main Window // Import Excel  " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Beispiel #15
0
        private void mitSave_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            string strPartNumber;
            int    intPartID;
            string strDescription;
            string strJDEPartNumber;
            double douPrice = 0;
            string strValueForValidation;
            bool   blnFatalError      = false;
            bool   blnThereIsAProblem = false;
            string strErrorMessage    = "";
            int    intRecordsReturned;
            int    intRecordCounter;
            bool   blnRecordMatch;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                //data validation
                strPartNumber = txtPartNumber.Text;
                intPartID     = Convert.ToInt32(txtPartID.Text);
                if (strPartNumber == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "Part Number Was Not Entered\n";
                }
                strJDEPartNumber = txtJDEPartNumber.Text;
                if (strJDEPartNumber == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "JDE Part Number Was Not Entered\n";
                }
                strDescription = txtDescription.Text;
                if (strDescription == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Description Was Not Entered\n";
                }
                strValueForValidation = txtPrice.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDoubleData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Price Entered in not Numeric\n";
                }
                else
                {
                    douPrice = Convert.ToDouble(strValueForValidation);
                }
                if (blnFatalError == true)
                {
                    PleaseWait.Close();
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                //validation to see if the part number is used with another row
                TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    blnRecordMatch = false;

                    for (intRecordCounter = 0; intRecordCounter <= intRecordsReturned - 1; intRecordCounter++)
                    {
                        if (strPartNumber == TheFindPartByPartNumberDataSet.FindPartByPartNumber[intRecordCounter].PartNumber)
                        {
                            if (intPartID != TheFindPartByPartNumberDataSet.FindPartByPartNumber[intRecordCounter].PartID)
                            {
                                blnRecordMatch = true;
                            }
                        }
                    }

                    if (blnRecordMatch == true)
                    {
                        TheMessagesClass.ErrorMessage("Part Number Exists with a Different Part ID");
                        return;
                    }
                }


                if ((strJDEPartNumber != "NOT REQUIRED") && (strJDEPartNumber != "NOT PROVIDED"))
                {
                    TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber);

                    intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        blnRecordMatch = false;

                        for (intRecordCounter = 0; intRecordCounter <= intRecordsReturned - 1; intRecordCounter++)
                        {
                            if (strJDEPartNumber == TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[intRecordCounter].JDEPartNumber)
                            {
                                if (intPartID != TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[intRecordCounter].PartID)
                                {
                                    blnRecordMatch = true;
                                }
                            }
                        }

                        if (blnRecordMatch == true)
                        {
                            TheMessagesClass.ErrorMessage("JDE Part Number Exists with a Different Part ID");
                            return;
                        }
                    }
                }

                //doing the loop
                blnFatalError = ThePartNumberClass.UpdatePartInformation(intPartID, strJDEPartNumber, strDescription, true, float.Parse(txtPrice.Text));

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

                TheMessagesClass.InformationMessage("The Part Has Been Updated");

                ClearControls();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Edit Parts // Save Menu Item " + Ex.Message);

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

            PleaseWait.Close();
        }