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());
            }
        }
Beispiel #2
0
        private void cboSelectCategory_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int    intSelectedIndex;
            string strCategory;
            int    intCounter;
            int    intNumberOfRecords;
            int    intCurrentLocation;

            try
            {
                intSelectedIndex = cboSelectCategory.SelectedIndex - 1;

                if (intSelectedIndex > -1)
                {
                    strCategory = TheFindSortedToolCategoryDataSet.FindSortedToolCategory[intSelectedIndex].ToolCategory;
                    TheCurrentToolsDataSet.currenttools.Rows.Clear();

                    TheFindToolsByCategoryDataSet = TheToolsClass.FindToolsByCategory(strCategory);

                    intNumberOfRecords = TheFindToolsByCategoryDataSet.FindToolsByCategory.Rows.Count - 1;

                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        intCurrentLocation = TheFindToolsByCategoryDataSet.FindToolsByCategory[intCounter].CurrentLocation;

                        TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intCurrentLocation);

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

                        NewToolRow.AssignedOffice  = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName;
                        NewToolRow.Description     = TheFindToolsByCategoryDataSet.FindToolsByCategory[intCounter].ToolDescription;
                        NewToolRow.FirstName       = TheFindToolsByCategoryDataSet.FindToolsByCategory[intCounter].FirstName;
                        NewToolRow.LastName        = TheFindToolsByCategoryDataSet.FindToolsByCategory[intCounter].LastName;
                        NewToolRow.ToolID          = TheFindToolsByCategoryDataSet.FindToolsByCategory[intCounter].ToolID;
                        NewToolRow.TransactionDate = TheFindToolsByCategoryDataSet.FindToolsByCategory[intCounter].TransactionDate;

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

                    dgrTools.ItemsSource = TheCurrentToolsDataSet.currenttools;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Current Tool Location // Combo Box Selectiong " + Ex.Message);

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