private void UpdateDatabase() { try { ProjectTimeGateway projectTimeGateway = new ProjectTimeGateway(projectTimeTDS); projectTimeGateway.Update2(); //TimesheetTDS timesheetTDS = new TimesheetTDS(); //TimesheetGateway timesheetGateway = new TimesheetGateway(timesheetTDS); //timesheetGateway.LoadByEmployeeIdPayPeriodId((int)ViewState["employee_id"], (int)ViewState["period_id"]); //if (timesheetGateway.Table.Rows.Count == 0) //{ // LiquiForce.LFSLive.BL.LabourHours.Timesheet.Timesheet timesheet = new LiquiForce.LFSLive.BL.LabourHours.Timesheet.Timesheet(timesheetTDS); // timesheet.SetForApproval((int)ViewState["employee_id"], (int)ViewState["period_id"]); // timesheetGateway.Update(); // timesheetTDS.AcceptChanges(); //} projectTimeTDS.AcceptChanges(); Session["projectTimeTDS"] = projectTimeTDS; //if (ViewState["timesheetState"].ToString() != "For Approval") //{ // UpdateTimesheet(); //} } catch (Exception ex) { string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }