public void ProcessRequest(HttpContext context)
        {
            var id = context.Request.QueryString["id"];
           
            DataTable dt = new DataTable();
            ProductBLL product = new ProductBLL();
            if (id[0] == 'W')
            {
                dt = product.GetAvailableProductListByWarehouse(id);
            }
            else if (id[0] == 'W')
            {
                dt = product.GetAvailableProductListBySalesCenter(id);
            }
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string productName = dt.Rows[i]["ProductId"].ToString() + "[" + dt.Rows[i]["ProductName"].ToString() + "]" + ";";
                sb.Append(productName).Append(Environment.NewLine);
            }

            context.Response.Write(sb.ToString());
        }
Exemplo n.º 2
0
        //protected void LoadSalesCenters()
        //{
        //    SalesCenterBLL salesCenter = new SalesCenterBLL();

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

        //        salesCenterDropDownList.DataSource = dt;
        //        salesCenterDropDownList.DataValueField = "SalesCenterId";
        //        salesCenterDropDownList.DataTextField = "SalesCenterName";
        //        salesCenterDropDownList.DataBind();
        //        salesCenterDropDownList.Items.Insert(0, "");
        //        salesCenterDropDownList.SelectedIndex = 0;
        //       // salesCenterDropDownList.SelectedValue = LumexSessionManager.Get("UserSalesCenterId").ToString();

        //        if (dt.Rows.Count < 1)
        //        {
        //            msgbox.Visible = true; msgTitleLabel.Text = "Joining Sales Center 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
        //    {
        //        salesCenter = null;
        //    }
        //}

        //protected void GetAvailableProductListBySalesCenter()
        //{
        //    ProductBLL product = new ProductBLL();

        //    try
        //    {
        //        DataTable dt = product.GetAvailableProductListBySalesCenter(salesCenterDropDownList.SelectedValue);
        //        productListGridView.DataSource = dt;
        //        productListGridView.DataBind();

        //        if (productListGridView.Rows.Count > 0)
        //        {
        //            productListGridView.UseAccessibleHeader = true;
        //            productListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
        //        }

        //        if (dt.Rows.Count < 1)
        //        {
        //            msgbox.Visible = true; msgTitleLabel.Text = "Products are not available for the selected Sales Center!!!"; msgDetailLabel.Text = "";
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //       // msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
        //    }
        //    finally
        //    {
        //        product = null;
        //    }
        //}
        protected void GetAvailableProductListByWarehouse()
        {
            ProductBLL product = new ProductBLL();

            try
            {
                DataTable dt = new DataTable();
                product.WareHouseId = salesCenterDropDownList.SelectedValue;
                //if (salesCenterDropDownList.SelectedValue == "WH-002")
                //{
                //    dt = product.GetMainProductsByWareHouseForSales();

                //}
                //else
                //{
                // dt = product.GetAllProductsBySalesCenter(salesCenterDropDownList.SelectedValue);

                //}
                dt = product.GetAvailableProductListByWarehouse(salesCenterDropDownList.SelectedValue);
                if (dt.Rows.Count > 0)
                {
                    productListGridView.DataSource = dt;
                    productListGridView.DataBind();
                }
                else
                {
                    productListGridView.DataSource = dt;
                    productListGridView.DataBind();

                }

                if (productListGridView.Rows.Count > 0)
                {
                    productListGridView.Columns[0].Visible = false;
                    productListGridView.UseAccessibleHeader = true;
                    productListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                }

                if (dt.Rows.Count < 1)
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Products are not available for the selected Business!!!"; msgDetailLabel.Text = "";
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            finally
            {
                product = null;
            }
        }