protected void GetPurchaseRequisitionProductListById(string purchaseRequisitionId) { PurchaseRequisitionBLL purchaseRequisition = new PurchaseRequisitionBLL(); try { DataTable dt = purchaseRequisition.GetPurchaseRequisitionProductListById(purchaseRequisitionId); if (dt.Rows.Count > 0) { purchaseRequisitionProductListGridView.DataSource = dt; purchaseRequisitionProductListGridView.DataBind(); if (purchaseRequisitionProductListGridView.Rows.Count > 0) { purchaseRequisitionProductListGridView.UseAccessibleHeader = true; purchaseRequisitionProductListGridView.HeaderRow.TableSection = TableRowSection.TableHeader; } } else { msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = ""; } } catch (Exception ex) { msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message; } finally { purchaseRequisition = null; } }
protected void GetPurchaseRequisitionProductListById(string purchaseRequisitionId) { PurchaseRequisitionBLL purchaseRequisition = new PurchaseRequisitionBLL(); try { DataTable dt = purchaseRequisition.GetPurchaseRequisitionProductListById(purchaseRequisitionId); if (dt.Rows.Count > 0) { purchaseRequisitionProductListGridView.DataSource = dt; purchaseRequisitionProductListGridView.DataBind(); if (purchaseRequisitionProductListGridView.Rows.Count > 0) { approveButton.Enabled = true; purchaseRequisitionProductListGridView.UseAccessibleHeader = true; purchaseRequisitionProductListGridView.HeaderRow.TableSection = TableRowSection.TableHeader; TextBox approveQuantityTextBox; TextBox unitPriceTextBox; DropDownList vendorDropDownList; VendorBLL vendor = new VendorBLL(); DataTable dtVendor=new DataTable(); for (int i = 0; i < purchaseRequisitionProductListGridView.Rows.Count; i++) { approveQuantityTextBox = (TextBox)purchaseRequisitionProductListGridView.Rows[i].FindControl("approveQuantityTextBox"); //approveQuantityTextBox.Text = purchaseRequisitionProductListGridView.Rows[i].Cells[3].Text.ToString(); approveQuantityTextBox.Text = dt.Rows[i][3].ToString(); unitPriceTextBox = (TextBox)purchaseRequisitionProductListGridView.Rows[i].FindControl("unitPriceTextBox"); unitPriceTextBox.Text = dt.Rows[i]["UnitPrice"].ToString(); dtVendor = vendor.GetProductVendorsByProductId(purchaseRequisitionProductListGridView.Rows[i].Cells[0].Text.ToString()); vendorDropDownList = (DropDownList)purchaseRequisitionProductListGridView.Rows[i].FindControl("vendorDropDownList"); vendorDropDownList.DataSource = dtVendor; vendorDropDownList.DataValueField = "VendorId"; vendorDropDownList.DataTextField = "VendorName"; vendorDropDownList.DataBind(); vendorDropDownList.Items.Insert(0, ""); vendorDropDownList.SelectedIndex = 0; vendorDropDownList.Items.Insert(dtVendor.Rows.Count+1, "Select Others."); } } else { approveButton.Enabled = false; } } else { msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = ""; } } catch (Exception ex) { msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message; } finally { purchaseRequisition = null; } }