protected void GetPurchaseOrderProductListById(string purchaseOrderId) { PurchaseOrderBLL purchaseOrder = new PurchaseOrderBLL(); try { DataTable dt = purchaseOrder.GetPurchaseOrderProductListById(purchaseOrderId, prIDLabel.Text.Trim()); if (dt.Rows.Count > 0) { purchaseOrderProductListGridView.DataSource = dt; purchaseOrderProductListGridView.DataBind(); if (purchaseOrderProductListGridView.Rows.Count > 0) { purchaseOrderProductListGridView.UseAccessibleHeader = true; purchaseOrderProductListGridView.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 { purchaseOrder = null; } }
protected void purchaseOrderDetailsButton_Click(object sender, EventArgs e) { PurchaseOrderBLL purchaseOrder = new PurchaseOrderBLL(); try { if (warehouseDropDownList.SelectedValue == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Warehouse Name field is required."; } else if (purchaseOrderIdTextBox.Text.Trim() == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Purchase Order ID field is required."; } else { DataTable dt=new DataTable(); dt = purchaseOrder.GetPendingPurchaseOrderByIdAndWarehouse(purchaseOrderIdTextBox.Text.Trim(), warehouseDropDownList.SelectedValue.Trim()); if (dt.Rows.Count > 0) { prIDLabel.Text = dt.Rows[0]["PurchaseRequisitionId"].ToString(); prDateLabel.Text = ", " + dt.Rows[0]["PurchaseRequisitionDate"].ToString(); poIDLabel.Text = dt.Rows[0]["PurchaseOrderId"].ToString(); poDateLabel.Text = ", " + dt.Rows[0]["OrderDate"].ToString(); warehouseIdLabel.Text = dt.Rows[0]["WarehouseId"].ToString(); warehouseNameLabel.Text = dt.Rows[0]["WarehouseName"].ToString(); LoadVendors(); vendorDropDownList.SelectedValue = dt.Rows[0]["VendorId"].ToString(); lblVendorID.Text = dt.Rows[0]["VendorId"].ToString(); //purchaseOrder.VendorId = dt.Rows[0]["VendorId"].ToString(); // vendorNameLabel.Text = dt.Rows[0]["VendorName"].ToString(); requisitionNarrationLabel.Text = dt.Rows[0]["Narration"].ToString(); dt = purchaseOrder.GetPurchaseOrderProductListById(poIDLabel.Text.Trim(), prIDLabel.Text.Trim()); purchaseOrderProductListGridView.DataSource = dt; purchaseOrderProductListGridView.DataBind(); for (int i = 0; i < dt.Rows.Count; i++) { TextBox purchaseQuantityTextBox = (TextBox)purchaseOrderProductListGridView.Rows[i].FindControl("purchaseQuantityTextBox"); purchaseQuantityTextBox.Text = dt.Rows[i]["Quantity"].ToString(); } orderInfoContainer.Visible = true; saveButton.Enabled = true; } else { orderInfoContainer.Visible = false; saveButton.Enabled = false; msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = ""; } if (purchaseOrderProductListGridView.Rows.Count > 0) { purchaseOrderProductListGridView.UseAccessibleHeader = true; purchaseOrderProductListGridView.HeaderRow.TableSection = TableRowSection.TableHeader; } } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { purchaseOrder = null; } }