Пример #1
0
 protected void deleteType(object sender, EventArgs e)
 {
     typeSelected.Delete ();
     typeSelected = null;
     buttonDelete.Sensitive = false;
     entrySearch.Text = "";
     FillTree ();
 }
Пример #2
0
 protected void InsQuant(object sender, EventArgs e)
 {
     ENType tipo = new ENType (entryType.Text);
     tipo.Save ();
     FillTree ();
     entryType.Text = "";
     entryType.IsFocus = true;
 }
Пример #3
0
 /// <summary>
 /// Constructor que inicializa el objeto.
 /// </summary>
 /// <param name="name">Nombre del alimento.</param>
 /// <param name="quantity">Cantidad del alimento.</param>
 public ENFood(string name, int quantity = 0, ENType type = null)
     : base()
 {
     if (name == null)
     {
         throw new NullReferenceException("The name cannot be null");
     }
     cad           = new CADFood("GebatDataConnectionString");
     this.name     = name;
     this.quantity = quantity;
     this.type     = type;
 }
Пример #4
0
 /// <summary>
 /// Constructor que inicializa el objeto.
 /// </summary>
 /// <param name="name">Nombre del alimento.</param>
 /// <param name="quantity">Cantidad del alimento.</param>
 public ENFood(string name, int quantity = 0, ENType type = null)
     : base()
 {
     if (name == null)
     {
         throw new NullReferenceException("The name cannot be null");
     }
     cad = new CADFood("GebatDataConnectionString");
     this.name = name;
     this.quantity = quantity;
     this.type = type;
 }
Пример #5
0
        public override List <AEN> ReadAll()
        {
            List <AEN> ret   = new List <AEN>();
            DataTable  tabla = cad.SelectAll();

            foreach (DataRow rows in tabla.Rows)
            {
                ENType nueva = new ENType();
                nueva.FromRow(rows);
                ret.Add((ENType)nueva);
            }
            return(ret);
        }
Пример #6
0
        public override AEN Read(List <int> id)
        {
            ENType        ret   = new ENType();
            List <object> param = new List <object>();

            param.Add((object)id[0]);
            DataRow row = cad.Select(param);

            if (row != null)
            {
                ret.FromRow(cad.Select(param));
            }
            else
            {
                ret = null;
            }
            return(ret);
        }
Пример #7
0
 protected override void FromRow(DataRow row)
 {
     if (row != null)
     {
         this.id = new List <object> ();
         this.id.Add((int)row["Id"]);
         this.name     = (string)row["Name"];
         this.quantity = (int)row["Quantity"];
         if (row ["QuantityType"] != DBNull.Value)
         {
             List <int> ids = new List <int> ();
             ids.Add((int)row ["QuantityType"]);
             type = (ENType) new ENType("").Read(ids);
         }
         this.saved = true;
     }
     else
     {
         throw new NullReferenceException("Cannot convert from row, the row is null");
     }
 }
Пример #8
0
 protected override void FromRow(DataRow row)
 {
     if (row != null)
     {
         this.id = new List<object> ();
         this.id.Add((int)row["Id"]);
         this.name = (string)row["Name"];
         this.quantity = (int)row["Quantity"];
         if (row ["QuantityType"] != DBNull.Value)
         {
             List<int> ids = new List<int> ();
             ids.Add ((int)row ["QuantityType"]);
             type = (ENType)new ENType ("").Read (ids);
         }
         this.saved = true;
     }
     else
     {
         throw new NullReferenceException("Cannot convert from row, the row is null");
     }
 }
Пример #9
0
 public override List<AEN> ReadAll()
 {
     List<AEN> ret = new List<AEN>();
     DataTable tabla = cad.SelectAll();
     foreach (DataRow rows in tabla.Rows)
     {
         ENType nueva = new ENType();
         nueva.FromRow(rows);
         ret.Add((ENType)nueva);
     }
     return ret;
 }
Пример #10
0
        private void fillCombo()
        {
            quantityStore.Clear ();

            List<AEN> tipos = new ENType ("").ReadAll ();
            foreach (AEN t in tipos)
            {
                ENType ins = (ENType)t;
                quantityStore.AppendValues (ins);
            }
            comboboxType.Model = quantityStore;
        }
Пример #11
0
 public void DeleteWrongRow()
 {
     ACAD food = new CADType("GebatDataConnectionString");
     DataRow del = food.GetVoidRow;
     del["Name"] = new ENType("taca");
     food.Delete(del);
 }
Пример #12
0
 public void SaveNullName()
 {
     AEN food = new ENType(null);
     food.Save();
 }
Пример #13
0
 public void Save()
 {
     AEN food = new ENType("Cajas");
     food.Save();
 }
Пример #14
0
 protected void treeTypeSelected(object sender, EventArgs e)
 {
     TreeSelection selection = (sender as TreeView).Selection;
     TreeModel model;
     TreeIter iter;
     if (selection.GetSelected (out model, out iter))
     {
         var value = model.GetValue (iter, 0);
         typeSelected = (ENType)value;
         buttonDelete.Sensitive = true;
     }
 }
Пример #15
0
 protected void quantityChanged(object sender, EventArgs e)
 {
     ComboBox combo = sender as ComboBox;
     TreeIter iter;
     if(combo.GetActiveIter(out iter))
     {
         seleccionado = combo.Model.GetValue (iter, 0) as ENType;
     }
 }
Пример #16
0
 private void FillTree()
 {
     quantityStore.Clear ();
     List<AEN> tipos = new ENType ("").ReadAll ();
     foreach (AEN tipo in tipos)
     {
         ENType untipo = (ENType)tipo;
         quantityStore.AppendValues (untipo);
     }
     treeviewquantities.Model = quantityStore;
 }
Пример #17
0
 public override AEN Read(List<int> id)
 {
     ENType ret = new ENType();
     List<object> param = new List<object>();
     param.Add((object)id[0]);
     DataRow row = cad.Select(param);
     if (row != null)
     {
         ret.FromRow(cad.Select(param));
     }
     else
     {
         ret = null;
     }
     return ret;
 }