예제 #1
0
        public void GravaItem(ML_Item item, NSAADMEntities n)
        {
            ML_Item it = new ML_Item();

            try
            {
                it = (from p in n.ML_Item where p.id == item.id select p).First();

            }
            catch (InvalidOperationException)
            {

                it.id_org = item.id_org;
                it.id = item.id;
                it.title = item.title;
                it.variation_id = item.variation_id;

                n.ML_Item.AddObject(it);

                n.SaveChanges();
            }
            catch (Exception ex)
            {
                throw new Exception("Erro na rotina GravaItem", ex);
            }
        }
        public ML_Item RetornaProduto(string id, NSAADMEntities n)
        {
            try
            {
                return (from p in n.ML_Item where p.id == id select p).First();
            }
            catch (Exception)
            {

                ML_Item ml = new ML_Item();
                ml.title = "Sem venda";
                return ml;

            }
        }
예제 #3
0
        protected void CasdastraExibiItem()
        {
            try
            {
                cItens.GravaItem(conv.ConverteItemParaML_Item(cm.RetornaItem(mlq.item_id)), cm.n);

                mlItem = cprod.RetornaProduto(mlq.item_id, cm.n);

                Label1.Text = mlItem.title;
            }
            catch (Exception ex)
            {

                throw new Exception("Erro na rotina CasdastraExibiItem", ex);
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the ML_Item EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToML_Item(ML_Item mL_Item)
 {
     base.AddObject("ML_Item", mL_Item);
 }
 /// <summary>
 /// Create a new ML_Item object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="title">Initial value of the title property.</param>
 public static ML_Item CreateML_Item(global::System.String id, global::System.String title)
 {
     ML_Item mL_Item = new ML_Item();
     mL_Item.id = id;
     mL_Item.title = title;
     return mL_Item;
 }
        public ML_Item ConverteItem(Item i)
        {
            ML_Item it = new ML_Item();

            try
            {

                it.id = i.id;
                it.title = i.title;
                it.variation_id = i.variation_id;

                return it;

            }
            catch (Exception ex)
            {
                throw new Exception("Erro na rotina ConverteItem2.", ex);

            }
        }