Ejemplo n.º 1
0
        private void btnFind_Click(object sender, RoutedEventArgs e)
        {
            //setting up locak variables
            string strProject;
            int    intRecordsReturned;

            strProject = txtEnterProject.Text;

            TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProject);

            intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

            if (intRecordsReturned > 0)
            {
                dgrResults.ItemsSource = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID;
            }
            else
            {
                TheFindProjectByProjectNameDataSet = TheProjectClass.FindProjectByProjectName(strProject);

                dgrResults.ItemsSource = TheFindProjectByProjectNameDataSet.FindProjectByProjectName;
            }
        }
Ejemplo n.º 2
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());
            }
        }
Ejemplo n.º 3
0
        private void btnFind_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            int      intRecordsReturned = 0;
            string   strProject;
            int      intProjectID         = 0;
            string   strAssignedProjectID = "";
            string   strProjectName       = "";
            DateTime datTransactionDate   = DateTime.Now;
            bool     blnNotInteger;
            bool     blnItemNotFound = true;

            try
            {
                //data validation
                strProject = txtEnterProject.Text;
                if (strProject == "")
                {
                    TheMessagesClass.ErrorMessage("Project Information was not Entered");
                    return;
                }

                //checking to see if this is an integer
                blnNotInteger = TheDataValidationClass.VerifyIntegerData(strProject);

                if (blnNotInteger == false)
                {
                    intProjectID = Convert.ToInt32(strProject);

                    //checking to see if project exists
                    MainWindow.TheFindProjectByProjectIDDataSet = TheProjectClass.FindProjectByProjectID(intProjectID);

                    intRecordsReturned = MainWindow.TheFindProjectByProjectIDDataSet.FindProjectByProjectID.Rows.Count;

                    if (intRecordsReturned != 0)
                    {
                        blnItemNotFound      = false;
                        intProjectID         = MainWindow.TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].ProjectID;
                        strAssignedProjectID = MainWindow.TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].AssignedProjectID;
                        strProjectName       = MainWindow.TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].ProjectName;
                        datTransactionDate   = MainWindow.TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].TransactionDate;
                    }
                }

                if (blnItemNotFound == true)
                {
                    MainWindow.TheFindProjectsByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProject);

                    intRecordsReturned = MainWindow.TheFindProjectsByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

                    if (intRecordsReturned != 0)
                    {
                        blnItemNotFound      = false;
                        intProjectID         = MainWindow.TheFindProjectsByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;
                        strAssignedProjectID = MainWindow.TheFindProjectsByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].AssignedProjectID;
                        strProjectName       = MainWindow.TheFindProjectsByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectName;
                        datTransactionDate   = MainWindow.TheFindProjectsByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].TransactionDate;
                    }
                }

                if (blnItemNotFound == true)
                {
                    MainWindow.TheFindProjectByProjectNameDataSet = TheProjectClass.FindProjectByProjectName(strProject);

                    intRecordsReturned = MainWindow.TheFindProjectByProjectNameDataSet.FindProjectByProjectName.Rows.Count;

                    if (intRecordsReturned != 0)
                    {
                        blnItemNotFound      = false;
                        intProjectID         = MainWindow.TheFindProjectByProjectNameDataSet.FindProjectByProjectName[0].ProjectID;
                        strAssignedProjectID = MainWindow.TheFindProjectByProjectNameDataSet.FindProjectByProjectName[0].AssignedProjectID;
                        strProjectName       = MainWindow.TheFindProjectByProjectNameDataSet.FindProjectByProjectName[0].ProjectName;
                        datTransactionDate   = MainWindow.TheFindProjectByProjectNameDataSet.FindProjectByProjectName[0].TransactionDate;
                    }
                }

                if (blnItemNotFound == true)
                {
                    TheMessagesClass.InformationMessage("Project Not Found");
                    return;
                }

                txtAssignedProjectID.Text = strAssignedProjectID;
                txtProjectID.Text         = Convert.ToString(intProjectID);
                txtProjectName.Text       = strProjectName;
                txtTransactionDate.Text   = Convert.ToString(datTransactionDate);
                mitSave.IsEnabled         = true;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Edit Project // Find Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Ejemplo n.º 4
0
        private void mitSave_Click(object sender, RoutedEventArgs e)
        {
            string strAssignedProjectID;
            string strProjectName;
            bool   blnFatalError   = false;
            string strErrorMessage = "";
            int    intRecordsReturned;
            bool   blnDIDExists;
            bool   blnNameExists;

            try
            {
                //beginning data validation
                strAssignedProjectID = txtAssignedProjectID.Text;
                strProjectName       = txtProjectName.Text;
                blnDIDExists         = false;
                blnNameExists        = false;

                if (strAssignedProjectID == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Assigned Project ID Was Not Entered\n";
                }
                if (strProjectName == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Project Name Was Not Entered\n";
                }
                else
                {
                    TheFindProjectByProjectNameDataSet = TheProjectClass.FindProjectByProjectName(strProjectName);

                    intRecordsReturned = TheFindProjectByProjectNameDataSet.FindProjectByProjectName.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        blnNameExists = true;
                    }
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strAssignedProjectID);

                intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

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


                if ((blnDIDExists == true) && (blnNameExists == true))
                {
                    TheMessagesClass.ErrorMessage("This Project Currently Exists");
                    return;
                }

                blnFatalError = TheProjectClass.InsertProject(strAssignedProjectID, strProjectName);
                if (blnFatalError == true)
                {
                    throw new Exception();
                }

                TheMessagesClass.InformationMessage("The Project Has Been Saved");
                txtAssignedProjectID.Text = "";
                txtProjectName.Text       = "";
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Add Project // Save Menu Item " + Ex.Message);

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