private DataTable GetImbaseTables() { using (SessionKeeper keeper = new SessionKeeper()) { IDBObjectCollection objCollection = keeper.Session.GetObjectCollection(1069); ConditionStructure[] conditions = new ConditionStructure[] { }; object[] columns = new object[] { ObligatoryObjectAttributes.F_OBJECT_ID, "Наименование" }; object[] sortColumns = new object[] { ObligatoryObjectAttributes.F_OBJECT_ID, "Наименование", }; SortOrders[] order = new SortOrders[] { SortOrders.ASC, SortOrders.ASC }; DBRecordSetParams pars = new DBRecordSetParams(conditions, columns, sortColumns, order, 0, null, QueryConsts.All, true, "MyIMBASE_TableSelection"); DataTable dt = objCollection.Select(pars); return(dt); } }
/// <summary> /// /// </summary> /// <param name="DocObj">Передаем null, инициализируеться в методе</param> /// <param name="_object"></param> private void CreatDoc(ref IDBObject DocObj, MyStruct _object) { DocObj = null; IDBObjectCollection coll = Session.GetObjectCollection((int)_object.IPsDocType); DocObj = coll.Create((int)_object.IPsDocType); // добавление создаваемого обьекта в Документы/Конструкторские/Электронные модели IDBAttribute atrName = DocObj.Attributes.FindByGUID(new Guid(SystemGUIDs.attributeName)); //наименование документа IDBAttribute atrDesignation = DocObj.Attributes.FindByGUID(new Guid(SystemGUIDs.attributeDesignation)); //обозначение документа atrName.Value = _object.Name; atrDesignation.Value = _object.Designition; var res = createdDocs.Where(x => x.Key.Equals(_object.Designition)).ToList(); if (res.Count == 0) { createdDocs.Add(_object.Designition, DocObj); } }
/// <summary> /// Создает изделие /// </summary> /// <param name="productType"></param> /// <param name="parentID">ID документа на который создаеться изделие</param>//prt private void CreateProduct(ref IDBObject DocObj, MyStruct _object) { IDBObjectCollection coll = Session.GetObjectCollection((int)_object.IPsProductType); IDBObject newObj = coll.Create((int)_object.IPsProductType); //берем аттрибуты объекта IDBAttribute atrDesignation = newObj.GetAttributeByGuid(new Guid(SystemGUIDs.attributeDesignation)); //обозначение IDBAttribute atrName = newObj.GetAttributeByGuid(new Guid(SystemGUIDs.attributeName)); //наименование atrDesignation.Value = _object.Designition; atrName.Value = _object.Name; newObj.CommitCreation(true); IDBObject newObjChecked = newObj.CheckOut(); IDBRelationCollection colRel = Session.GetRelationCollection(1004); IDBRelation relation = colRel.Create(newObjChecked.ObjectID, DocObj.ID); // создаем связь между изделием и докумиентом, if (relation == null) { MessageBox.Show("Failed create the relation of type " + colRel.RelationTypeID.ToString()); } }