Example #1
0
        public FindEmployeePunchesByManagerIDDataSet FindEmployeePunchesByManagerID(int intManagerID, DateTime datStartDate, DateTime datEndDate)
        {
            try
            {
                aFindEmployeePunchesByManagerIDDataSet      = new FindEmployeePunchesByManagerIDDataSet();
                aFindEmployeePunchesByManagerIDTableAdapter = new FindEmployeePunchesByManagerIDDataSetTableAdapters.FindEmployeePunchesByManagerIDTableAdapter();
                aFindEmployeePunchesByManagerIDTableAdapter.Fill(aFindEmployeePunchesByManagerIDDataSet.FindEmployeePunchesByManagerID, intManagerID, datStartDate, datEndDate);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Employee Punched Hours Class // Find Employee Punches By Manager ID " + Ex.Message);
            }

            return(aFindEmployeePunchesByManagerIDDataSet);
        }
        private void CboSelectManager_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //setting local variables
            int      intManagerID     = 0;
            int      intSelectedIndex = 0;
            string   strValueForValidation;
            bool     blnThereIsAProblem = false;
            bool     blnFatalError      = false;
            string   strErrorMessage    = "";
            DateTime datStartDate       = DateTime.Now;
            DateTime datEndDate         = DateTime.Now;

            if (cboSelectManager.SelectedIndex > 0)
            {
                try
                {
                    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 (cboSelectManager.SelectedIndex < 1)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Manager Was Not Selected\n";
                    }
                    else
                    {
                        intSelectedIndex = cboSelectManager.SelectedIndex - 1;
                        intManagerID     = TheFindSortedEmployeeManagersDataSet.FindSortedEmployeeManagers[intSelectedIndex].employeeID;
                    }
                    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\n");
                            return;
                        }
                    }

                    TheFindEmployeePunchesByManagerIDDataSet = TheEmployeePunchedHoursClass.FindEmployeePunchesByManagerID(intManagerID, datStartDate, datEndDate);

                    dgrResults.ItemsSource = TheFindEmployeePunchesByManagerIDDataSet.FindEmployeePunchesByManagerID;
                }
                catch (Exception Ex)
                {
                    TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Employee Hours Punched // Combo Box Selection " + Ex.Message);

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