protected void LBtnRID_Click(object sender, EventArgs e) { LinkButton lb = (LinkButton)sender; int reqID = Utility.Utility.GetValidPrimaryKeyInt(lb.Text); // Retrieve details list var tempList = RequisitionLogic.FindRequisitionRecordDetailsByReqID(reqID); if (tempList.Count() != 0) { // Populating the labels associated with the gridview LblSelected.Text = "Request ID: "; LblItemIDInfo.Text = lb.Text; LblDetails.Text = "Details"; } else { // Populating the labels associated with the gridview LblSelected.Text = "No past records were retrieved."; LblSelected.ForeColor = System.Drawing.Color.Red; LblItemIDInfo.Text = ""; LblDetails.Text = "Details"; } // Binding the grid view GridViewDetails.DataSource = tempList; GridViewDetails.DataBind(); }
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(); }
public List <WCF_RequisitionRecordDetail> GetStationeryRequestDetails(string requestId, string token) { //Check if user is authorizated to use this method. If is not authorized, it will return a json with -1 in the primary key if (!IsAuthanticateUser(token)) { List <WCF_RequisitionRecordDetail> wcf_UnAuthObj = new List <WCF_RequisitionRecordDetail>(); WCF_RequisitionRecordDetail wcfUnAuth = new WCF_RequisitionRecordDetail(); wcfUnAuth.RequestDetailID = -1; wcf_UnAuthObj.Add(wcfUnAuth); return(wcf_UnAuthObj); } List <WCF_RequisitionRecordDetail> wcfList = new List <WCF_RequisitionRecordDetail>(); List <RequisitionRecordDetail> rList = RequisitionLogic.FindRequisitionRecordDetailsByReqID(int.Parse(requestId)); foreach (RequisitionRecordDetail r in rList) { WCF_RequisitionRecordDetail wcf = WCF_RequisitionRecordDetail.Create(r.RequestDetailID, r.RequestID, r.ItemID, (int)r.RequestedQuantity, r.Status); wcfList.Add(wcf); } return(wcfList); }