protected void completeBtn_Click(object sender, EventArgs e) { try { // if chargeable or non chargeable are being edited prompt user to save or update changes, else execute intended code if (activitiesDDL.Items.Count > 0 || specifyDDL.SelectedValue != "Select" || detailsDDL.SelectedValue != "Select") { // throw a dialog msg = "You have Un-Saved work on this Page, Please save,update or Clear the form"; dialogTitle = "Warning: Un-saved Work"; ScriptManager.RegisterStartupScript(this, this.GetType(), "unsavedwork", "throwDialog();", true); } else { TimesheetManager tm = new TimesheetManager(); TimeSheet t = tm.getTimesheetForID(timesheetID); // if the timesheet has been approved or completed, do not save the timesheet if (t.Status != "Approved" && t.Status != "Completed") { tm.updateTimeSheet(timesheetID, Convert.ToDecimal(totalHoursLBL.Text), Convert.ToInt32(totalDistanceLBL.Text), Convert.ToInt32(totalTruckLBL.Text), Convert.ToDecimal(totalExpensesLBL.Text), "Completed", empCommentsTB.Text, " "); // copy all of the timesheet's contents to managerial versions tm.copyTimesheet(timesheetID); dialogTitle = "Timesheet Complete"; msg = "Timesheet Completed and submitted to manager for Approval. You may view but not Re-submit this Timesheet"; ScriptManager.RegisterStartupScript(this, this.GetType(), "timesheetSubmitted", "throwDialog();", true); } else { dialogTitle = "Timesheet Complete"; msg = "Timesheet has already been Completed or Approved. It cannot be re-submitted. Please Speak to Manager"; ScriptManager.RegisterStartupScript(this, this.GetType(), "timesheetSubmitted", "throwDialog();", true); } // Server.Transfer("createTimeSheet.aspx"); } } catch (Exception) { // throw a dialog msg = "Your TimeSheet was not Approved. Select a Weekending Date"; dialogTitle = "TimeSheet not Approved"; ScriptManager.RegisterStartupScript(this, this.GetType(), "weekending", "throwDialog();", true); } }