private void UpdateDatabase() { DB.Open(); DB.BeginTransaction(); try { int companyId = Int32.Parse(hdfCompanyId.Value); DateTime creationDate = DateTime.Now; ToDoListAddBasicInformation toDoListAddBasicInformation = new ToDoListAddBasicInformation(toDoListAddTDS); hdfToDoId.Value = toDoListAddBasicInformation.Save(creationDate, companyId).ToString(); DB.CommitTransaction(); // Store datasets toDoListAddTDS.AcceptChanges(); Session["toDoListAddTDS"] = toDoListAddTDS; } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
private void PostPageChanges() { int companyId = Int32.Parse(hdfCompanyId.Value); string subject = hdfSubject.Value; string comments = hdfComments.Value; DateTime? dueDate = null; if (hdfDueDate.Value != "") dueDate = DateTime.Parse(hdfDueDate.Value); int? unitId = null; if (hdfUnitId.Value != "-1") unitId = Int32.Parse(hdfUnitId.Value); int assignTeamMemberId = Int32.Parse(hdfTeamMemberId.Value); string state = "New"; string type_ = "AssignUser"; int loginId = Convert.ToInt32(Session["loginID"]); EmployeeGateway employeeGateway = new EmployeeGateway(new DataSet()); hdfTeamMemberId.Value = employeeGateway.GetEmployeIdByLoginId(loginId).ToString(); int employeeId = Int32.Parse(hdfTeamMemberId.Value); // Insert to dataset ToDoListAddBasicInformation toDoListAddBasicInformation = new ToDoListAddBasicInformation(toDoListAddTDS); toDoListAddBasicInformation.Insert(subject, comments, dueDate, unitId, assignTeamMemberId, false, companyId, state, employeeId, type_); // Store session Session["toDoListAddTDS"] = toDoListAddTDS; }