public FindEmployeeOverNightWorkByManagerIDDataSet FindEmployeeOverNightWorkByManagerID(int intManagerID, DateTime datStartDate, DateTime datEndDate)
        {
            try
            {
                aFindEmployeeOverNightWorkByManagerIDDataSet      = new FindEmployeeOverNightWorkByManagerIDDataSet();
                aFindEmployeeOverNightWorkByManagerIDTableAdapter = new FindEmployeeOverNightWorkByManagerIDDataSetTableAdapters.FindEmployeeOverNightWorkByManagerIDTableAdapter();
                aFindEmployeeOverNightWorkByManagerIDTableAdapter.Fill(aFindEmployeeOverNightWorkByManagerIDDataSet.FindEmployeeOverNightWorkByManagerID, intManagerID, datStartDate, datEndDate);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "After Hours Work Class // Find Employee Over Night Work By Manager ID " + Ex.Message);
            }

            return(aFindEmployeeOverNightWorkByManagerIDDataSet);
        }
Ejemplo n.º 2
0
        private void expSubmitForm_Expanded(object sender, RoutedEventArgs e)
        {
            int      intCounter;
            int      intNumberOfRecords;
            int      intManagerID;
            int      intWarehouseID;
            int      intDepartmentID;
            int      intEmployeeID;
            int      intProjectID;
            int      intVehicleID;
            DateTime datWorkDate = DateTime.Now;
            string   strOutTime;
            string   strWorkLocation;
            string   strInETA;
            bool     blnFatalError   = false;
            DateTime datStartDate    = DateTime.Now;
            DateTime datLimitingDate = DateTime.Now;
            DateTime datEndDate;

            try
            {
                expSubmitForm.IsExpanded = false;
                intNumberOfRecords       = TheSubmitAfterHoursWorkDataSet.submitafterhourswork.Rows.Count;

                for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                {
                    intManagerID    = TheSubmitAfterHoursWorkDataSet.submitafterhourswork[intCounter].ManagerID;
                    intWarehouseID  = TheSubmitAfterHoursWorkDataSet.submitafterhourswork[intCounter].WarehouseID;
                    intDepartmentID = TheSubmitAfterHoursWorkDataSet.submitafterhourswork[intCounter].DepartmentID;
                    intEmployeeID   = TheSubmitAfterHoursWorkDataSet.submitafterhourswork[intCounter].EmployeeID;
                    intProjectID    = TheSubmitAfterHoursWorkDataSet.submitafterhourswork[intCounter].ProjectID;
                    intVehicleID    = TheSubmitAfterHoursWorkDataSet.submitafterhourswork[intCounter].VehicleID;
                    datWorkDate     = TheSubmitAfterHoursWorkDataSet.submitafterhourswork[intCounter].WorkDate;
                    strOutTime      = TheSubmitAfterHoursWorkDataSet.submitafterhourswork[intCounter].OutTime;
                    strWorkLocation = TheSubmitAfterHoursWorkDataSet.submitafterhourswork[intCounter].WorkLocation;
                    strInETA        = TheSubmitAfterHoursWorkDataSet.submitafterhourswork[intCounter].InETA;

                    if (datWorkDate > datLimitingDate)
                    {
                        datLimitingDate = datWorkDate;
                    }

                    blnFatalError = TheAfterHoursClass.InsertEmployeeOverNightWork(intWarehouseID, intDepartmentID, intEmployeeID, intManagerID, intVehicleID, intProjectID, datWorkDate, strOutTime, strWorkLocation, strInETA, DateTime.Now);

                    if (blnFatalError == true)
                    {
                        throw new Exception();
                    }
                }

                datStartDate = TheDateSearchClass.RemoveTime(datStartDate);
                datEndDate   = TheDateSearchClass.AddingDays(datLimitingDate, 1);
                intManagerID = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID;

                TheFindEmployeeOverNightWorkByManagerIDDataSet = TheAfterHoursClass.FindEmployeeOverNightWorkByManagerID(intManagerID, datStartDate, datEndDate);

                CreateMessage();

                TheMessagesClass.InformationMessage("The Report has been Sent\n");

                ResetControls();
                TheSubmitAfterHoursWorkDataSet.submitafterhourswork.Rows.Clear();
                TheEmployeeAssignedDataSet.employeesassigned.Rows.Clear();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Submit After Hours Work // Submit Form Expander " + Ex.Message);

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