private void LoadGrid()
        {
            int intEmployeeCounter;
            int intEmployeeNumberOfRecords;
            int intToolCounter;
            int intToolNumberOfRecords;
            int intEmployeeID;
            int intCurrentLocation;

            try
            {
                TheCurrentToolsDataSet.currenttools.Rows.Clear();

                TheFindDeactivatedEmployeesDataSet = TheEmployeeClass.FindDeactivatedEmployees();

                intEmployeeNumberOfRecords = TheFindDeactivatedEmployeesDataSet.FindDeactivatedEmployees.Rows.Count - 1;

                for (intEmployeeCounter = 0; intEmployeeCounter <= intEmployeeNumberOfRecords; intEmployeeCounter++)
                {
                    intEmployeeID = TheFindDeactivatedEmployeesDataSet.FindDeactivatedEmployees[intEmployeeCounter].EmployeeID;

                    TheFindToolsByEmployeeIDDataSet = TheToolsClass.FindToolsByEmployeeID(intEmployeeID);

                    intToolNumberOfRecords = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID.Rows.Count - 1;

                    if (intToolNumberOfRecords > -1)
                    {
                        for (intToolCounter = 0; intToolCounter <= intToolNumberOfRecords; intToolCounter++)
                        {
                            intCurrentLocation = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intToolCounter].CurrentLocation;

                            TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intCurrentLocation);

                            CurrentToolsDataSet.currenttoolsRow NewToolRow = TheCurrentToolsDataSet.currenttools.NewcurrenttoolsRow();

                            NewToolRow.AssignedOffice  = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName;
                            NewToolRow.FirstName       = TheFindDeactivatedEmployeesDataSet.FindDeactivatedEmployees[intEmployeeCounter].FirstName;
                            NewToolRow.LastName        = TheFindDeactivatedEmployeesDataSet.FindDeactivatedEmployees[intEmployeeCounter].LastName;
                            NewToolRow.ToolID          = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intToolCounter].ToolID;
                            NewToolRow.Description     = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intToolCounter].ToolDescription;
                            NewToolRow.TransactionDate = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intToolCounter].TransactionDate;

                            TheCurrentToolsDataSet.currenttools.Rows.Add(NewToolRow);
                        }
                    }
                }

                dgrTools.ItemsSource = TheCurrentToolsDataSet.currenttools;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Deactivate Employee Tools // Load Grid " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Example #2
0
        public FindToolsByEmployeeIDDataSet FindToolsByEmployeeID(int intEmployeeID)
        {
            try
            {
                aFindToolsByEmployeeIDDataSet      = new FindToolsByEmployeeIDDataSet();
                aFindToolsbyEmployeeIDTableAdapter = new FindToolsByEmployeeIDDataSetTableAdapters.FindToolsByEmployeeIDTableAdapter();
                aFindToolsbyEmployeeIDTableAdapter.Fill(aFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID, intEmployeeID);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Tools Class // Find Tools By Employee ID " + Ex.Message);
            }

            return(aFindToolsByEmployeeIDDataSet);
        }
        private void cboSelectEmployee_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int intSelectedIndex;
            int intCounter;
            int intNumberOfRecords;

            try
            {
                intSelectedIndex = cboSelectEmployee.SelectedIndex - 1;

                if (intSelectedIndex > -1)
                {
                    TheEmployeeToolsDataSet.employeetools.Rows.Clear();

                    MainWindow.gintEmployeeID = TheFindEmployeeByLastNameDataSet.FindEmployeeByLastName[intSelectedIndex].EmployeeID;
                    MainWindow.gstrFirstName  = TheFindEmployeeByLastNameDataSet.FindEmployeeByLastName[intSelectedIndex].FirstName;
                    MainWindow.gstrLastName   = TheFindEmployeeByLastNameDataSet.FindEmployeeByLastName[intSelectedIndex].LastName;

                    TheFindToolsByEmployeeIDDataSet = TheToolsClass.FindToolsByEmployeeID(MainWindow.gintEmployeeID);

                    intNumberOfRecords = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID.Rows.Count - 1;

                    if (intNumberOfRecords > -1)
                    {
                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            EmployeeToolsDataSet.employeetoolsRow NewToolRow = TheEmployeeToolsDataSet.employeetools.NewemployeetoolsRow();

                            NewToolRow.ToolID          = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intCounter].ToolID;
                            NewToolRow.ToolCategory    = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intCounter].ToolCategory;
                            NewToolRow.ToolDescription = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intCounter].ToolDescription;
                            NewToolRow.ToolNotes       = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intCounter].ToolNotes;
                            NewToolRow.TransactionDate = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intCounter].TransactionDate;
                            NewToolRow.Quantity        = 1;

                            TheEmployeeToolsDataSet.employeetools.Rows.Add(NewToolRow);
                        }
                    }

                    TheBulkToolsCurrentlyAssignedToEmployeeDataSet = TheBulkToolsClass.FindBulkToolsCurrentlyAssignedToEmployee(MainWindow.gintEmployeeID);

                    intNumberOfRecords = TheBulkToolsCurrentlyAssignedToEmployeeDataSet.FindBulkToolsCurrentlyAssignedToEmployee.Rows.Count - 1;

                    if (intNumberOfRecords > -1)
                    {
                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            EmployeeToolsDataSet.employeetoolsRow NewToolRow = TheEmployeeToolsDataSet.employeetools.NewemployeetoolsRow();

                            NewToolRow.ToolID          = "BULK TOOLS";
                            NewToolRow.ToolCategory    = TheBulkToolsCurrentlyAssignedToEmployeeDataSet.FindBulkToolsCurrentlyAssignedToEmployee[intCounter].ToolCategory;
                            NewToolRow.ToolDescription = "BULK TOOL";
                            NewToolRow.ToolNotes       = TheBulkToolsCurrentlyAssignedToEmployeeDataSet.FindBulkToolsCurrentlyAssignedToEmployee[intCounter].IssueNotes;
                            NewToolRow.TransactionDate = TheBulkToolsCurrentlyAssignedToEmployeeDataSet.FindBulkToolsCurrentlyAssignedToEmployee[intCounter].SignOutDate;
                            NewToolRow.Quantity        = TheBulkToolsCurrentlyAssignedToEmployeeDataSet.FindBulkToolsCurrentlyAssignedToEmployee[intCounter].Quantity;

                            TheEmployeeToolsDataSet.employeetools.Rows.Add(NewToolRow);
                        }
                    }

                    dgrTools.ItemsSource = TheEmployeeToolsDataSet.employeetools;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Tools Assigned To Employees // Combo Box Selection " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void cboSelectEmployee_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int intSelectedIndex;
            int intCounter;
            int intNumberOfRecords;
            int intSecondNumberOfRecords;
            int intSecondCounter;
            int intBJCNumber;
            int intToolCounter;
            int intToolNumberOfRecords;

            try
            {
                intSelectedIndex = cboSelectEmployee.SelectedIndex - 1;

                if (intSelectedIndex > -1)
                {
                    TheEmployeeToolsDataSet.employeetools.Rows.Clear();
                    TheVehicleToolsDataSet.vehicletools.Rows.Clear();

                    MainWindow.gintEmployeeID = TheFindEmployeeByLastNameDataSet.FindEmployeeByLastName[intSelectedIndex].EmployeeID;
                    MainWindow.gstrFirstName  = TheFindEmployeeByLastNameDataSet.FindEmployeeByLastName[intSelectedIndex].FirstName;
                    MainWindow.gstrLastName   = TheFindEmployeeByLastNameDataSet.FindEmployeeByLastName[intSelectedIndex].LastName;

                    TheFindToolsByEmployeeIDDataSet = TheToolsClass.FindToolsByEmployeeID(MainWindow.gintEmployeeID);

                    intNumberOfRecords = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID.Rows.Count - 1;

                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        EmployeeToolsDataSet.employeetoolsRow NewToolRow = TheEmployeeToolsDataSet.employeetools.NewemployeetoolsRow();

                        NewToolRow.ToolCategory    = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intCounter].ToolCategory;
                        NewToolRow.ToolDescription = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intCounter].ToolDescription;
                        NewToolRow.ToolNotes       = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intCounter].ToolNotes;
                        NewToolRow.ToolID          = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intCounter].ToolID;
                        NewToolRow.TransactionDate = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intCounter].TransactionDate;

                        TheEmployeeToolsDataSet.employeetools.Rows.Add(NewToolRow);
                    }

                    dgrTools.ItemsSource = TheEmployeeToolsDataSet.employeetools;

                    //checking for a vehicle
                    TheFindVehicleAssigedByEmployeeIDDataSet = TheVehicleMainClass.FindVehicleAssignedByEmployeeID(MainWindow.gintEmployeeID);

                    intNumberOfRecords = TheFindVehicleAssigedByEmployeeIDDataSet.FindVehicleAssignedByEmployeeID.Rows.Count - 1;

                    if (intNumberOfRecords == 0)
                    {
                        txtVehicleAssignment.Text = Convert.ToString(TheFindVehicleAssigedByEmployeeIDDataSet.FindVehicleAssignedByEmployeeID[0].BJCNumber);
                    }
                    else if (intNumberOfRecords > 0)
                    {
                        txtVehicleAssignment.Text = "Multiple";
                    }
                    else
                    {
                        txtVehicleAssignment.Text = "None";
                    }

                    if (intNumberOfRecords > -1)
                    {
                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            intBJCNumber = TheFindVehicleAssigedByEmployeeIDDataSet.FindVehicleAssignedByEmployeeID[intCounter].BJCNumber;

                            TheFindEmployeeByLastNameDataSet = TheEmployeeClass.FindEmployeesByLastNameKeyWord(Convert.ToString(intBJCNumber));

                            intSecondNumberOfRecords = TheFindEmployeeByLastNameDataSet.FindEmployeeByLastName.Rows.Count - 1;

                            for (intSecondCounter = 0; intSecondCounter <= intSecondNumberOfRecords; intSecondCounter++)
                            {
                                gintVehicleEmployeeID = TheFindEmployeeByLastNameDataSet.FindEmployeeByLastName[intSecondCounter].EmployeeID;

                                TheFindToolsByEmployeeIDDataSet = TheToolsClass.FindToolsByEmployeeID(gintVehicleEmployeeID);

                                intToolNumberOfRecords = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID.Rows.Count - 1;

                                if (intToolNumberOfRecords > -1)
                                {
                                    for (intToolCounter = 0; intToolCounter <= intToolNumberOfRecords; intToolCounter++)
                                    {
                                        VehicleToolsDataSet.vehicletoolsRow NewToolRow = TheVehicleToolsDataSet.vehicletools.NewvehicletoolsRow();

                                        NewToolRow.BJCNumber       = intBJCNumber;
                                        NewToolRow.ToolCategory    = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intToolCounter].ToolCategory;
                                        NewToolRow.ToolDescription = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intToolCounter].ToolDescription;
                                        NewToolRow.ToolID          = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intToolCounter].ToolID;
                                        NewToolRow.ToolNotes       = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intToolCounter].ToolNotes;

                                        TheVehicleToolsDataSet.vehicletools.Rows.Add(NewToolRow);
                                    }
                                }
                            }
                        }
                    }

                    dgrVehicleTools.ItemsSource = TheVehicleToolsDataSet.vehicletools;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Terminate Employee // Combo box Change Event " + Ex.Message);

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