예제 #1
0
파일: Cantidades.cs 프로젝트: 44r0n/Gebat
 protected void deleteType(object sender, EventArgs e)
 {
     typeSelected.Delete ();
     typeSelected = null;
     buttonDelete.Sensitive = false;
     entrySearch.Text = "";
     FillTree ();
 }
예제 #2
0
파일: Cantidades.cs 프로젝트: 44r0n/Gebat
 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
파일: ENFood.cs 프로젝트: 44r0n/Gebat
 /// <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
파일: ENFood.cs 프로젝트: 44r0n/Gebat
 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
파일: ENType.cs 프로젝트: 44r0n/Gebat
 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
파일: FoodManager.cs 프로젝트: 44r0n/Gebat
        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
파일: CADTypeTest.cs 프로젝트: 44r0n/Gebat
 public void DeleteWrongRow()
 {
     ACAD food = new CADType("GebatDataConnectionString");
     DataRow del = food.GetVoidRow;
     del["Name"] = new ENType("taca");
     food.Delete(del);
 }
예제 #12
0
파일: ENTypeTest.cs 프로젝트: 44r0n/Gebat
 public void SaveNullName()
 {
     AEN food = new ENType(null);
     food.Save();
 }
예제 #13
0
파일: ENTypeTest.cs 프로젝트: 44r0n/Gebat
 public void Save()
 {
     AEN food = new ENType("Cajas");
     food.Save();
 }
예제 #14
0
파일: Cantidades.cs 프로젝트: 44r0n/Gebat
 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
파일: FoodManager.cs 프로젝트: 44r0n/Gebat
 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
파일: Cantidades.cs 프로젝트: 44r0n/Gebat
 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
파일: ENType.cs 프로젝트: 44r0n/Gebat
 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;
 }