コード例 #1
0
        protected void productVendorButton_Click(object sender, EventArgs e)
        {
            ProductBLL product = new ProductBLL();
            VendorBLL vendor = new VendorBLL();

            try
            {
                DataTable dt = product.GetProductByBarcodeIdName(productTextBox.Text.Trim());

                if (dt.Rows.Count > 0)
                {
                    barcodeLabel.Text = dt.Rows[0]["Barcode"].ToString();
                    productIdLabel.Text = dt.Rows[0]["ProductId"].ToString();
                    productNameLabel.Text = dt.Rows[0]["ProductName"].ToString();
                    productGroupNameLabel.Text = dt.Rows[0]["ProductGroupName"].ToString();

                    productVendorListListBox.Items.Clear();
                    DataTable dtVendor = vendor.GetProductVendorsByProductId(productIdLabel.Text.Trim());

                    for (int i = 0; i < dtVendor.Rows.Count; i++)
                    {
                        productVendorListListBox.Items.Add(new ListItem(dtVendor.Rows[i]["VendorName"].ToString(), dtVendor.Rows[i]["VendorId"].ToString()));
                    }

                    productVendorPane.Visible = true;
                }
                else
                {
                    productVendorPane.Visible = false;
                    msgbox.Visible = true; msgTitleLabel.Text = "Product Data Not Found!!!"; msgDetailLabel.Text = "";
                    msgbox.Attributes.Add("class", "alert alert-warning");
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                product = null;
                vendor = null;
                countProductVendorLabel.Text = "Total: " + productVendorListListBox.Items.Count.ToString();
                MyAlertBox("MyOverlayStop();");
            }
        }
コード例 #2
0
        protected void searchProductButton_Click(object sender, EventArgs e)
        {
            ProductBLL product = new ProductBLL();

            try
            {
                if (productTextBox.Text.Trim() == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Product By field is required.";
                }
                else
                {
                    DataTable dt = product.GetProductByBarcodeIdName(productTextBox.Text.Trim());
                    productPriceListGridView.DataSource = dt;
                    productPriceListGridView.DataBind();

                    for (int i = 0; i < productPriceListGridView.Rows.Count; i++)
                    {
                        TextBox newPriceTextBox = (TextBox)productPriceListGridView.Rows[i].Cells[5].FindControl("newPriceTextBox");
                        TextBox newVATPercentageTextBox = (TextBox)productPriceListGridView.Rows[i].Cells[7].FindControl("newVATPercentageTextBox");

                        newPriceTextBox.Text = dt.Rows[i]["RatePerUnit"].ToString();
                        newVATPercentageTextBox.Text = dt.Rows[i]["VATPercentage"].ToString();
                    }

                    if (productPriceListGridView.Rows.Count > 0)
                    {
                        productPriceListGridView.UseAccessibleHeader = true;
                        productPriceListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                    }
                    else
                    {
                        msgbox.Visible = true; msgTitleLabel.Text = "No product is found."; msgDetailLabel.Text = "";
                        msgbox.Attributes.Add("class", "alert alert-warning");
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                product = null;
                MyAlertBox("MyOverlayStop();");
            }
        }