Exemplo n.º 1
0
        /**Method to insert TimeSheet data into the TimeSheet data table**/
        public void InsertTimeSheet(TimeSheet sheet)
        {
            WeeklyReport weeklyReport = new WeeklyReport();

            db.TimeSheets.Add(sheet);
            db.SaveChanges();

            weeklyReport.getWeeklyReport(sheet.Banner_ID, sheet.WeekEnding.Trim());
        }
Exemplo n.º 2
0
        /**Queries the Weekly Report Table for all timesheets for a specific employee then creates
         * a list of weekly timesheets with disticted weekend dates**/
        public WeeklyReport getWeeklyReport(int Banner_ID, string wEnd)
        {
            var wReport = (from wr in db.WeeklyReports
                           where wr.Banner_ID == Banner_ID && wr.WeekEnding == wEnd.Trim()
                           select wr);

            var count = wReport.Count();

            Debug.WriteLine("(((((( THE COUNT IS: )))) " + count);
            if (count == 0)
            {
                WeeklyReport report = new WeeklyReport
                {
                    Id               = this.GetMaxWeeklyReportId() + 1,
                    WeekEnding       = wEnd.Trim(),
                    Banner_ID        = Banner_ID,
                    LeaveHours       = "",
                    AdditionalHours  = "",
                    HoursWorked      = "",
                    TotalHoursWorked = "",
                    Overtime         = "",
                    FLSA_Overtime    = "",
                    SupervisorName   = "",
                    TimesheetStatus  = "",
                    EmployeeName     = "",
                };

                this.InsertWeeklyReport(report);
                report.CalculateWeeklyReport(Banner_ID, wEnd.Trim());
                report.UpdateWeeklyReport(report);
                return(report);
            }
            else
            {
                WeeklyReport report = new WeeklyReport();
                report = wReport.First();
                Debug.WriteLine("Report_ID: " + report.Id + " WeekEnding: " + report.WeekEnding + " Banner_ID: " + report.Banner_ID + " leaveHours: " + report.LeaveHours + " AdditionalHours: " + report.AdditionalHours + " HoursWorked: " + report.HoursWorked + " TotalHours: " + report.TotalHoursWorked + " Overtime: " + report.Overtime + " FLSA: " + report.FLSA_Overtime + " Supervisor: " + report.SupervisorName + " Status: " + report.TimesheetStatus + " Employee: " + report.EmployeeName + " poiuy");
                report.CalculateWeeklyReport(Banner_ID, wEnd.Trim());
                report.UpdateWeeklyReport(report);
                return(report);
            }
        }
Exemplo n.º 3
0
        /**Updates a specifc Weekly Report with all recieved information**/
        public void UpdateWeeklyReport(WeeklyReport report)
        {
            WeeklyReport wReport = (from wr in db.WeeklyReports
                                    where wr.Id == report.Id
                                    select wr).Single();

            Debug.WriteLine("Report_ID: " + report.Id + " WeekEnding: " + report.WeekEnding + " Banner_ID: " + report.Banner_ID + " leaveHours: " + report.LeaveHours + " AdditionalHours: " + report.AdditionalHours + " HoursWorked: " + report.HoursWorked + " TotalHours: " + report.TotalHoursWorked + " Overtime: " + report.Overtime + " FLSA: " + report.FLSA_Overtime + " Supervisor: " + report.SupervisorName + " Status: " + report.TimesheetStatus + " Employee: " + report.EmployeeName + " QWERTY");
            wReport.Id               = report.Id;
            wReport.WeekEnding       = report.WeekEnding.Trim();
            wReport.Banner_ID        = report.Banner_ID;
            wReport.LeaveHours       = report.LeaveHours;
            wReport.AdditionalHours  = report.AdditionalHours;
            wReport.HoursWorked      = report.HoursWorked;
            wReport.TotalHoursWorked = report.TotalHoursWorked;
            wReport.Overtime         = report.Overtime;
            wReport.FLSA_Overtime    = report.FLSA_Overtime;
            wReport.SupervisorName   = report.SupervisorName;
            wReport.TimesheetStatus  = report.TimesheetStatus;
            wReport.EmployeeName     = report.EmployeeName;

            db.SaveChanges();
        }
Exemplo n.º 4
0
        /**Method to update TimeSheet data in the TimeSheet data table**/
        public void UpdateTimeSheet(TimeSheet sheet)
        {
            WeeklyReport weeklyReport = new WeeklyReport();

            Debug.WriteLine("in database save 1");
            Debug.WriteLine("******************************************************************************************************** " + sheet.LeaveId);
            Debug.WriteLine("With sheet id: " + sheet.Id + "]");

            string timeIn      = "";
            string outForLunch = "";
            string inFromLunch = "";
            string timeOut     = "";

            if (!String.IsNullOrEmpty(sheet.TimeIn.Trim()))
            {
                timeIn = sheet.TimeIn;
            }
            else
            {
                timeIn = "";
            }
            if (!String.IsNullOrEmpty(sheet.OutForLunch.Trim()))
            {
                outForLunch = sheet.OutForLunch;
            }
            else
            {
                outForLunch = "";
            }
            if (!String.IsNullOrEmpty(sheet.InFromLunch.Trim()))
            {
                inFromLunch = sheet.InFromLunch;
            }
            else
            {
                inFromLunch = "";
            }
            if (!String.IsNullOrEmpty(sheet.TimeOut.Trim()))
            {
                timeOut = sheet.TimeOut;
            }
            else
            {
                timeOut = "";
            }

            TimeSheet tsheet = (from tsheets in db.TimeSheets
                                where tsheets.Id == sheet.Id
                                select tsheets).Single();

            Debug.WriteLine("The sheet is: " + sheet.Note + "]");
            tsheet.Id                     = sheet.Id;
            tsheet.WeekEnding             = sheet.WeekEnding;
            tsheet.Date                   = sheet.Date;
            tsheet.TimeIn                 = timeIn;
            tsheet.OutForLunch            = outForLunch;
            tsheet.InFromLunch            = inFromLunch;
            tsheet.TimeOut                = timeOut;
            tsheet.LeaveId                = sheet.LeaveId;
            tsheet.LeaveHours             = sheet.LeaveHours;
            tsheet.AdditionalHours        = sheet.AdditionalHours;
            tsheet.TotalHoursWorked       = tsheet.CalculateTotalHoursWorked(sheet);
            tsheet.Submitted              = sheet.Submitted;
            tsheet.AuthorizedBySupervisor = sheet.AuthorizedBySupervisor;
            tsheet.Banner_ID              = sheet.Banner_ID;
            tsheet.Note                   = sheet.Note;
            Debug.WriteLine("The tsheet is :" + sheet.LeaveId + "55555555555555]");

            db.SaveChanges();

            weeklyReport.getWeeklyReport(sheet.Banner_ID, sheet.WeekEnding.Trim());
        }
Exemplo n.º 5
0
 /**Inserts a created weekly report into the weekly report table**/
 public void InsertWeeklyReport(WeeklyReport report)
 {
     db.WeeklyReports.Add(report);
     db.SaveChanges();
 }