Exemplo n.º 1
0
        protected void GetProductById(string productId)
        {
            ProductBLL product = new ProductBLL();

            try
            {
                DataTable dt = product.GetProductById(productId);

                if (dt.Rows.Count > 0)
                {
                    barcodeLabel.Text = dt.Rows[0]["Barcode"].ToString();
                    productNameOnlyLabel.Text = dt.Rows[0]["ProductNameOnly"].ToString();
                    productGroupLabel.Text = dt.Rows[0]["ProductGroupName"].ToString();
                    productVolumeLabel.Text = dt.Rows[0]["ProductVolume"].ToString();
                    volumeQuantityLabel.Text = dt.Rows[0]["VolumeQuantity"].ToString();
                    unitLabel.Text = dt.Rows[0]["Unit"].ToString();
                    productRateLabel.Text = dt.Rows[0]["ProductRate"].ToString();
                    lblWarehouse.Text = dt.Rows[0]["WareHouse"].ToString();
                    lblSalesCenter.Text = dt.Rows[0]["SalesCenter"].ToString();

                    string path = Server.MapPath("/Attachment/product/" + dt.Rows[0]["ProductImg"].ToString());
                    if (File.Exists(path))
                    {
                        productImg.ImageUrl = "/Attachment/product/" + dt.Rows[0]["ProductImg"].ToString();
                    }
                    else
                    {
                        productImg.ImageUrl = "~/content/images/noimage.png";
                    }
                }
                else
                {
                    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;
            }
        }
Exemplo n.º 2
0
        //protected void LoadSalesCenter()
        //{
        //    SalesCenterBLL warehouse = new SalesCenterBLL();

        //    try
        //    {
        //        DataTable dt = warehouse.GetActiveSalesCenterListByUser();

        //        salescenterDropDownList.DataSource = dt;
        //        salescenterDropDownList.DataValueField = "SalesCenterId";
        //        salescenterDropDownList.DataTextField = "SalesCenterName";
        //        salescenterDropDownList.DataBind();
        //        salescenterDropDownList.Items.Insert(0, "For all Sales Center");
        //        salescenterDropDownList.SelectedIndex = 0;
        //        salescenterDropDownList.Items[0].Value = "A";
        //         salescenterDropDownList.SelectedValue = LumexSessionManager.Get("UserSalesCenterId").ToString();



        //    }
        //    catch (Exception ex)
        //    {
        //        string message = ex.Message;
        //        if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
        //        MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
        //    }
        //    finally
        //    {
        //        warehouse = null;
        //    }
        //}

        protected void GetProductById(string productId)
        {
            ProductBLL product = new ProductBLL();
            ListBox mainProductList = new ListBox();
            try
            {
                DataTable dt = product.GetProductById(productId);
              

                if (dt.Rows.Count > 0)
                {
                    ListItem listItem = new ListItem();
                    listItem = warehouseDropDownList.Items.FindByValue(dt.Rows[0]["WareHouse"].ToString());

                    if (listItem != null)
                    {
                        warehouseDropDownList.SelectedValue = dt.Rows[0]["WareHouse"].ToString();
                        LoadVendors();
                        LoadProductGroups();
                    }
                    else
                    {
                        warehouseDropDownList.Items.Insert(0, "Not Parmitted");
                        warehouseDropDownList.Items[0].Value = dt.Rows[0]["WareHouse"].ToString();
                        warehouseDropDownList.SelectedIndex = 0;
                        warehouseDropDownList.Enabled = false;
                        updateButton.Enabled = false;
                    }

                    productVolumeTextBox.Text = dt.Rows[0]["ProductVolume"].ToString();
                    volumeQuantityTextBox.Text = dt.Rows[0]["VolumeQuantity"].ToString();
                    unitTextBox.Text = dt.Rows[0]["Unit"].ToString();
                    //secondaryUnitTextBox.Text = dt.Rows[0]["SubUnit"].ToString();
                    vendorDropDownList.SelectedValue = dt.Rows[0]["VendorId"].ToString();
                    txtBxAddition.Text = dt.Rows[0]["Additoninfo"].ToString();
                    txtProductDesc.Text = dt.Rows[0]["ProductDescription"].ToString();
                    barcodeForUpdateHiddenField.Value = "";
                    productNameForUpdateHiddenField.Value = dt.Rows[0]["ProductName"].ToString();
                    productNameOnlyTextBox.Text = dt.Rows[0]["ProductNameOnly"].ToString();
                    productGroupDropDownList.SelectedValue = dt.Rows[0]["ProductGroupId"].ToString();

                    productTypeDropDownList.SelectedValue = dt.Rows[0]["IsMain"].ToString();
                    if (dt.Rows[0]["IsMain"].ToString() == "No")
                    {
                        //  subProductDropDownList.SelectedValue = dt.Rows[0]["ParentProducts"].ToString();
                        vendorDropDownList.Enabled = false;

                        DataTable dt1 = product.GetMainProductListBySubProduct(productId);

                        for (int i = 0; i < dt1.Rows.Count; i++)
                        {
                            mainProductListListBox.Items.Add(new ListItem(dt1.Rows[i]["MainProductName"].ToString(), dt1.Rows[i]["MainProduct"].ToString()));
                        }

                    }
                    else
                    {
                        subProductDropDownList.SelectedValue = "";
                        subProductDropDownList.Enabled = false;
                        productTypeDropDownList.Enabled = false;
                    }

                    //ImageNameHiddenField.Value = dt.Rows[0]["ProductImg"].ToString();
                    //string path = Server.MapPath("/Attachment/product/" + dt.Rows[0]["ProductImg"].ToString());
                    //if (File.Exists(path))
                    //{
                    //    presentImg.ImageUrl = "/Attachment/product/" + dt.Rows[0]["ProductImg"].ToString();
                    //}
                    //else
                    //{
                    //    presentImg.ImageUrl = "~/content/images/noimage.png";
                    //}
                   
                    productTypeDropDownList_SelectedIndexChanged(new object(), new EventArgs());
                    //listItem = salescenterDropDownList.Items.FindByValue(dt.Rows[0]["SalesCenter"].ToString());
                    //if (listItem != null)
                    //{
                    //    salescenterDropDownList.SelectedValue = dt.Rows[0]["SalesCenter"].ToString();
                    //}
                    //else
                    //{
                    //    salescenterDropDownList.Items.Insert(0, "Not Parmitted");
                    //    salescenterDropDownList.Items[0].Value = dt.Rows[0]["SalesCenter"].ToString();
                    //    salescenterDropDownList.SelectedIndex = 0;
                    //    salescenterDropDownList.Enabled = false;
                    //    updateButton.Enabled = false;
                    //}
                }
                else
                {
                    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;
            }
        }