private void UpdateDatabase()
        {
            DB.Open();
            DB.BeginTransaction();
            try
            {
                double newTakenDays = double.Parse(tbxMax.Text) - double.Parse(tbxRemaining.Text);
                VacationsInformationRequestsInformation vacationsInformationRequestsInformation = new VacationsInformationRequestsInformation(vacationsInformationTDS);
                vacationsInformationRequestsInformation.SaveForEdit(newTakenDays);

                VacationsInformationDaysInformation vacationsInformationDaysInformation = new VacationsInformationDaysInformation(vacationsInformationTDS);
                vacationsInformationDaysInformation.Save();

                vacationsInformationTDS.AcceptChanges();

                // Store dataset
                Session["vacationsInformationTDS"] = vacationsInformationTDS;
                Session["vacationDaysInformation"] = vacationsInformationTDS.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 UpdateDatabase(string newState)
        {
            DB.Open();
            DB.BeginTransaction();
            try
            {
                VacationsInformationRequestsInformation vacationsInformationRequestsInformation = new VacationsInformationRequestsInformation(vacationsInformationTDS);
                vacationsInformationRequestsInformation.Save();

                vacationsInformationTDS.AcceptChanges();

                Session["vacationsInformationTDS"] = vacationsInformationTDS;

                SendMailEmployee(newState);

                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()
        {
            VacationsInformationRequestsInformation vacationsInformationRequestsInformation = new VacationsInformationRequestsInformation(vacationsInformationTDS);
            DataRow[] drarray;
            drarray = vacationsInformationTDS.DaysInformation.Select("Deleted = 0", "StartDate ASC", DataViewRowState.CurrentRows);

            // If there are no vacations
            if (drarray.Length <= 0)
            {
                vacationsInformationRequestsInformation.Delete(Int32.Parse(hdfRequestId.Value));
            }
            else
            {
                // If there are vacations
                vacationsInformationRequestsInformation.Update(Int32.Parse(hdfRequestId.Value), GetStartDate(), GetEndDate(), GetTotalPaidVacationDays(), tbxComments.Text, GetDetails());
            }

            // Store dataset
            Session["vacationsInformationTDS"] = vacationsInformationTDS;
            Session["vacationDaysInformation"] = vacationsInformationTDS.DaysInformation;
        }
        private void PostPageChanges(string newState)
        {
            VacationsInformationRequestsInformation vacationsInformationRequestsInformation = new VacationsInformationRequestsInformation(vacationsInformationTDS);

            // Update grid rows
            foreach (GridViewRow row in grdVacations.Rows)
            {
                int requestId = Int32.Parse(grdVacations.DataKeys[row.RowIndex].Values["RequestID"].ToString());
                if (((CheckBox)row.FindControl("cbxSelected")).Checked)
                {
                    if (newState == "Rejected")
                    {
                        string rejectReason = ((TextBox)row.FindControl("tbxRejectReason")).Text;
                        vacationsInformationRequestsInformation.UpdateVacationsForApproval(requestId, newState, rejectReason);
                    }
                    else
                    {
                        vacationsInformationRequestsInformation.UpdateState(requestId, newState);
                    }
                }
            }

            // Store datasets
            Session["vacationsInformationTDS"] = vacationsInformationTDS;
        }