Example #1
0
        public FindProjectHoursAboveLimitDataSet FindProjectHoursAboveLimit(int intProjectID, DateTime datStartDate, decimal decUpperLimit)
        {
            try
            {
                aFindProjectHoursAboveLimitDataSet      = new FindProjectHoursAboveLimitDataSet();
                aFindProjectHoursAboveLimitTableAdapter = new FindProjectHoursAboveLimitDataSetTableAdapters.FindProjectHoursAboveLimitTableAdapter();
                aFindProjectHoursAboveLimitTableAdapter.Fill(aFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit, intProjectID, datStartDate, decUpperLimit);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Employee Project Assignement Class // Find Project Hours Above Limit " + Ex.Message);
            }

            return(aFindProjectHoursAboveLimitDataSet);
        }
        private void ResetControls()
        {
            //setting up the local variables
            int      intCounter;
            int      intNumberOfRecords;
            int      intProjectID;
            DateTime datTransactionDate = DateTime.Now;
            DateTime datStartDate       = DateTime.Now;
            decimal  decAveragePayRate;

            try
            {
                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                TheShopViolatorDataSet.violator.Rows.Clear();

                datTransactionDate = TheDateSearchClass.RemoveTime(datTransactionDate);

                datTransactionDate = TheDateSearchClass.SubtractingDays(datTransactionDate, 31);

                TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID("SHOP");

                intProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID;

                datStartDate = TheDateSearchClass.SubtractingDays(datStartDate, 31);

                TheFindProjectStatsDataSet = TheEmployeeProductivityStatsClass.FindProjectStats(intProjectID);

                gdecMean           = TheFindProjectStatsDataSet.FindProjectStats[0].AveHours;
                gdecStandDeviation = Convert.ToDecimal(TheFindProjectStatsDataSet.FindProjectStats[0].HoursSTDev);
                gdecVariance       = Convert.ToDecimal(TheFindProjectStatsDataSet.FindProjectStats[0].HoursVariance);
                gdecTotalHours     = Convert.ToDecimal(TheFindProjectStatsDataSet.FindProjectStats[0].TotalHours);
                decAveragePayRate  = TheFindProjectStatsDataSet.FindProjectStats[0].AveragePayRate;

                gdecMean = Math.Round(gdecMean, 4);

                txtAverageHours.Text = Convert.ToString(gdecMean);

                gdecVariance       = Math.Round(gdecVariance, 4);
                gdecStandDeviation = Math.Round(gdecStandDeviation, 4);

                gdecUpperBound = gdecMean + gdecStandDeviation;

                txtUpperBound.Text = Convert.ToString(gdecUpperBound);

                TheFindProjectHoursAboveLimitDataSet = TheEmployeeProjectAssignmentClass.FindProjectHoursAboveLimit(intProjectID, datStartDate, gdecUpperBound);

                intNumberOfRecords = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit.Rows.Count;

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        ShopViolatorDataSet.violatorRow NewViolatorRow = TheShopViolatorDataSet.violator.NewviolatorRow();

                        NewViolatorRow.FirstName       = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit[intCounter].FirstName;
                        NewViolatorRow.HomeOffice      = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit[intCounter].HomeOffice;
                        NewViolatorRow.Hours           = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit[intCounter].TotalHours;
                        NewViolatorRow.LastName        = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit[intCounter].LastName;
                        NewViolatorRow.TransactionDate = TheFindProjectHoursAboveLimitDataSet.FindProjectHoursAboveLimit[intCounter].TransactionDate;

                        TheShopViolatorDataSet.violator.Rows.Add(NewViolatorRow);
                    }
                }

                dgrResults.ItemsSource = TheShopViolatorDataSet.violator;

                gdecProjectHours    = TheFindProjectStatsDataSet.FindProjectStats[0].TotalHours;
                txtShopHours.Text   = Convert.ToString(gdecProjectHours);
                gdecProjectCost     = gdecProjectHours * decAveragePayRate;
                gdecProjectCost     = Math.Round(gdecProjectCost, 4);
                txtProjectCost.Text = Convert.ToString(gdecProjectCost);

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Shop Hours Analysis // Reset Controls " + Ex.Message);

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