Example #1
0
    protected void EditRow(int index)
    {
        gvForStationeryCatalogue.EditIndex = index;
        gvForStationeryCatalogue.DataBind();
        GridViewRowCollection a   = gvForStationeryCatalogue.Rows;
        GridViewRow           row = a[index];
        Label        itemLabel    = (Label)row.FindControl("LblItemCode");
        DropDownList ddl          = (DropDownList)row.FindControl("DdlCategory");
        DropDownList ddl2         = (DropDownList)row.FindControl("DdlUOM");

        ddl.DataTextField  = "CategoryName";
        ddl.DataValueField = "CategoryID";
        List <Category> categories = EFBroker_Category.GetCategoryList();
        Item            item       = EFBroker_Item.GetItembyItemCode(itemLabel.Text);

        ddl.DataSource    = categories;
        ddl.SelectedValue = item.CategoryID.ToString();
        ddl.DataBind();

        ddl2.DataSource    = EFBroker_Item.GetDistinctUOMList();
        ddl2.SelectedValue = item.UnitOfMeasure;
        ddl2.DataBind();
        row.BackColor = Color.Yellow;
        return;
    }
    public string GetCatForGivenItemCode(string code)
    {
        int?   catFGI  = EFBroker_Item.GetItembyItemCode(code).CategoryID;
        string catFGI2 = EFBroker_Category.GetCategoryList().Where(z => z.CategoryID == catFGI).Select(d => d.CategoryName).FirstOrDefault();

        return(catFGI2);
    }
    public List <Item> GetAllItemsForGivenCat(string cat)
    {
        int         catID   = EFBroker_Category.GetCategoryList().Where(c => c.CategoryName == cat).Select(x => x.CategoryID).FirstOrDefault();
        List <Item> itemFGC = EFBroker_Item.GetItemsbyCategoryID(catID).ToList();

        return(itemFGC);
    }
Example #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ItemBusinessLogic ilogic  = new ItemBusinessLogic();
        List <Category>   catList = EFBroker_Category.GetCategoryList();
        Category          temp    = new Category();

        temp.CategoryID   = 0;
        temp.CategoryName = "Other";
        catList.Add(temp);
        DdlCategory.DataSource     = catList;
        DdlCategory.DataTextField  = "CategoryName";
        DdlCategory.DataValueField = "CategoryID";
        List <string> UOMList = EFBroker_Item.GetDistinctUOMList();

        UOMList.Add("Other");
        DdlUOM.DataSource = UOMList;
        if (Session["itemlist"] == null)
        {
            iList = new List <Item>();
            LblSubtitle.Visible = false;
        }
        else
        {
            iList = (List <Item>)Session["itemlist"];
            if (iList.Count != 0)
            {
                LblSubtitle.Visible = true;
            }
        }

        // data population
        gvItemAdded.DataSource = iList;
        gvItemAdded.DataBind();
        if (!IsPostBack)
        {
            DdlUOM.DataBind();
            DdlCategory.DataBind();
        }
        ControlToUpdate(TxtCategory, DdlCategory);
        ControlToUpdate(TxtUOM, DdlUOM);
    }
Example #5
0
 public static List <Category> GetCategoryList()
 {
     return(EFBroker_Category.GetCategoryList());
 }