protected int GetPendingRequestCount() { String dep = DisbursementLogic.GetCurrentDep(); List <RequisitionRecord> list = RequisitionLogic.ListAllRRBySpecificDeptAndStatus(dep, "Pending"); return(list.Count); }
protected void BtnSubmitForm_Click(object sender, EventArgs e) { string deptId = HttpContext.Current.Profile.GetPropertyValue("department").ToString(); string fullName = HttpContext.Current.Profile.GetPropertyValue("fullname").ToString(); DateTime requestDate = DateTime.Now; int requestId = RequisitionLogic.CreateRequisitionRecord(fullName, deptId, requestDate); for (int i = 0; i < GridViewRequisitionForm.Rows.Count; i++) { string ItemID = (GridViewRequisitionForm.Rows[i].FindControl("LblItemID") as Label).Text; int RequestedQuantity; if (!int.TryParse((GridViewRequisitionForm.Rows[i].FindControl("TxtRequestedQuantity") as TextBox).Text, out RequestedQuantity)) { } string Status = "Pending"; string Priority = "No"; RequisitionRecordDetail r = RequisitionLogic.CreateRequisitionRecordDetail(requestId, ItemID, RequestedQuantity, Status, Priority); } statusMessage.Text = "Stationery Requisition Form Submitted Successfully."; statusMessage.ForeColor = Color.Green; statusMessage.Visible = true; BtnSubmitForm.Visible = false; GridViewRequisitionForm.DataSource = null; GridViewRequisitionForm.DataBind(); LinkButtonGoBack.Visible = false; Session["CartList"] = null; }
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(); }
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 GridViewVPR_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { RequisitionRecord record = (RequisitionRecord)e.Row.DataItem; int ReuestID = record.RequestID; Label LblDateProcessed = e.Row.FindControl("LblDateProcessed") as Label; if (record.ApprovedDate != null) { LblDateProcessed.Text = ((DateTime)record.ApprovedDate).ToString("d"); } else { LblDateProcessed.Text = "null"; } RequisitionRecord re = (RequisitionRecord)e.Row.DataItem; int RequestID1 = re.RequestID; Label LblStatus = e.Row.FindControl("LblStatus") as Label; string status = RequisitionLogic.GetRecordStatus(re.RequestID); if (status != null) { LblStatus.Text = status; } } }
public void BindGrid() { List <RequisitionRecord> reRecordList = RequisitionLogic.FindRequisitionRecordByReqName(RequisitionLogic.GetCurrentDeptUserName()); GridViewVPR.DataSource = reRecordList; GridViewVPR.DataBind(); }
// Populating main gridview protected void LoadData() { var temp = RequisitionLogic.ListCurrentRequisitionRecord(); GridViewReqList.DataSource = temp; GridViewReqList.DataBind(); }
// Populating the details (2nd GridView) below protected void btnView_Click(object sender, EventArgs e) { Button btn = (Button)sender; string tempText = btn.CommandArgument.ToString(); int reqID = Convert.ToInt32(tempText); // Retrieve details list var tempList = RequisitionLogic.RetrieveRequisitionRecordDetails(reqID, "Processed"); if (tempList.Count() != 0) { // Populating the labels associated with the gridview LblSelected.Text = "Request ID: "; LblItemIDInfo.Text = "RQ" + tempText; 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(); }
//Niang to check with Khair on the logic of this method.... (ask about the status attribute) public void UpdateStationeryRequestStatus(WCF_RequisitionRecord record, string status, 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)) { return; } RequisitionLogic.ProcessRequsitionRequest(record.RequestID, status, record.ApproverName, record.Remarks); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Here we set 'Pending' as the default status of the page (for ease of the user) GridViewReqList.DataSource = RequisitionLogic.ListAllRRBySpecificDeptAndStatus(DisbursementLogic.GetCurrentDep(), "Pending"); GridViewReqList.DataBind(); } }
//---------- Lim Chang Siang's Code Ends Here ------------------// //Khiar Codes //Naing public WCF_Department GetDeptName(string deptid) { string deptname = RequisitionLogic.GetDepartmentName(deptid); WCF_Department wcf_dept = new WCF_Department(); wcf_dept.DeptID = deptid; wcf_dept.DepartmentName = deptname; return(wcf_dept); }
protected void GridViewCheckOut_RowDeleting(object sender, GridViewDeleteEventArgs e) { string ItemID = Convert.ToString(GridViewCheckOut.DataKeys[e.RowIndex].Values[0]); List <InventoryCatalogue> ic = (List <InventoryCatalogue>)Session["CartList"]; List <InventoryCatalogue> icNew = RequisitionLogic.DeleteOrder(ic, ItemID); GridViewCheckOut.DataSource = icNew; GridViewCheckOut.DataBind(); Session["CartList"] = icNew; Response.Redirect("~/DepartmentEmployee/ViewCatalogue.aspx"); }
// Reject requisition [DEPT HEAD] public string RejectRequisition(WCF_RequisitionRecord tempObj, string token) { if (!IsAuthanticateUser(token)) { return("Invalid user."); } string temp = RequisitionLogic.ProcessRequsitionRequest(tempObj.RequestID, "Rejected", GetUserFullName(token), tempObj.Remarks); return(temp); }
protected void OnRowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label l = e.Row.FindControl("LblDept") as Label; string id = l.Text; string deptname = RequisitionLogic.GetDepartmentName(id); l.Text = deptname; } }
// Identifying the priority for each req per item protected string GetPriority(int reqDetailID) { var temp = RequisitionLogic.GetPriority(reqDetailID); if (temp.Equals("Yes")) { return("Priority Given"); } else { return("None"); } }
protected void CancelDelegationBtn_Click(object sender, EventArgs e) { string currentdep = DisbursementLogic.GetCurrentDep(); DDelegateDetail currentdelegate = RequisitionLogic.GetLatestDelegate(currentdep); string fullname = RequisitionLogic.GetDelegateName(currentdelegate); RequisitionLogic.CancelDelegate(currentdelegate); MultiView1.ActiveViewIndex = 2; BindDdl(); statusMessage.Text = fullname + "'s delegation has been cancelled."; statusMessage.Visible = true; statusMessage.ForeColor = Color.Green; }
protected void ShowCurrentDelegate() { MultiView1.ActiveViewIndex = 0; string currentdep = DisbursementLogic.GetCurrentDep(); DDelegateDetail currentdelegate = RequisitionLogic.GetLatestDelegate(currentdep); string currentdelegatename = RequisitionLogic.GetDelegateName(currentdelegate); DateTime currentdelegatestartdate = RequisitionLogic.GetDelegateStartDate(currentdelegate); DateTime currentdelegateenddate = RequisitionLogic.GetDelegateEndDate(currentdelegate); LblCurrentDelegate.Text = currentdelegatename; LblCurrentDelStartDate.Text = currentdelegatestartdate.ToShortDateString(); LblCurrentDelEndDate.Text = currentdelegateenddate.ToShortDateString(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LblDetails.Text = ""; var temp = RequisitionLogic.ListCurrentRequisitionRecord(); if (temp == null) { LblMessage.Text = "There are no requisition orders at present."; } else { LoadData(); } } }
// 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)); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LblDetails.Text = ""; // Populating the first gridview with all past req records LoadAllData(); // Populating the dropdownlist List <string> temp1 = new List <string>(); temp1.Add("All"); temp1.AddRange(RequisitionLogic.GetDeptNameList()); DdlDeptList.DataSource = temp1; DdlDeptList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { statusMessage = this.Master.FindControl("LblStatus") as Label; if (!IsPostBack) { statusMessage.Visible = false; if (RequisitionLogic.HasDelegate(DisbursementLogic.GetCurrentDep())) { ShowCurrentDelegate(); } else { MultiView1.ActiveViewIndex = 2; BindDdl(); } } }
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(); }
// Populating the details (2nd GridView) below protected void btnView_Click(object sender, EventArgs e) { Button btn = (Button)sender; string tempText = btn.CommandArgument.ToString(); int reqID = Convert.ToInt32(tempText); // Populating the labels associated with the gridview LblSelected.Text = "Request ID: "; LblItemIDInfo.Text = "RQ" + tempText; LblDetails.Text = "Details"; // Changing the visibility of the button var tempList = RequisitionLogic.RetrieveRequisitionRecordDetails(reqID, "Approved"); // Binding the gridview GridViewDetails.DataSource = tempList; GridViewDetails.DataBind(); }
protected void RemoveDeptHeadRoleFromUserWithDateCheck(object sender, System.Timers.ElapsedEventArgs e) { List <Department> depwithdelegateslist = new List <Department>(); List <Department> deplist = new List <Department>(); List <DDelegateDetail> delegatelist = new List <DDelegateDetail>(); List <DateTime> startdates = new List <DateTime>(); List <DateTime> enddates = new List <DateTime>(); using (SA45Team12AD entities = new SA45Team12AD()) { //get list of current delegates delegatelist = entities.DDelegateDetails.ToList(); deplist = entities.Departments.ToList(); foreach (Department u in deplist) { if (u.HasDelegate == 1) { depwithdelegateslist.Add(u); } } if (depwithdelegateslist != null) { foreach (Department u in depwithdelegateslist) { delegatelist.Add(RequisitionLogic.GetLatestDelegate(u.DeptID)); } foreach (DDelegateDetail u in delegatelist) { //get username for delegates string username = DisbursementLogic.GetUserName(u.DepartmentHeadDelegate, u.DepartmentID); //remove depthead role from user after checking period if (DateTime.Today > u.EndDate && Roles.IsUserInRole(username, "HOD")) { RequisitionLogic.RemoveDeptHeadRoleFromUser(u.DepartmentHeadDelegate, u.DepartmentID); Department department = entities.Departments.Where(x => x.DeptID == u.DepartmentID).First(); department.HasDelegate = 0; entities.SaveChanges(); } } } } }
protected void BtnEdit_Click(object sender, EventArgs e) { statusMessage.Visible = false; MultiView1.ActiveViewIndex = 1; string currentdep = DisbursementLogic.GetCurrentDep(); DDelegateDetail currentdelegate = RequisitionLogic.GetLatestDelegate(currentdep); string currentdelegatename = RequisitionLogic.GetDelegateName(currentdelegate); DateTime currentdelegatestartdate = RequisitionLogic.GetDelegateStartDate(currentdelegate); DateTime currentdelegateenddate = RequisitionLogic.GetDelegateEndDate(currentdelegate); CalStartEditDelegate.TodaysDate = currentdelegatestartdate; CalEndEditDelegate.TodaysDate = currentdelegateenddate; CalStartEditDelegate.SelectedDate = CalStartEditDelegate.TodaysDate; CalEndEditDelegate.SelectedDate = CalEndEditDelegate.TodaysDate; LblCurrentDelegateView2.Text = currentdelegatename; if (CalStartEditDelegate.SelectedDate < DateTime.Today) { CalStartEditDelegate.Enabled = false; } }
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); }
protected void BtnAddDelegate_Click(object sender, EventArgs e) { string fullname = EmployeesDdl.Text; DateTime startdate = CalStartAddDelegate.SelectedDate; DateTime enddate = CalEndAddDelegate.SelectedDate; string currentdep = DisbursementLogic.GetCurrentDep(); if (startdate >= DateTime.Today && startdate <= enddate && startdate != null && enddate != null) { RequisitionLogic.AddDelegate(fullname, startdate, enddate, currentdep); statusMessage.Text = (fullname + " has been delegated as the department head from " + startdate.ToShortDateString() + " to " + enddate.ToShortDateString()); statusMessage.Visible = true; statusMessage.ForeColor = Color.Green; ShowCurrentDelegate(); } else { statusMessage.Text = "Please enter a valid period"; statusMessage.Visible = true; statusMessage.ForeColor = Color.Red; } }
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); }
//for updating current delegate protected void ApplyBtn_Click(object sender, EventArgs e) { DateTime newstartdate = CalStartEditDelegate.SelectedDate; DateTime newenddate = CalEndEditDelegate.SelectedDate; string currentdep = DisbursementLogic.GetCurrentDep(); DDelegateDetail currentdelegate = RequisitionLogic.GetLatestDelegate(currentdep); string fullname = RequisitionLogic.GetDelegateName(currentdelegate); if (newstartdate >= DateTime.Today && newstartdate <= newenddate && newstartdate != null && newenddate != null) { RequisitionLogic.UpdateDelegate(currentdelegate, newstartdate, newenddate); statusMessage.Text = (fullname + " has been delegated as the department head from " + newstartdate.ToShortDateString() + " to " + newenddate.ToShortDateString()); statusMessage.Visible = true; statusMessage.ForeColor = Color.Green; ShowCurrentDelegate(); } else { statusMessage.Text = "Please enter a valid period"; statusMessage.Visible = true; statusMessage.ForeColor = Color.Red; } }
protected void SearchBtn_Click(object sender, EventArgs e) { //Show list of all users found on data grid view GridViewDelegationHistory.DataSource = RequisitionLogic.FindDelegateDetailsByEmployeeName(SearchTxt.Text, DisbursementLogic.GetCurrentDep()); GridViewDelegationHistory.DataBind(); }