public string UpdateTimeSheet(TimeSheetRequest request)
        {
            DataAccess.Core.DATimeSheet service = new DataAccess.Core.DATimeSheet();
            DataAccess.EmployeeTimeSheet entity = new DataAccess.EmployeeTimeSheet();

            if (new Guid(request.Id) == Guid.Empty)
                entity.Id = Guid.NewGuid();
            else
                entity.Id = new Guid(request.Id);

            entity.EmployeeId = new Guid(request.EmpId);
            entity.ReportedDate = DateTime.Parse(request.Date);
            entity.DateTimeIn = DateTime.Parse(request.DateTimeIn);
            entity.DateTimeOut = DateTime.Parse(request.DateTimeOut);

            if (entity.DateTimeIn.HasValue)
            {
                if (entity.DateTimeIn.Value.Date != entity.ReportedDate)
                    return ("Date time-in should be equal to Reported date");

                if (entity.DateTimeOut < entity.DateTimeIn)
                    return ("Date time-out cannot be less than Date time-in");
            }
            else
            {
                if (entity.DateTimeOut.HasValue)
                    return ("Date time-in is required");
            }

            if (new Guid(request.Id) == Guid.Empty)
                service.Create(entity);
            else
                service.Update(entity);

            /*Return list of timesheet*/

            var startDate = DateTime.Now.GetFirstDayOfWeek().Date.AddDays(1); ;

            FormlessPage page = new FormlessPage();
            var ctrl = (Payroll.Web.Pages.TimeSheet.TimeSheetList)page.LoadControl("~/Pages/TimeSheet/TimeSheetList.ascx");

            ctrl.EmployeeId = new Guid(request.EmpId);
            ctrl.StartDate = DateTime.Now.GetFirstDayOfWeek().Date.AddDays(1);

            page.Controls.Add(ctrl);

            return page.RenderPage();
        }
        public string CreateTimeSheet(TimeSheetRequest request)
        {
            DataAccess.Core.DATimeSheet service = new DataAccess.Core.DATimeSheet();
            DataAccess.EmployeeTimeSheet entity = new DataAccess.EmployeeTimeSheet();
            entity.Id = Guid.NewGuid();
            entity.EmployeeId = new Guid(request.EmpId);
            entity.ReportedDate = DateTime.Parse( request.Date );
            entity.DateTimeIn = DateTime.Parse(request.DateTimeIn);
            entity.DateTimeOut = DateTime.Parse(request.DateTimeOut);

            if (entity.DateTimeIn.HasValue)
            {
                if (entity.DateTimeIn.Value.Date != entity.ReportedDate)
                    return ("Date time-in should be equal to Reported date");

                if (entity.DateTimeOut < entity.DateTimeIn)
                    return ("Date time-out cannot be less than Date time-in");
            }
            else
            {
                if (entity.DateTimeOut.HasValue)
                    return ("Date time-in is required");
            }

            service.Create(entity);
            return "Saving successful";
        }