public static void Fill(ComboBox comboBox, QueryResult queryResult, object id) { CellRendererText cellRendererText = new CellRendererText(); comboBox.PackStart(cellRendererText, false); comboBox.SetCellDataFunc(cellRendererText, delegate(CellLayout cell_layout, CellRenderer Cell, TreeModel Tree_Model, TreeIter iter){ IList row = (IList)Tree_Model.GetValue(iter, 0); cellRendererText.Text = row[1].ToString(); }); ListStore listStore = new ListStore(typeof(IList)); //TODO localizacion de "sin asignar" IList first = new object [] { null, "<sin asignar>" }; TreeIter treeIterId = listStore.AppendValues(first); foreach (IList row in queryResult.Rows) { TreeIter treeIter = listStore.AppendValues(row); if (row[0].Equals(row [0])) { treeIterId = treeIter; } } comboBox.Model = listStore; //comboBox.Active = 0; comboBox.SetActiveIter(treeIterId); }
public T_MenuInfo SetModelDefaultValue(T_MenuInfo model) { model.MenuType = 1; model.MenuStatus = 1; model.IsDel = 1; model.SafeLevel = 1; string strError = string.Empty; Tree_Model treeModel = model as Tree_Model; Tree_Func treefunc = new Tree_Func(); if (treefunc.GetTreeNo(ref treeModel, ref strError)) { treeModel.MenuNo = treeModel.TreeNo; model = treeModel as T_MenuInfo; } return(model); }
public bool GetTreeNo(ref Tree_Model model, ref string strError) { Tree_DB _db = new Tree_DB(); try { string menuNo = _db.GetTreeNo(model); if (string.IsNullOrEmpty(menuNo)) { return(false); } model.TreeNo = menuNo; return(true); } catch (Exception ex) { strError = ex.Message; return(false); } }
public Tree(Tree_Model model) : base(model) { InitializeComponent(); }
public bool GetTreeNo(ref Tree_Model model, ref string strError) { Tree_Func tfunc = new Tree_Func(); return(tfunc.GetTreeNo(ref model, ref strError)); }