Пример #1
0
        public FindWorkTaskDepartmentByLOBDepartmentDataSet FindWorkTaskDepartmentByLOBDepartment(int intBusinessLineID, int intDepartmentID)
        {
            try
            {
                aFindWorkTaskDepartmentByLOBDepartmentDataSet      = new FindWorkTaskDepartmentByLOBDepartmentDataSet();
                aFindWorkTaskDepartmentByLOBDepartmentTableAdapter = new FindWorkTaskDepartmentByLOBDepartmentDataSetTableAdapters.FindWorkTaskDepartmentByLOBDepartmentTableAdapter();
                aFindWorkTaskDepartmentByLOBDepartmentTableAdapter.Fill(aFindWorkTaskDepartmentByLOBDepartmentDataSet.FindWorkTaskDepartmentByLOBDepartment, intBusinessLineID, intDepartmentID);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Work Task Class // Find Work Task Department By LOB Department " + Ex.Message);
            }

            return(aFindWorkTaskDepartmentByLOBDepartmentDataSet);
        }
        private void UpdateGrid()
        {
            int      intCounter;
            int      intNumberOfRecords;
            DateTime datTransactionDate;
            int      intWorkTaskID;
            decimal  decTotalCount;
            decimal  decTaskCount = 0;
            decimal  decPercentage;
            int      intGreaterThan;
            int      intRecordsReturned;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                TheProductionTasksForSheetsDataSet.productiontasks.Rows.Clear();

                datTransactionDate = DateTime.Now;

                datTransactionDate = TheDateSearchClass.SubtractingDays(datTransactionDate, 90);

                TheFindWorkTaskIDTotalCountByDateDataSet = TheWorkTaskClass.FindWorkTaskIDTotalCountByDate(datTransactionDate);

                TheFindWorkTaskDepartmentByLOBDepartmentDataSet = TheWorkTaskClass.FindWorkTaskDepartmentByLOBDepartment(gintBusinessLineID, gintDepartmentID);

                decTotalCount = Convert.ToDecimal(TheFindWorkTaskIDTotalCountByDateDataSet.FindWorkTaskIDTotalCountByDate[0].TotalCount);

                intNumberOfRecords = TheFindWorkTaskDepartmentByLOBDepartmentDataSet.FindWorkTaskDepartmentByLOBDepartment.Rows.Count;

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        intWorkTaskID = TheFindWorkTaskDepartmentByLOBDepartmentDataSet.FindWorkTaskDepartmentByLOBDepartment[intCounter].WorkTaskID;

                        TheFindWorkTaskUsageByDateTaskDataSet = TheWorkTaskClass.FindWorkTaskUsageByDateTask(datTransactionDate, intWorkTaskID);

                        intRecordsReturned = TheFindWorkTaskUsageByDateTaskDataSet.FindWorkTaskUsageByDateTask.Rows.Count;

                        if (intRecordsReturned < 1)
                        {
                            decTaskCount = 0;
                        }
                        else if (intRecordsReturned > 0)
                        {
                            decTaskCount = Convert.ToDecimal(TheFindWorkTaskUsageByDateTaskDataSet.FindWorkTaskUsageByDateTask[0].TotalCount);
                        }

                        decPercentage = decTaskCount / decTotalCount;

                        ProductionTasksForSheetsDataSet.productiontasksRow NewProductionCode = TheProductionTasksForSheetsDataSet.productiontasks.NewproductiontasksRow();

                        NewProductionCode.WorkTask = TheFindWorkTaskDepartmentByLOBDepartmentDataSet.FindWorkTaskDepartmentByLOBDepartment[intCounter].WorkTask;

                        intGreaterThan = decimal.Compare(decPercentage, Convert.ToDecimal(.001));

                        if (intGreaterThan < 0)
                        {
                            NewProductionCode.UseCode = false;
                        }
                        else if (intGreaterThan > -1)
                        {
                            NewProductionCode.UseCode = true;
                        }

                        TheProductionTasksForSheetsDataSet.productiontasks.Rows.Add(NewProductionCode);
                    }
                }

                dgrProductionCodes.ItemsSource = TheProductionTasksForSheetsDataSet.productiontasks;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Create Production Sheet // Update Grid " + Ex.Message);

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

            PleaseWait.Close();
        }