private void RetrieveDisbursementData() { List <CollectionPoint> pointList = DisbursementLogic.ListCollectionPoints(); int collectionId = DisbursementLogic.GetListofDepartments().Where(x => x.DeptID == DdlDept.SelectedValue).Select(x => x.CollectionPointID).FirstOrDefault(); LblCollectPoint.Text = pointList.Where(x => x.CollectionPointID == collectionId).Select(x => x.CollectionPoint1).FirstOrDefault(); LblDeptRep.Text = DisbursementLogic.GetDeptRepFullName(DdlDept.SelectedValue); string deptId = DdlDept.SelectedValue; List <InventoryRetrievalList> rList = InventoryLogic.GetListOfInventoryRetrival(deptId); if (rList.Count > 0) { GridViewDisbList.DataSource = rList; GridViewDisbList.DataBind(); GridViewDisbList.Visible = true; BtnCreateDis.Visible = true; statusMessage.Text = string.Empty; } else { GridViewDisbList.Visible = false; BtnCreateDis.Visible = false; statusMessage.ForeColor = Color.Red; statusMessage.Text = "No Disbursement Found for " + DdlDept.SelectedItem; } }
private void BindGrid(int disbursementId) { List <DisbursementListDetail> dList = DisbursementLogic.GetDisbursementListDetails(disbursementId); GridViewDisbList.DataSource = dList; GridViewDisbList.DataBind(); BindLabels(disbursementId); GridViewDisbList.Visible = true; }
protected void BtnSearch_Click(object sender, EventArgs e) { string status = DdlStatus.SelectedValue; int colPointId = int.Parse(DdlColPoint.SelectedValue); DateTime collectionDate; List <DisbursementList> dList = status == "All" ? DisbursementLogic.GetListOfDisbursements() : DisbursementLogic.GetListOfDisbursements("Status", status); dList = colPointId == -1 ? dList : dList.Where(x => x.CollectionPointID == colPointId).ToList(); if ((DateTime.TryParseExact(Request.Form["datepicker"], "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out collectionDate))) { dList = dList.Where(x => x.CollectionDate == collectionDate).ToList(); } GridViewDisbList.DataSource = dList; GridViewDisbList.DataBind(); }
protected void BtnRetrieve_Click(object sender, EventArgs e) { string dept = DdlDept.SelectedValue; List <DisbursementList> dList; switch (dept) { case ("All"): dList = DisbursementLogic.GetListOfDisbursements(); break; default: dList = DisbursementLogic.GetListOfDisbursements("DepartmentID", dept); break; } GridViewDisbList.DataSource = dList; GridViewDisbList.DataBind(); }
protected void RowDeleting(object sender, GridViewDeleteEventArgs e) { Label LblSn = GridViewDisbList.Rows[e.RowIndex].Cells[0].FindControl("LblSn") as Label; int sN = int.Parse(LblSn.Text); List <InventoryRetrievalList> iRList = new List <InventoryRetrievalList>(); foreach (GridViewRow r in GridViewDisbList.Rows) { TextBox remarks = r.FindControl("TxtRemarks") as TextBox; InventoryRetrievalList iR = new InventoryRetrievalList(); iR.RetrievalID = int.Parse((r.FindControl("HideRetriId") as HiddenField).Value); iR.ItemID = (r.FindControl("LblItemCode") as Label).Text; iR.RequestedQuantity = int.Parse((r.FindControl("LblReqQty") as Label).Text); iR.ActualQuantity = int.Parse((r.FindControl("LblActulQty") as Label).Text); remarks.Text = (r.FindControl("TxtRemarks") as TextBox).Text; iRList.Add(iR); } iRList.RemoveAt(sN - 1); GridViewDisbList.DataSource = iRList; GridViewDisbList.DataBind(); }
private void BindGrid() { GridViewDisbList.DataSource = DisbursementLogic.GetDisbursementList(); GridViewDisbList.DataBind(); }