private void UpdateDatabase() { DB.Open(); DB.BeginTransaction(); try { double oldTotalTakenVacationDays = double.Parse(tbxMax.Text) - double.Parse(tbxRemaining.Text); VacationsAddRequestsInformation vacationsAddRequestsInformation = new VacationsAddRequestsInformation(vacationsAddTDS); int requestId = vacationsAddRequestsInformation.Save(oldTotalTakenVacationDays); VacationsAddDaysInformation vacationsAddDaysInformation = new VacationsAddDaysInformation(vacationsAddTDS); vacationsAddDaysInformation.Save(requestId); vacationsAddTDS.AcceptChanges(); // Store dataset Session["vacationsAddTDS"] = vacationsAddTDS; Session["vacationDaysInformation"] = vacationsAddTDS.DaysInformation; DB.CommitTransaction(); } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
private void PostPageChanges() { // all vacations starts as approved VacationsAddRequestsInformation vacationsAddRequestsInformation = new VacationsAddRequestsInformation(vacationsAddTDS); vacationsAddRequestsInformation.Insert(Int32.Parse(hdfEmployeeId.Value), GetStartDate(), GetEndDate(), GetTotalPaidVacationDays(), "Approved", tbxComments.Text, GetDetails(), false, Int32.Parse(hdfCompanyId.Value)); // Store dataset Session["vacationsAddTDS"] = vacationsAddTDS; Session["vacationDaysInformation"] = vacationsAddTDS.DaysInformation; }