示例#1
0
        public FindDetailEmployeeProductivityOverDateRangeDataSet FindDetailEmployeeProductivityOverDateRange(int intEmployee, DateTime datStartDate, DateTime datEndDate)
        {
            try
            {
                aFindDetailEmployeeProductivityOverDateRangeDataSet      = new FindDetailEmployeeProductivityOverDateRangeDataSet();
                aFindDetailEmployeeProductivityOverDateRangeTableAdapter = new FindDetailEmployeeProductivityOverDateRangeDataSetTableAdapters.FindDetailEmployeeProductivityOverDateRangeTableAdapter();
                aFindDetailEmployeeProductivityOverDateRangeTableAdapter.Fill(aFindDetailEmployeeProductivityOverDateRangeDataSet.FindDetailEmployeeProductivityOverDateRange, intEmployee, datStartDate, datEndDate);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Employee Project Assignment // Find Detail Employee Productivity Over Date Range " + Ex.Message);
            }

            return(aFindDetailEmployeeProductivityOverDateRangeDataSet);
        }
        private void cboSelectEmployee_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int      intSelectedIndex;
            bool     blnFatalError      = false;
            bool     blnThereIsAProblem = false;
            string   strErrorMessage    = "";
            DateTime datStartDate       = DateTime.Now;
            DateTime datEndDate         = DateTime.Now;
            int      intEmployeeID;
            string   strValueForValidation;
            int      intCounter;
            int      intNumberOfRecords;
            int      intManagerID;
            string   strManagerName;

            try
            {
                intSelectedIndex = cboSelectEmployee.SelectedIndex - 1;
                if (intSelectedIndex > -1)
                {
                    intEmployeeID = TheComboEmployeeDataSet.employees[intSelectedIndex].EmployeeID;
                    TheDetailedEmployeeProductivityDataSet.employeeproductivity.Rows.Clear();

                    strValueForValidation = txtStartDate.Text;
                    blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                    if (blnThereIsAProblem == true)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Start Date is not a Date\n";
                    }
                    else
                    {
                        datStartDate = Convert.ToDateTime(strValueForValidation);
                    }
                    strValueForValidation = txtEndDate.Text;
                    blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                    if (blnThereIsAProblem == true)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The End Date is not a Date\n";
                    }
                    else
                    {
                        datEndDate = Convert.ToDateTime(strValueForValidation);
                    }
                    if (blnFatalError == true)
                    {
                        TheMessagesClass.ErrorMessage(strErrorMessage);
                        return;
                    }
                    else
                    {
                        blnFatalError = TheDataValidationClass.verifyDateRange(datStartDate, datEndDate);

                        if (blnFatalError == true)
                        {
                            TheMessagesClass.ErrorMessage("The Start Date is after the End Date");
                            return;
                        }
                    }

                    TheFindDetailEmployeeProductivityOverDateRangeDataSet = TheEmployeeProjectAssignmentClass.FindDetailEmployeeProductivityOverDateRange(intEmployeeID, datStartDate, datEndDate);

                    intNumberOfRecords = TheFindDetailEmployeeProductivityOverDateRangeDataSet.FindDetailEmployeeProductivityOverDateRange.Rows.Count;

                    if (intNumberOfRecords > 0)
                    {
                        for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                        {
                            intManagerID = TheFindDetailEmployeeProductivityOverDateRangeDataSet.FindDetailEmployeeProductivityOverDateRange[intCounter].ManagerID;

                            TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intManagerID);

                            strManagerName  = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName + " ";
                            strManagerName += TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].LastName;

                            DetailedEmployeeProductivityDataSet.employeeproductivityRow NewEmployeeRow = TheDetailedEmployeeProductivityDataSet.employeeproductivity.NewemployeeproductivityRow();

                            NewEmployeeRow.BJCProjectID      = TheFindDetailEmployeeProductivityOverDateRangeDataSet.FindDetailEmployeeProductivityOverDateRange[intCounter].AssignedProjectID;
                            NewEmployeeRow.CustomerProjectID = TheFindDetailEmployeeProductivityOverDateRangeDataSet.FindDetailEmployeeProductivityOverDateRange[intCounter].CustomerAssignedID;
                            NewEmployeeRow.Manager           = strManagerName;
                            NewEmployeeRow.ProjectName       = TheFindDetailEmployeeProductivityOverDateRangeDataSet.FindDetailEmployeeProductivityOverDateRange[intCounter].ProjectName;
                            NewEmployeeRow.TotalHours        = TheFindDetailEmployeeProductivityOverDateRangeDataSet.FindDetailEmployeeProductivityOverDateRange[intCounter].TotalHours;
                            NewEmployeeRow.TransactionDate   = TheFindDetailEmployeeProductivityOverDateRangeDataSet.FindDetailEmployeeProductivityOverDateRange[intCounter].TransactionDate;
                            NewEmployeeRow.WorkTask          = TheFindDetailEmployeeProductivityOverDateRangeDataSet.FindDetailEmployeeProductivityOverDateRange[intCounter].WorkTask;

                            TheDetailedEmployeeProductivityDataSet.employeeproductivity.Rows.Add(NewEmployeeRow);
                        }
                    }

                    dgrResults.ItemsSource = TheDetailedEmployeeProductivityDataSet.employeeproductivity;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Employee Productivity By Date Range // Select Employee Combo Box " + Ex.Message);

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