/// <summary> /// InitData /// </summary> protected override void InitData() { _data = new TimesheetTDS(); }
private void UpdateTimesheet() { int employeeId = Int32.Parse(hdfEmployeeID.Value); int periodId = Int32.Parse(hdfPeriodId.Value); TimesheetTDS timesheetTDS = new TimesheetTDS(); TimesheetGateway timesheetGateway = new TimesheetGateway(timesheetTDS); timesheetGateway.LoadByEmployeeIdPayPeriodId(employeeId, periodId); LiquiForce.LFSLive.BL.LabourHours.Timesheet.Timesheet timesheet = new LiquiForce.LFSLive.BL.LabourHours.Timesheet.Timesheet(timesheetTDS); // Approve timesheet if (ViewState["timesheetState"].ToString() == "Approved") { EmployeeGateway employeeGateway1 = new EmployeeGateway(new DataSet()); ViewState["approved_by_id"] = employeeGateway1.GetEmployeIdByLoginId(Convert.ToInt32(Session["loginID"])); timesheet.Approve(employeeId, periodId, (int)ViewState["approved_by_id"]); } // Reject timesheet if (ViewState["timesheetState"].ToString() == "Rejected") { timesheet.Reject(employeeId, periodId); } // Submit timesheet if (ViewState["timesheetState"].ToString() == "Submitted") { timesheet.Submit(employeeId, periodId); } try { timesheetGateway.Update2(); timesheetTDS.AcceptChanges(); } catch (Exception ex) { string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }