public Record[] SearchRecord(string name,string model) { /* * Gives name and model for search record. */ ArrayList object_list = new ArrayList(); Model parent_model; parent_model = new Model(model); ArrayList args = new ArrayList(); args.Add(parent_model.model); if (name != null) { args.Add(name); } else { args.Add(""); } object[] objects = (object[])this.openerp_connect.Execute("plugin.handler", "list_document_get", args.ToArray()); foreach (object obj in objects) { Hashtable document = new Hashtable(); object[] names = (object[])obj; document.Add("id", names[0].ToString()); document.Add("name", names[1].ToString()); object_list.Add(new Record(document,parent_model)); } return (Record[])object_list.ToArray(typeof(Record)); }
public Record(long id, string name, Model model) { /* It gives the record of id, name and model. :param id : record id. :param name : record name. :param model : model name. */ this.id = id; this.name = name; this.model = model; }
public Record(Hashtable columns, Model model) { /* It gives the records in hashtable columns and also model name. :param columns : hashtable column values. :param model : model name. */ this.id = long.Parse(columns["id"].ToString()); if (columns.ContainsKey("name")) { this.name = columns["name"].ToString(); } this.model = model; this.columns = columns; }
public Model[] GetMailModels() { /* * function to get objects to display in combo box * returns the Array list of models. */ ArrayList obj_list = new ArrayList(); object mail_models = this.Connection.Execute("plugin.handler", "document_type"); foreach (object model in (object[])mail_models) { Model open_model; string[] models = (string[])model; open_model = new Model(models[0], models[1]); open_model.Connection = this.Connection; obj_list.Add(open_model); } return (Model[])obj_list.ToArray(typeof(Model)); }