Ejemplo n.º 1
0
        private string CheckInventoryForproducts()
        {
            Classes.CInventory ci = new Classes.CInventory();
            int wareHouseId       = Convert.ToInt32(ddlWareHouse.SelectedValue);

            if (wareHouseId < 0)
            {
                return("Please select warehouse");
            }
            else
            {
                for (int i = 0; i < grdSales.Rows.Count; i++)
                {
                    DropDownList ddlProduct = (DropDownList)grdSales.Rows[i].FindControl("ddlProducts");
                    TextBox      txtUnits   = (TextBox)grdSales.Rows[i].FindControl("txtUnits");
                    int          ProductId  = Convert.ToInt32(ddlProduct.SelectedValue);
                    int          Units      = Convert.ToInt32(txtUnits.Text);
                    string       retVal     = ci.CheckInventory(ProductId, Units, wareHouseId).ToString();
                    switch (retVal)
                    {
                    case "Successfull":
                    {
                        break;
                    }

                    default:
                        return(retVal + " Product[" + ddlProduct.SelectedItem.Text + "] in warehouse [" + ddlWareHouse.SelectedItem.Text + "]");
                    }
                }
                return("Successfull");
            }
        }
Ejemplo n.º 2
0
        private string CheckInventory()
        {
            Classes.CInventory ci = new Classes.CInventory();
            int    wareHouseId    = Convert.ToInt32(Session["WareHouse"].ToString());
            string OrderType      = ddlOrderType.SelectedItem.Text;

            switch (OrderType)
            {
            case "Please Select":
            {
                return("Please select Order Type");
                //    break;
            }

            case "Order To Client":
            {
                if (Convert.ToInt32(ddlCustomer.SelectedValue) < 0)
                {
                    return("Please select a Client");
                }
                break;
            }

            case "Order From Vendor":
            {
                if (Convert.ToInt32(ddlVendor.SelectedValue) < 0)
                {
                    return("Please select a Vendor");
                }
                break;
            }

            default:
                break;
            }
            if (wareHouseId < 0)
            {
                return("Please select warehouse");
            }
            else
            {
                if (OrderType.Contains("Client"))
                {
                    for (int i = 0; i < grdProducts.Rows.Count; i++)
                    {
                        DropDownList ddlProduct = (DropDownList)grdProducts.Rows[i].FindControl("ddlProducts");
                        TextBox      txtUnits   = (TextBox)grdProducts.Rows[i].FindControl("txtUnits");
                        int          ProductId  = Convert.ToInt32(ddlProduct.SelectedValue);
                        int          Units      = Convert.ToInt32(txtUnits.Text);
                        string       retVal     = ci.CheckInventory(ProductId, Units, wareHouseId).ToString();
                        switch (retVal)
                        {
                        case "Successfull":
                        {
                            break;
                        }

                        default:
                            return(retVal + " Product[" + ddlProduct.SelectedItem.Text + "] in warehouse [" + Session["WareHouse"].ToString() + "]");
                        }
                    }
                }
                return("Successfull");
            }
        }