protected void GetActiveProducts(string id)
        {
            ProductBLL product = new ProductBLL();

            try
            {
                DataTable dt = product.GetActiveProductsByWareHouseorSalesCenter(id);

                productListGridView.DataSource = dt;
                productListGridView.DataBind();
                GridviewHeadStyle();
                if (dt.Rows.Count < 1)
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = "";
                }
            }
            catch (Exception ex)
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            }
            finally
            {
                product = null;
            }
        }
Example #2
0
        protected void GetProductList()
        {
            ProductBLL product = new ProductBLL();

            try
            {
                DataTable dt = product.GetProductList();
                productListGridView.DataSource = dt;
                productListGridView.DataBind();

                if (dt.Rows.Count < 1)
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Product List 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;
            }
        }
Example #3
0
        protected void GetProductList()
        {
            ProductBLL product = new ProductBLL();

            try
            {
                product.WareHouseId = warehouseDropDownList.SelectedValue.Trim();
               
                DataTable dt = product.GetProductListByWareHouseId();
                productListGridView.DataSource = dt;
                productListGridView.DataBind();

                if (productListGridView.Rows.Count > 0)
                {
                    productListGridView.UseAccessibleHeader = true;
                    productListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                }
                else
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Product List 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;
            }
        }
        protected void deletedListButton_Click(object sender, EventArgs e)
        {
            ProductBLL product = new ProductBLL();

            try
            {
                if (fromDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim()) == "False")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date From field is required.";
                }
                else if (toDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim()) == "False")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date To field is required.";
                }
                else
                {
                    string fromDate = LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim());
                    string toDate = LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim());

                    DataTable dt = product.GetDeletedProductListByDateRangeAll(fromDate, toDate, "");

                    deletedListGridView.DataSource = dt;
                    deletedListGridView.DataBind();

                    if (deletedListGridView.Rows.Count > 0)
                    {
                        deletedListGridView.UseAccessibleHeader = true;
                        deletedListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
                    }
                    else
                    {
                        msgbox.Visible = true; msgTitleLabel.Text = "Deleted Product List Data Not Found!!!"; msgDetailLabel.Text = "";
                        msgbox.Attributes.Add("class", "alert alert-info");
                    }
                }
            }
            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();");
            }
        }
Example #5
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;
            }
        }
        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();");
            }
        }
        public void ProcessRequest(HttpContext context)
        {
          //  LumexDBPlayer db = LumexDBPlayer.Start();
            DataTable dt = new DataTable();
            ProductBLL product = new ProductBLL();
            dt = product.GetProductNamesOnly();

            StringBuilder sb = new StringBuilder();

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

            context.Response.Write(sb.ToString());
        }
        private void LoadSubProductList(string wareHouseId)
        {
            DataTable dt = new DataTable();
            ProductBLL productBll = new ProductBLL();

            dt = productBll.GetMainProductListWHID(wareHouseId);
            subProductDropDownList.DataSource = dt;

            subProductDropDownList.DataValueField = "ProductId";
            subProductDropDownList.DataTextField = "ProductName";
            subProductDropDownList.DataBind();
            subProductDropDownList.Items.Insert(0, "Please Select");
            subProductDropDownList.SelectedIndex = 0;
            subProductDropDownList.Items[0].Value = "";
            subProductDropDownList.Focus();

        }
        public void ProcessRequest(HttpContext context)
        {
            var id = context.Request.QueryString["id"];
          //  LumexDBPlayer db = LumexDBPlayer.Start();
            DataTable dt = new DataTable();
            ProductBLL product = new ProductBLL();
            dt = product.GetAllProductsBySalesCenter(id);

            StringBuilder sb = new StringBuilder();

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

            context.Response.Write(sb.ToString());
        }
        private void LoadProduct()
        {
            try
            {
                ProductBLL productBll=new ProductBLL();
                DataTable dt = productBll.GetActiveProductList();
                drpdwnProduct.DataSource = dt;
                drpdwnProduct.DataTextField = "ProductName";
                drpdwnProduct.DataValueField = "ProductId";
                drpdwnProduct.DataBind();
                drpdwnProduct.Items.Insert(0, "");
                //drpdwnSalesCenterOrWarehouse.SelectedIndex = 0;
                //drpdwnProduct.SelectedValue = LumexSessionManager.Get("UserWareHouseId").ToString();
            }
            catch (Exception ex)
            {

                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
        }
        protected void subProductDropDownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            
            //mainProductListGridView.Rows.clear();
            DataTable dt = new DataTable();
            ProductBLL productBll = new ProductBLL();
            productBll.SubProductId =subProductDropDownList.SelectedValue.ToString();
            dt = productBll.GetMainProductListBySubProductId();
            mainProductListGridView.DataSource = dt;
            mainProductListGridView.DataBind();

            if (mainProductListGridView.Rows.Count > 0)
            {
                mainProductListGridView.UseAccessibleHeader = true;
                mainProductListGridView.HeaderRow.TableSection = TableRowSection.TableHeader;
            }
            else
            {
                msgbox.Visible = true; msgTitleLabel.Text = "Product List Data Not Found!!!"; msgDetailLabel.Text = "";
                msgbox.Attributes.Add("class", "alert alert-warning");
            }
        }
Example #12
0
        public DataTable SaveProduct(ProductBLL product, LumexDBPlayer db)
        {
            try
            {
                db.AddParameters("@ProductName", product.ProductName.Trim());
                db.AddParameters("@ProductNameOnly", product.ProductNameOnly.Trim());
                db.AddParameters("@Barcode", product.Barcode.Trim());
                db.AddParameters("@ProductGroupId", product.ProductGroupId.Trim());
                db.AddParameters("@ProductVolume", product.ProductVolume.Trim());
                db.AddParameters("@VolumeQuantity", product.VolumeQuantity);
                db.AddParameters("@Unit", product.Unit.Trim());
                db.AddParameters("@SubUnit", product.SecondaryUnit);
                db.AddParameters("@IsMain", product.ProductType);
                db.AddParameters("@ParentProducts", product.SubProduct);
                db.AddParameters("@ProductRate", product.ProductRate);
                db.AddParameters("@VATPercentage", product.VATPercentage);
                db.AddParameters("@VendorId", product.VendorId);
                db.AddParameters("@WareHouse", product.WareHouseId);
                db.AddParameters("@SalesCenter", product.salescenter);
                db.AddParameters("@CreatedBy", LumexSessionManager.Get("ActiveUserId").ToString());
                db.AddParameters("@CreatedFrom", LumexLibraryManager.GetTerminal());
                db.AddParameters("@AdditionalInfo", product.additinalInfo.Trim());
                db.AddParameters("@ProduceDes", product.productDesc.Trim());
                db.AddParameters("@ProductImg", product.productImageName.Trim());

                DataTable dt = db.ExecuteDataTable("INSERT_PRODUCT", true);
                return dt;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                product = null;
            }
        }
        public static string GetProductUnits()
        {
            ProductBLL product = new ProductBLL();

            try
            {
                DataTable dt = product.GetProductUnits();

                if (dt.Rows.Count > 0)
                {
                    StringBuilder sb = new StringBuilder();

                    string volume = "";

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        volume = dt.Rows[i]["Unit"].ToString().Trim();
                        sb.Append(volume).Append(Environment.NewLine);
                    }

                    return sb.ToString();
                }
                else
                {
                    return "No Product Unit saved yet!";
                }
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
            finally
            {
                product = null;
            }
        }
        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());
        }
Example #15
0
 internal DataTable GetProductListByWareHouseId(ProductBLL productBLL, LumexDBPlayer db)
 {
     try
     {
       
         db.AddParameters("@WHID", productBLL.WareHouseId);
         DataTable dt = db.ExecuteDataTable("GET_PRODUCTS_BY_WHID", true);
         return dt;
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #16
0
 internal DataTable GetMainProductList(ProductBLL product ,LumexDBPlayer db)
 {
     try
     {
         db.AddParameters("@WHId", product.WareHouseId);
         DataTable dt = db.ExecuteDataTable("[GET_PRODUCTS_WH_ID]", true);
         return dt;
     }
     catch (Exception)
     {
         throw;
     }
 }
        protected void GetActiveProducts(string id)
        {
            ProductBLL product = new ProductBLL();

            try
            {
                DataTable dt = product.GetActiveProductsByWareHouseorSalesCenter(id);
                productListGridView.DataSource = dt;
                productListGridView.DataBind();

                if (dt.Rows.Count < 1)
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = "";
                    productListGridView.DataSource = "";
                    productListGridView.DataBind();
                }
                if (productListGridView.Rows.Count > 0)
                {
                    productListGridView.UseAccessibleHeader = true;
                    productListGridView.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
            {
                product = null;
            }
        }
Example #18
0
        protected void GetAvailableProductListBySalesCenter()
        {
            ProductBLL product = new ProductBLL();

            try
            {

                DataTable dt = new DataTable();
                product.WareHouseId = ddlSelectWareHouseOrSalesCenter.SelectedValue;
                if (ddlSelectWareHouseOrSalesCenter.SelectedValue == "WH-002")
                {
                    dt = product.GetMainProductsByWareHouseForSales();
                    saveButton.Text = "CREATE NEW SALES";
                }
                else
                {
                    dt = product.GetAllProductsBySalesCenter(ddlSelectWareHouseOrSalesCenter.SelectedValue);
                    saveButton.Text = "CREATE NEW SALES";
                }
                if (dt.Rows.Count > 0)
                {
                    productListGridView.DataSource = dt;
                    productListGridView.DataBind();
                }
                else
                {
                    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)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                product = null;
            }
        }
Example #19
0
        protected void saveButton_Click(object sender, EventArgs e)
        {
            ProductBLL product = new ProductBLL();

            try
            {
                //if (barcodeTextBox.Text == "")
                //{
                //    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Barcode Name field is required.";
                //}
                //else
                if (productNameOnlyTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Product Name field is required.";
                }
                else if (productVolumeTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Product Volume field is required.";
                }
                //else if (volumeQuantityTextBox.Text == "")
                //{
                //    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Volume Quantity field is required.";
                //}
                else if (unitTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Unit field is required.";
                }
                else if (productRateTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Product Rate field is required.";
                }
                //else if (vatPercentageTextBox.Text == "")
                //{
                //    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "VAT field is required.";
                //}
                else if (productGroupDropDownList.SelectedValue == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Product Group field is required.";
                }
                //else if (vendorDropDownList.SelectedValue == "")
                //{
                //    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Product Vendor field is required.";
                //}
                else
                {
                    int isaddanother = 1;

                    Button btn = (Button)sender;

                    if (btn.Text == "Save")
                    {
                        isaddanother = 0;
                    }

                    product.ProductNameOnly = productNameOnlyTextBox.Text.Trim();
                    product.Barcode = ""; //barcodeTextBox.Text.Trim();
                    product.ProductGroupId = productGroupDropDownList.SelectedValue.Trim();
                    product.SecondaryUnit = "";//secondaryUnitTextBox.Text.Trim();
                    product.ProductType = productTypeDropDownList.SelectedValue.Trim();
                    product.SubProduct = subProductDropDownList.SelectedValue.Trim();
                    product.ProductVolume = productVolumeTextBox.Text.Trim();
                    product.additinalInfo = txtBxAddition.Text.Trim();
                    product.VolumeQuantity = decimal.Parse(volumeQuantityTextBox.Text.Trim());
                    product.Unit = unitTextBox.Text.Trim();
                    product.ProductRate = decimal.Parse(productRateTextBox.Text.Trim());
                    product.ProductName = product.ProductNameOnly.Trim() + " [" + " (" + product.additinalInfo.Trim() + ") " + product.ProductVolume.Trim() + "]";
                    product.VendorId = vendorDropDownList.SelectedValue;
                    product.VATPercentage = float.Parse(vatPercentageTextBox.Text.Trim());
                    product.WareHouseId = warehouseDropDownList.SelectedValue;
                    product.salescenter = "";

                    product.productDesc = txtProductDesc.Text.Trim();

                    //if (!product.CheckDuplicateProductByBarcode(product.Barcode.Trim()))
                    //{
                    if (!product.CheckDuplicateProductByName(product.ProductName.Trim(), product.WareHouseId, product.salescenter))
                    {
                        List<string> mainProductList = new List<string>();

                        if (productTypeDropDownList.SelectedValue == "No")
                        {
                            for (int i = 0; i < mainProductListListBox.Items.Count; i++)
                            {
                                mainProductList.Add(mainProductListListBox.Items[i].Value);
                            }
                        }
                        product.productImageName = "";//saveProductImage(product.Barcode);
                        DataTable dt = product.SaveProduct(mainProductList);

                        if (dt.Rows.Count > 0)
                        {
                            if (isaddanother == 0)
                            {
                                string message =
                                    "Product <span class='actionTopic'>Created</span> Successfully with Product ID: <span class='actionTopic'>" +
                                    dt.Rows[0][0].ToString() + "</span>.";
                                MyAlertBox(
                                    "var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/Product/List.aspx\"; }; SuccessAlert(\"" +
                                    "Process Succeed" + "\", \"" + message + "\", callbackOk);");

                            }
                            else
                            {
                                string message =
                                   "Product <span class='actionTopic'>Created</span> Successfully with Product ID: <span class='actionTopic'>" +
                                   dt.Rows[0][0].ToString() + "</span>.";
                                MyAlertBox(
                                    "var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/Product/Create.aspx\"; }; SuccessAlert(\"" +
                                    "Process Succeed" + "\", \"" + message + "\", callbackOk);");

                            }
                        }
                        else
                        {
                            string message = "<span class='actionTopic'>Failed</span> to Create Product.";
                            MyAlertBox("ErrorAlert(\"" + "Process Failed" + "\", \"" + message + "\");");
                        }
                    }
                    else
                    {
                        string message = "This Product Name <span class='actionTopic'>already exist</span>, try another one.";
                        MyAlertBox("WarningAlert(\"" + "Data Duplicate" + "\", \"" + message + "\");");
                    }
                    //}
                    //else
                    //{
                    //    string message = "This Barcode <span class='actionTopic'>already exist</span>, try another one.";
                    //    MyAlertBox("WarningAlert(\"" + "Data Duplicate" + "\", \"" + message + "\");");
                    //}
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                product = null;
            }
        }
        protected void deleteLinkButton_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton lnkBtn = (LinkButton)sender;
                GridViewRow row = (GridViewRow)lnkBtn.NamingContainer;
                ProductBLL productBll = new ProductBLL();

                productBll.DeleteProductById(mainProductListGridView.Rows[row.RowIndex].Cells[0].Text.ToString());

                subProductDropDownList_SelectedIndexChanged(this, EventArgs.Empty);
                string message = "Product <span class='actionTopic'>Deleted</span> Successfully.";
                MyAlertBox("SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");");
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
        }
Example #21
0
        protected void productTypeDropDownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            ProductBLL productBll = new ProductBLL();
            productBll.WareHouseId = warehouseDropDownList.SelectedValue.Trim();

            try
            {
                subProductDropDownList.Items.Clear();
                DataTable dt = new DataTable();
                if (productTypeDropDownList.SelectedValue == "No")
                {
                    subProductDropDownList.Visible = true;
                    subProductDropDownList.Enabled = true;
                    vendorDropDownList.Enabled = false;
                    dt = productBll.GetMainProductList();
                    subProductDropDownList.DataSource = dt;
                    subProductDropDownList.DataValueField = "ProductId";
                    subProductDropDownList.DataTextField = "ProductName";
                    subProductDropDownList.DataBind();
                    subProductDropDownList.Focus();

                }
                else
                {
                    subProductDropDownList.Enabled = false;
                    mainProductListListBox.Enabled = false;
                    vendorDropDownList.Enabled = true;
                    //txtBxAddition.Focus();
                }

            }
            catch (Exception)
            {

                throw;
            }
        }
        protected void GetActiveProducts()
        {
            ProductBLL product = new ProductBLL();

            try
            {
                DataTable dt = new DataTable();

                //if (ddlWHorSC.SelectedValue == "SC")
                //{
                //    dt = product.GetAllProductsBySalesCenter(ddlSelectWareHouseOrSalesCenter.SelectedValue);
                //}
                //else
                //{
                product.WareHouseId = ddlSelectWareHouseOrSalesCenter.SelectedValue;
                dt = product.GetMainProductsByWareHouseForSales();

                //}
                productListGridView.DataSource = dt;
                productListGridView.DataBind();

                if (dt.Rows.Count < 1)
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = "";
                    productListGridView.DataSource = "";
                    productListGridView.DataBind();
                }
                if (productListGridView.Rows.Count > 0)
                {
                    productListGridView.UseAccessibleHeader = true;
                    productListGridView.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
            {
                product = null;
            }
        }
Example #23
0
 internal DataTable GetMainProductsByWareHouseforSales(ProductBLL productBLL, LumexDBPlayer db)
 {
     try
     {
         db.AddParameters("@ID", productBLL.WareHouseId);
         DataTable dt = db.ExecuteDataTable("[GET_MAIN_PRODUCTS_BY_WAREHOUSE_FOR_SALES]", true);
         return dt;
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #24
0
        protected void deactivateLinkButton_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton lnkBtn = (LinkButton)sender;
                GridViewRow row = (GridViewRow)lnkBtn.NamingContainer;

                ProductBLL roduct = new ProductBLL();
                roduct.UpdateProductActivation(productListGridView.Rows[row.RowIndex].Cells[0].Text.ToString(), "False");

                productListGridView.Rows[row.RowIndex].Cells[5].Text = "False";
                string message = "Product <span class='actionTopic'>Deactivated</span> Successfully.";
                MyAlertBox("SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");");
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
        }
        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();");
            }
        }
Example #26
0
 internal DataTable GetMainProductListBySubProductId(ProductBLL productBLL, LumexDBPlayer db)
 {
     try
     {
         db.AddParameters("@SubProductId ", productBLL.SubProductId);
         DataTable dt = db.ExecuteDataTable("[GET_PRODUCTS_MAIN_BY_SUBPRoductID]", true);
         return dt;
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #27
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;
            }
        }
Example #28
0
        protected void updateButton_Click(object sender, EventArgs e)
        {
            ProductBLL product = new ProductBLL();

            try
            {
                if (productIdForUpdateHiddenField.Value.Trim() == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = "Product not found to update.";
                }
                //else if (barcodeTextBox.Text == "")
                //{
                //    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Barcode Name field is required.";
                //}
                else if (productNameOnlyTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Product Name field is required.";
                }
                else if (productVolumeTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Product Volume field is required.";
                }
                //else if (volumeQuantityTextBox.Text == "")
                //{
                //    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Volume Quantity field is required.";
                //}
                else if (unitTextBox.Text == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Unit field is required.";
                }
                //else if (vendorDropDownList.SelectedValue == "")
                //{
                //    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Product Vendor field is required.";
                //}
                else if (productGroupDropDownList.SelectedValue == "")
                {
                    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Product Group field is required.";
                }
                else
                {
                    product.ProductId = productIdForUpdateHiddenField.Value.Trim();
                    product.ProductNameOnly = productNameOnlyTextBox.Text.Trim();
                    product.Barcode = "";
                    product.ProductGroupId = productGroupDropDownList.SelectedValue.Trim();
                    product.SecondaryUnit = "";//secondaryUnitTextBox.Text.Trim();
                    product.ProductType = productTypeDropDownList.SelectedValue.Trim();
                    product.SubProduct = subProductDropDownList.SelectedValue.Trim();
                    product.ProductVolume = productVolumeTextBox.Text.Trim();
                    product.VolumeQuantity = decimal.Parse(volumeQuantityTextBox.Text.Trim());
                    product.Unit = unitTextBox.Text.Trim();
                    product.additinalInfo = txtBxAddition.Text;
                    if (productTypeDropDownList.SelectedValue == "Yes")
                    {
                        product.VendorId = vendorDropDownList.SelectedValue;
                    }
                    else
                    {
                        product.VendorId = "";
                    }
                    product.ProductName = product.ProductNameOnly.Trim() + "[" + " (" + product.additinalInfo.Trim() + ") " + product.ProductVolume.Trim() + "]";
                    product.salescenter = ""; //salescenterDropDownList.SelectedValue;
                    product.WareHouseId = warehouseDropDownList.SelectedValue;
                    product.productImageName = "";
                    product.productDesc = txtProductDesc.Text;

                    string updateCondition = "";

                    //if (barcodeForUpdateHiddenField.Value != product.Barcode.Trim())
                    //{
                    //    if (!product.CheckDuplicateProductByBarcode(product.Barcode.Trim()))
                    //    {
                    //        updateCondition += "Brc";
                    //    }
                    //    else
                    //    {
                    //        string message1 = "This Barcode <span class='actionTopic'>already exist</span>, try another one.";
                    //        MyAlertBox("WarningAlert(\"" + "Data Duplicate" + "\", \"" + message1 + "\");");
                    //        return;
                    //    }
                    //}

                    if (productNameForUpdateHiddenField.Value != product.ProductName.Trim())
                    {
                        if (!product.CheckDuplicateProductByName(product.ProductName.Trim(), product.WareHouseId, product.salescenter))
                        {
                            updateCondition += "Prdn";
                        }
                        else
                        {
                            string message2 = "This Product Name <span class='actionTopic'>already exist</span>, try another one.";
                            MyAlertBox("WarningAlert(\"" + "Data Duplicate" + "\", \"" + message2 + "\");");
                            return;
                        }
                    }
                    //string iamgeName = saveProductImage(product.Barcode.Trim());
                    //if (iamgeName == "")
                    //{
                    //    product.productImageName = ImageNameHiddenField.Value;
                    //}
                    //else
                    //{
                    //    product.productImageName = iamgeName;
                    //}
                    List<string> mainProductList = new List<string>();

                    for (int i = 0; i < mainProductListListBox.Items.Count; i++)
                    {
                        mainProductList.Add(mainProductListListBox.Items[i].Value);
                    }
                    product.UpdateProduct(mainProductList, updateCondition);
                    productNameForUpdateHiddenField.Value = "";
                    productIdForUpdateHiddenField.Value = "";
                    barcodeForUpdateHiddenField.Value = "";

                    string message = "Product <span class='actionTopic'>Updated</span> Successfully.";
                    MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/Product/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);");
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");
            }
            finally
            {
                product = null;
            }
        }
        //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;
            }
        }