protected void Page_Load(object sender, EventArgs e) { // Retrieving from the link our req ID reqID = Request.QueryString["RequestID"]; // Retrieving our req record using the reqID retrieved RequisitionRecord tempR = RequisitionLogic.FindRequisitionRecord(Convert.ToInt32(reqID)); if (!IsPostBack) { // Populating the labels... LblReqFormID.Text = Convert.ToString("RQ" + tempR.RequestID); LblEmployeeName.Text = tempR.RequestorName; LblDateCreated.Text = tempR.RequestDate.Value.ToString("MM/dd/yyyy"); LblStatus.Text = RequisitionLogic.GetStatus(Convert.ToInt32(reqID)); if (String.IsNullOrWhiteSpace(tempR.Remarks)) { TxtRemarks.Text = "No remarks."; } else { TxtRemarks.Text = tempR.Remarks; } // Toggling the visibilty of the "Approve" and "Reject" controls --- If "Pending", will still remain invisible if (RequisitionLogic.GetStatus(Convert.ToInt32(reqID)).Equals("Pending")) { TxtRemarks.Text = ""; BtnApprove.Visible = true; BtnReject.Visible = true; LblDateApproved.Text = "Pending"; LblMessage.Text = "To approve or reject this request, kindly select one of the following options below."; } else { // Other attrs LblMessage.Text = ""; // For previously approved request LblDateApproved.Text = tempR.ApprovedDate.Value.ToString("MM/dd/yyyy"); TxtRemarks.Attributes.Add("readonly", "readonly"); } } // Populating the gridview GridViewDetails.DataSource = RequisitionLogic.FindRequisitionRecordDetailsByReqID(Convert.ToInt32(reqID)); GridViewDetails.DataBind(); }
// Rejecting the requisition record protected void BtnReject_Click(object sender, EventArgs e) { string temp = RequisitionLogic.ProcessRequsitionRequest(Convert.ToInt32(reqID), "Rejected", RequisitionLogic.GetCurrentDeptUserName(), TxtRemarks.Text); LblMessage.Text = temp; // Modifying the textbox if successful if (temp.Contains("successfully")) { TxtRemarks.Attributes.Add("readonly", "readonly"); BtnApprove.Visible = false; BtnReject.Visible = false; RequisitionRecord tR = RequisitionLogic.FindRequisitionRecord(Convert.ToInt32(reqID)); LblDateApproved.Text = tR.ApprovedDate.Value.ToString("MM/dd/yyyy"); LblStatus.Text = RequisitionLogic.GetStatus(Convert.ToInt32(reqID)); } }