protected void deleteType(object sender, EventArgs e) { typeSelected.Delete (); typeSelected = null; buttonDelete.Sensitive = false; entrySearch.Text = ""; FillTree (); }
protected void InsQuant(object sender, EventArgs e) { ENType tipo = new ENType (entryType.Text); tipo.Save (); FillTree (); entryType.Text = ""; entryType.IsFocus = true; }
/// <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; }
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); }
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); }
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"); } }
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"); } }
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; }
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; }
public void DeleteWrongRow() { ACAD food = new CADType("GebatDataConnectionString"); DataRow del = food.GetVoidRow; del["Name"] = new ENType("taca"); food.Delete(del); }
public void SaveNullName() { AEN food = new ENType(null); food.Save(); }
public void Save() { AEN food = new ENType("Cajas"); food.Save(); }
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; } }
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; } }
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; }
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; }