protected void DdlStatusList_SelectedIndexChanged(object sender, EventArgs e) { // Retrieve the value currently selected in the dropdownlist string val = DdlStatusList.SelectedValue; // Populating the gridview according to the status specified in the dropdownlist if (val == "All") { GridViewReqList.DataSource = RequisitionLogic.ListAllRRBySpecificDept(DisbursementLogic.GetCurrentDep()); } else if (val == "Approved") { GridViewReqList.DataSource = RequisitionLogic.ListAllRRBySpecificDeptAndStatus(DisbursementLogic.GetCurrentDep(), "Approved"); } else if (val == "Processed") { GridViewReqList.DataSource = RequisitionLogic.ListAllRRBySpecificDeptAndStatus(DisbursementLogic.GetCurrentDep(), "Processed"); } else if (val == "Rejected") { GridViewReqList.DataSource = RequisitionLogic.ListAllRRBySpecificDeptAndStatus(DisbursementLogic.GetCurrentDep(), "Rejected"); } else { // Default list (aka 'Pending) GridViewReqList.DataSource = RequisitionLogic.ListAllRRBySpecificDeptAndStatus(DisbursementLogic.GetCurrentDep(), "Pending"); } GridViewReqList.DataBind(); }
public List <WCF_RequisitionRecord> GetStationeryRequestsById(string deptId, 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_RequisitionRecord> wcf_UnAuthObj = new List <WCF_RequisitionRecord>(); WCF_RequisitionRecord wcfUnAuth = new WCF_RequisitionRecord(); wcfUnAuth.RequestID = -1; wcf_UnAuthObj.Add(wcfUnAuth); return(wcf_UnAuthObj); } List <RequisitionRecord> rList = RequisitionLogic.ListAllRRBySpecificDept(deptId); List <WCF_RequisitionRecord> wcfList = new List <WCF_RequisitionRecord>(); foreach (RequisitionRecord r in rList) { string approvedDate = r.ApprovedDate == null ? "null" : ((DateTime)r.ApprovedDate).ToString("d"); WCF_RequisitionRecord wcf = WCF_RequisitionRecord.Create(r.RequestID, ((DateTime)r.RequestDate).ToString("d"), r.DepartmentID, r.RequestorName, approvedDate, r.ApproverName, r.Remarks, GetStationeryRequestDetails(r.RequestID.ToString(), internalSecertKey)); wcfList.Add(wcf); } return(wcfList); }