protected void chargeableBtn_Click(object sender, EventArgs e) { int cDist = Convert.ToInt32(totalDistanceLBL.Text), tDist = Convert.ToInt32(totalTruckLBL.Text); decimal cHours = Convert.ToDecimal(totalHoursLBL.Text), cExpense = Convert.ToDecimal(Convert.ToDecimal(totalExpensesLBL.Text)); TimesheetManager tm = new TimesheetManager(); bool valid = true; // sunday if (sunBCHoursTB.Text != string.Empty) { if (!hoursValidator(sunBCHoursTB.Text, "Sunday", false)) { valid = false; } } if (valid) { timesheetStatusLBL.Text = tm.createManagerChargeable(sunBCHoursTB.Text, sunBAccomTB.Text, sunBDistTB.Text, sunTruckDistTB.Text, sunBMiscTB.Text, "Sunday", projectNumTB.Text, classificationDDL.SelectedValue, activitiesDDL.SelectedValue, timesheetID, sunCRemarksTB.Text, ref cHours, ref cDist, ref tDist, ref cExpense); } // monday if (monBCHoursTB.Text != string.Empty) { if (!hoursValidator(monBCHoursTB.Text, "Monday", false)) { valid = false; } } if (valid) { timesheetStatusLBL.Text = tm.createManagerChargeable(monBCHoursTB.Text, monBAccomTB.Text, monBDistTB.Text, monTruckDistTB.Text, monBMiscTB.Text, "Monday", projectNumTB.Text, classificationDDL.SelectedValue, activitiesDDL.SelectedValue, timesheetID, monCRemarksTB.Text, ref cHours, ref cDist, ref tDist, ref cExpense); } // tuesday if (tuesBCHoursTB.Text != string.Empty) { if (!hoursValidator(tuesBCHoursTB.Text, "Tuesday", false)) { valid = false; } } if (valid) { timesheetStatusLBL.Text = tm.createManagerChargeable(tuesBCHoursTB.Text, tuesBAccomTB.Text, tuesBDistTB.Text, tuesTruckDistTB.Text, tuesBMiscTB.Text, "tuesday", projectNumTB.Text, classificationDDL.SelectedValue, activitiesDDL.SelectedValue, timesheetID, tuesCRemarksTB.Text, ref cHours, ref cDist, ref tDist, ref cExpense); } // wednesday if (wedsBCHoursTB.Text != string.Empty) { if (!hoursValidator(wedsBCHoursTB.Text, "Wednesday", false)) { valid = false; } } if (valid) { timesheetStatusLBL.Text = tm.createManagerChargeable(wedsBCHoursTB.Text, wedsBAccomTB.Text, wedsBDistTB.Text, wedsTruckDistTB.Text, wedsBMiscTB.Text, "Wednesday", projectNumTB.Text, classificationDDL.SelectedValue, activitiesDDL.SelectedValue, timesheetID, wedsCRemarksTB.Text, ref cHours, ref cDist, ref tDist, ref cExpense); } // thursday if (thursBCHoursTB.Text != string.Empty) { if (!hoursValidator(thursBCHoursTB.Text, "Thursday", false)) { valid = false; } } if (valid) { timesheetStatusLBL.Text = tm.createManagerChargeable(thursBCHoursTB.Text, thursBAccomTB.Text, thursBDistTB.Text, thursTruckDistTB.Text, thursBMiscTB.Text, "Thursday", projectNumTB.Text, classificationDDL.SelectedValue, activitiesDDL.SelectedValue, timesheetID, thursCRemarksTB.Text, ref cHours, ref cDist, ref tDist, ref cExpense); } // friday if (friBCHoursTB.Text != string.Empty) { if (!hoursValidator(friBCHoursTB.Text, "Friday", false)) { valid = false; } } if (valid) { timesheetStatusLBL.Text = tm.createManagerChargeable(friBCHoursTB.Text, friBAccomTB.Text, friBDistTB.Text, friTruckDistTB.Text, friBMiscTB.Text, "Friday", projectNumTB.Text, classificationDDL.SelectedValue, activitiesDDL.SelectedValue, timesheetID, friCRemarksTB.Text, ref cHours, ref cDist, ref tDist, ref cExpense); } // saturday if (satBCHoursTB.Text != string.Empty) { if (!hoursValidator(satBCHoursTB.Text, "Saturday", false)) { valid = false; } } if (valid) { timesheetStatusLBL.Text = tm.createManagerChargeable(satBCHoursTB.Text, satBAccomTB.Text, satBDistTB.Text, satTruckDistTB.Text, satBMiscTB.Text, "Saturday", projectNumTB.Text, classificationDDL.SelectedValue, activitiesDDL.SelectedValue, timesheetID, satCRemarksTB.Text, ref cHours, ref cDist, ref tDist, ref cExpense); } // add to totalized value labels totalHoursLBL.Text = cHours.ToString("0.#"); totalExpensesLBL.Text = cExpense.ToString("0.####"); totalDistanceLBL.Text = cDist.ToString(); totalTruckLBL.Text = tDist.ToString(); // if hours exceed 60 throw a dialog if (Convert.ToDecimal(totalHoursLBL.Text) > MAX_WEEKLY_HOURS) { // throw a dialog dialogTitle = "Regular Weekly Hours Exceeded"; msg = "You Worked more than 60 Hours per week. A separate Form must be filled out to accomodate overtime"; ScriptManager.RegisterStartupScript(this, this.GetType(), "projectNumInvalid", "throwDialog();", true); } // update timesheet tm.updateTimeSheet(timesheetID, cHours, cDist, tDist, cExpense, "Updated - Manager", " ", " "); projectNameTB.Enabled = false; clientNameTB.Enabled = false; // clear form fields clearChargeable(); // chargeable fields clientNameTB.Text = string.Empty; projectNameTB.Text = string.Empty; projectNumTB.Text = string.Empty; classificationDDL.Items.Clear(); activitiesDDL.Items.Clear(); // update totals updateChargeableTotals(); ; // update gridview summaryGV.DataBind(); }