예제 #1
0
        /// <summary>
        /// Insere o item no kit do PA
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OnRowUpdating_SalvarItem(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow r = GridView_ItensDisponiveis.Rows[e.RowIndex];
            int codigoitem = int.Parse(GridView_ItensDisponiveis.DataKeys[e.RowIndex]["Codigo"].ToString());

            ItemPA itempa = Factory.GetInstance<IItemPA>().BuscarPorCodigo<ItemPA>(codigoitem);

            KitItemPA kiiitem = new KitItemPA();
            kiiitem.ItemPA = itempa;
            kiiitem.Quantidade = int.Parse(((TextBox)r.FindControl("TextBox_Quantidade")).Text);

            IList<KitItemPA> kititens = RetornaItensASeremIncluidos();
            kititens.Add(kiiitem);

            Session["itensaseremincluidos"] = kititens;

            GridView_ItensDisponiveis.EditIndex = -1;
            CarregaItensKitDisponiveis(ViewState["co_kit"] != null ? int.Parse(ViewState["co_kit"].ToString()) : -1);
            CarregaItensKitProximos(RetornaItensASeremIncluidos());
        }
예제 #2
0
        /// <summary>
        /// Insere o item no kit do PA
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OnRowUpdating_InserirItem(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow r = GridView_ItensDisponiveis.Rows[e.RowIndex];
            int codigoitem = int.Parse(GridView_ItensDisponiveis.DataKeys[e.RowIndex]["Codigo"].ToString());
            IList<ItemPA> itensdisponiveis = this.WUCItemPA.Itens;
            ItemPA itempa = itensdisponiveis.Where(p => p.Codigo == codigoitem).First();

            KitItemPA kiiitem = new KitItemPA();
            kiiitem.KitPA = new KitPA();
            kiiitem.ItemPA = itempa;
            kiiitem.Quantidade = int.Parse(((TextBox)r.FindControl("TextBox_Quantidade")).Text);

            IList<KitItemPA> kititens = this.ItensInclusos;
            kititens.Add(kiiitem);
            this.ItensInclusos = kititens;

            itensdisponiveis.Remove(itempa);
            this.WUCItemPA.Itens = itensdisponiveis;

            GridView_ItensDisponiveis.EditIndex = -1;
            this.CarregaItensDisponiveis();
            this.CarregaItensInclusos();
        }