protected void btnApprove_Click(object sender, EventArgs e) { string strErrorMessage = ""; if (CountCheckedSchedule() == 0) { strErrorMessage += "<br>You should approve atleast 1 schedule."; } if (strErrorMessage.Length == 0) { using (clsOB ob = new clsOB()) { ob.OBCode = Request.QueryString["obcode"]; ob.Fill(); ob.ApproverHeadDate = DateTime.Now; ob.ApproverHeadRemarks = txtHRemarks.Text; ob.ApproveHead(); foreach (DataGridItem itm in dgSchedule.Items) { HiddenField phdnFocusDate = (HiddenField)itm.FindControl("hdnFocusDate"); HiddenField phdnKeyInDate = (HiddenField)itm.FindControl("hdnKeyInDate"); HiddenField phdnKeyOutDate = (HiddenField)itm.FindControl("hdnKeyOutDate"); HiddenField phdnStatus = (HiddenField)itm.FindControl("hdnStatus"); CheckBox pchkApprove = (CheckBox)itm.FindControl("chkApprove"); if (!pchkApprove.Checked && phdnStatus.Value == "1") { clsOBDetails obdetails = new clsOBDetails(); obdetails.OBCode = ob.OBCode; obdetails.FocusDate = clsValidator.CheckDate(phdnFocusDate.Value); obdetails.KeyIn = clsValidator.CheckDate(phdnKeyInDate.Value); obdetails.KeyOut = clsValidator.CheckDate(phdnKeyOutDate.Value); obdetails.Status = (pchkApprove.Checked ? "1" : "0"); obdetails.UpdateBy = Request.Cookies["Speedo"]["UserName"]; obdetails.UpdateOn = DateTime.Now; obdetails.UpdateStatus(); } } } ScriptManager.RegisterStartupScript(this, GetType(), "Success!", "ModalSuccess();", true); } else { divError.Visible = true; lblErrMsg.Text = strErrorMessage; } }
protected void btnSend_Click(object sender, EventArgs e) { string strErrorMessage = ""; if (dgSchedule.Items.Count == 0) { strErrorMessage += "<br>You should file atleast 1 schedule."; } if (strErrorMessage.Length == 0) { using (clsOB ob = new clsOB()) { ob.Username = Request.Cookies["Speedo"]["UserName"]; ob.DateFile = DateTime.Now; ob.Reason = txtReason.Text; ob.OBType = ddlOBType.SelectedValue; if (ddlOBType.SelectedValue == "1") { ob.DepartmentCode = ddlDepartment.SelectedValue; ob.ApproverRequestorName = ddlRequestApprover.SelectedValue; } else { ob.DepartmentCode = clsEmployee.GetDepartmentCode(Request.Cookies["Speedo"]["UserName"]); ob.ApproverRequestorName = ""; } ob.ApproverHeadName = ddlHeadApprover.SelectedValue; ob.Insert(); DataTable tblCart = ViewState["Cart"] as DataTable; foreach (DataGridItem itm in dgSchedule.Items) { HiddenField phdnFocusDate = (HiddenField)itm.FindControl("hdnFocusDate"); CalendarPopup pdtpKeyOBDate = (CalendarPopup)itm.FindControl("dtpKeyOBDate"); TimePicker pdtpKeyInTime = (TimePicker)itm.FindControl("dtpKeyInTime"); TimePicker pdtpKeyOutTime = (TimePicker)itm.FindControl("dtpKeyOutTime"); clsOBDetails obdetails = new clsOBDetails(); obdetails.OBCode = ob.OBCode; obdetails.FocusDate = clsValidator.CheckDate(phdnFocusDate.Value); obdetails.KeyIn = clsDateTime.CombineDateTime(pdtpKeyOBDate.SelectedDate, pdtpKeyInTime.SelectedTime); obdetails.KeyOut = clsDateTime.CombineDateTime(pdtpKeyOBDate.SelectedDate, pdtpKeyOutTime.SelectedTime); obdetails.Status = "1"; obdetails.UpdateBy = Request.Cookies["Speedo"]["UserName"]; obdetails.UpdateOn = DateTime.Now; obdetails.Add(); } if (ob.OBType == "0") { ob.SendNotification(OBMailType.FiledAcknowledgementHRequestor); ob.SendNotification(OBMailType.FiledNotificationHApprover); } else { ob.SendNotification(OBMailType.FiledAcknowledgementRRequestor); ob.SendNotification(OBMailType.FiledNotificationRApprover); } } //ADDED by CALVIN CAVITE FEB 15, 2018 ScriptManager.RegisterStartupScript(this, GetType(), "Success!", "ModalSuccess();", true); //Response.Redirect("OBMenu.aspx"); } else { divError.Visible = true; lblErrMsg.Text = strErrorMessage; } }