internal void ShowObject(ObjectDTO ObjectDTO) { Object = ObjectDTO; txtObjectName.Text = ObjectDTO.ObjectName; txtCategory.Text = ObjectDTO.Category; chkNeedsExplicitPermission.IsChecked = Object.NeedsExplicitPermission; }
//获得object对象 public ObjectDTO GetObjectById(decimal objectId) { ObjectDTO result = null; using (BaseDB dbHelper = new RedasDBHelper()) { try { Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("i_object_id", objectId); List <ObjectDTO> list = null; list = dbHelper.ExecuteListProc <ObjectDTO>("PKG_OBJECT.sp_object_get", dic); if (list.Count > 0) { result = list[0]; } } catch (Exception ex) { throw; } } return(result); }
public void ShowDatabaseObjects(List <int> databaseIds) { ItemCollection collection = treeDBObjects.Items;; //if (parentCategory == DatabaseObjectCategory.Database) // collection = treeDBObjects.Items; //else // collection = FindTreeDBObject(treeDBObjects.Items, parentCategory, parentIdentity).Items; foreach (var id in databaseIds) { var database = bizDatabase.GetDatabase(id); ObjectDTO dbObject = new ObjectDTO(); dbObject.ObjectCategory = DatabaseObjectCategory.Database; dbObject.ObjectIdentity = id; //dbObject.SecurityObjectID = database.SecurityObjectID; dbObject.Title = database.Name; AddDBObjectsToTree(dbObject, treeDBObjects.Items); } //var objects = bizDatabaseToObject.GetDatabaseChildObjects(DatabaseObjectCategory.Database, databaseID); //AddDBObjectsToTree(objects, collection); if (treeDBObjects.Items.Count > 0 && treeDBObjects.Items[0] is TreeViewItem) { (treeDBObjects.Items[0] as TreeViewItem).IsExpanded = true; } }
//private string GetSchemaObjectName(string dbName, string schemaName) //{ // return dbName + ">" + schemaName; //} public ObjectDTO GetParentObject(DatabaseObjectCategory objectCategory, int objectIdentity) { if (objectCategory == DatabaseObjectCategory.Database) { return(null); } using (var projectContext = new DataAccess.MyProjectEntities()) { ObjectDTO result = null; if (objectCategory == DatabaseObjectCategory.Schema) { //var dbName = objectIdentity.Split('>')[0]; var schema = projectContext.DBSchema.First(x => x.ID == objectIdentity); result = ToObjectDTO(DatabaseObjectCategory.Database, schema.DatabaseInformationID, schema.DatabaseInformation.Name, "", 0); } else if (objectCategory == DatabaseObjectCategory.Entity) { //int id = Convert.ToInt32(objectIdentity); var entity = projectContext.TableDrivedEntity.First(x => x.ID == objectIdentity); result = ToObjectDTO(DatabaseObjectCategory.Schema, entity.Table.DBSchemaID, entity.Table.DBSchema.Name, "", 0); } else if (objectCategory == DatabaseObjectCategory.Column) { //var column = projectContext.TableDrivedEntity.First(x => x.ID == objectIdentity); //result = ToObjectDTO("Schema", GetSchemaObjectName(entity.Table.Catalog, entity.Table.RelatedSchema), entity.Table.RelatedSchema); } return(result); } }
public List <ObjectDTO> SceneReconstruction(int planId) { List <ObjectDTO> objects = new List <ObjectDTO>(); List <BoxDTO> BoxesInPlan = Boxs.BoxesInPlan(planId); foreach (BoxDTO box in BoxesInPlan) { List <BoardDTO> BoardsInBox = Boards.BoardsInBox(box.Id); List <DrawerDTO> DrawersInBox = Drawers.DrawersInBox(box.Id); List <DoorDTO> DoorsInBox = Doors.DoorsInBox(box.Id); List <bool> PozicijeFioka = new List <bool>(); List <bool> PozicijeVrata = new List <bool>(); for (int i = 0; i < BoardsInBox.Count + 1; i++) { PozicijeFioka.Add(false); PozicijeVrata.Add(false); } foreach (DrawerDTO d in DrawersInBox) { PozicijeFioka[d.pregrada] = true; } foreach (DoorDTO d in DoorsInBox) { PozicijeVrata[d.pregrada] = true; } ObjectDTO o = new ObjectDTO() { Width = box.Width, Height = box.Height, Depth = box.Depth, Name = box.Name, BoardThickness = box.BoardThickness, PositionX = box.PositionX, PositionY = box.PositionY, PositionZ = box.PositionZ, Texture = box.Texture, childs = BoardsInBox, nizFioka = DrawersInBox, pozicije_fioka = PozicijeFioka, nizVrata = DoorsInBox, pozicije_vrata = PozicijeVrata, vertikalno = box.vertikalno, horizontalno = box.horizontalno, globalX = box.globalX, globalY = box.globalY, globalZ = box.globalZ }; objects.Add(o); } return(objects); }
private RadTreeViewItem AddDBObjectsToTree(ObjectDTO item, ItemCollection collection) { var treeItem = new RadTreeViewItem(); treeItem.Header = GetNodeHeader(item.Title, item.ObjectCategory); treeItem.DataContext = item; collection.Add(treeItem); return(treeItem); }
private ObjectDTO ToObjectDTO(DatabaseObjectCategory objectCategory, int objectIdentity, string title) { ObjectDTO result = new ObjectDTO(); result.ObjectCategory = objectCategory; result.ObjectIdentity = objectIdentity; result.Title = title; return(result); }
public IActionResult SearchOEAN([FromQuery] int page, [FromQuery] string search) { try { if (page < 1) { throw new DataException("Page Number must be at least 1 (" + where + ") (ST)"); } if (search.Length == 0) { throw new DataException("Search String can't be BLANK (" + where + ") (ST)"); } int jump, records, maxpages = 1; Code_Mstr cdm = S.ServiceLocator.Instance.CodeMstrService.Get(new Code_Mstr("CONFIGURATION", "JUMP_OBJECT", "")); if (cdm is null) { jump = 50; } else if (!int.TryParse(cdm.Code_Desc, out jump)) { jump = 50; } records = S.ServiceLocator.Instance.GeneralTypeService.SearchEANcnt(search); IEnumerable <GenObjectSearch> objs = null; if (records > 0) { if (records > jump) { maxpages = records / jump; if (records % jump > 0) { maxpages += 1; } } if (page <= maxpages) { objs = S.ServiceLocator.Instance.GeneralTypeService.SearchEAN(page, jump, search); } if (objs != null && objs.OfType <GenObjectSearch>().Count() == 0) { objs = null; } } ObjectDTO odto = new ObjectDTO(records, maxpages, page, jump, objs); return(ApiControllerHelper.SendOk(this, new ApiResult <ObjectDTO>(HttpStatusCode.OK, null, odto), true)); } catch (Exception ex) { return(ApiControllerHelper.SendError(this, ex)); } }
public IHttpActionResult GetObjectById(long objectId) { using (var client = ServiceClient <IObjectManager> .Create(ObjectConstants.ObjectManager)) { _objectDTO = client.Instance.GetObjectById(objectId); } return(Ok(_objectDTO)); }
public IHttpActionResult UpdateObject(ObjectDTO objects) { long objectId; using (var client = ServiceClient <IObjectManager> .Create(ObjectConstants.ObjectManager)) { objectId = client.Instance.Update(objects); } return(Ok(objectId)); }
public Task <ObjectDTO> GetDatabaseObjects(DatabaseDTO database) { return(Task.Run(() => { ObjectDTO dbObject = new ObjectDTO(); dbObject.ObjectCategory = DatabaseObjectCategory.Database; dbObject.ObjectIdentity = database.ID; dbObject.Title = database.Name; AddChildObjects(dbObject); return dbObject; })); }
//private Tuple<string, string> GetDBNameSchemaName(string objectIdentity) //{ // return new Tuple<string, string>(objectIdentity.Split('>')[0], objectIdentity.Split('>')[1]); //} private ObjectDTO ToObjectDTO(DatabaseObjectCategory objectCategory, int objectIdentity, string title, string name, int tableDrivedEntityID, EntityObjectType entityType = EntityObjectType.None) { ObjectDTO result = new ObjectDTO(); result.ObjectCategory = objectCategory; result.ObjectIdentity = objectIdentity; result.Title = title; result.TableDrivedEntityID = tableDrivedEntityID; result.EntityType = entityType; result.Name = name; //result.SecurityObjectID = securityObjectID; result.NeedsExplicitPermission = (objectCategory == DatabaseObjectCategory.Entity); return(result); }
public ObjectDTO InstanceAndReturnNew(TypeEnum generate) { var obj = real.ExecuteAction(generate); if (generate == TypeEnum.Empty) { emptyObject = obj; return(obj); } else { filledObject = obj; return(obj); } }
private RadTreeViewItem AddEntityObjectNode(ItemCollection collection, DatabaseObjectCategory objectCategory, int objectIdentity, string title, string tooltip = null) { var node = new RadTreeViewItem(); var context = new ObjectDTO(); context.ObjectCategory = objectCategory; context.Title = title; context.ObjectIdentity = objectIdentity; node.DataContext = context; _AllItems.Add(node); node.Header = GetNodeHeader(context.Title, context.ObjectCategory); node.ToolTip = tooltip; // node.Selected += node_Selected; collection.Add(node); return(node); }
private void AddChildObjects(ObjectDTO objectDTO) { if (InfoUpdated != null) { InfoUpdated(this, new ItemImportingStartedArg() { ItemName = "Fetching database object " + objectDTO.Title }); } var childObjects = bizDatabaseToObject.GetDatabaseChildObjects(objectDTO.ObjectCategory, objectDTO.Title, Convert.ToInt32(objectDTO.ObjectIdentity)); foreach (var child in childObjects) { objectDTO.ChildObjects.Add(child); AddChildObjects(child); } }
static void Main(string[] args) { Mapper.Initialize(cfg => { cfg.CreateMap <ObjectDTO, Object>() .ForMember(dest => dest.Number, opt => opt.Condition(src => src.Number.HasValue)) .ForMember(dest => dest.LastUpdateDate, opt => opt.Condition(src => src.LastUpdateDate.HasValue)); }); Mapper.AssertConfigurationIsValid(); var source = new ObjectDTO { LastUpdateDate = DateTime.Now }; var destination = new Object { Number = 10, LastUpdateDate = DateTime.Now.AddDays(-10) }; var result = Mapper.Map(source, destination); }
public void ShowDatabaseObjects(List <int> databaseIds) { //ItemCollection collection = null; //if (parentIdentity == 0) // collection = treeDBObjects.Items; //else // collection = FindTreeDBObject(treeDBObjects.Items, parentCategory, parentIdentity).Items; foreach (var id in databaseIds) { var database = bizDatabase.GetDatabaseByEntityID(id); ObjectDTO dbObject = new ObjectDTO(); dbObject.ObjectCategory = DatabaseObjectCategory.Database; dbObject.ObjectIdentity = id.ToString(); dbObject.Title = database.Name; var node = AddDBObjectsToTree(dbObject, treeDBObjects.Items); } // var objects = bizDatabaseToObject.GetDatabaseChildObjects(parentCategory, parentIdentity); // AddDBObjectsToTree(objects, collection); }
private void btnSave_Click(object sender, RoutedEventArgs e) { BizObject bizObject = new BizObject(); if (Object == null) { Object = new ObjectDTO(); } Object.ObjectName = txtObjectName.Text; Object.Category = txtCategory.Text; Object.NeedsExplicitPermission = chkNeedsExplicitPermission.IsChecked == true; bizObject.SaveObject(Object); if (ObjectSaved != null) { ObjectSavedArg arg = new ObjectSavedArg(); arg.Object = Object; ObjectSaved(this, arg); } }
private TreeViewItem AddDBObjectsToTree(ObjectDTO item, ItemCollection collection) { var treeItem = new TreeViewItem(); if (!ExceptColumns || item.ObjectCategory != DatabaseObjectCategory.Entity) { treeItem.Items.Add("Loading..."); treeItem.Expanded += treeItem_Expanded; } treeItem.Header = GetNodeHeader(item.Title, item.ObjectCategory); treeItem.DataContext = item; treeItem.MouseRightButtonDown += (sender, e) => TreeItem_MouseRightButtonDown(sender, e, treeItem, item); //if(item.ParentID==null) collection.Add(treeItem); return(treeItem); //else //{ // treeItem.Items //} }
//获得询价信息中的多个表单的信息 /// <summary> /// /// </summary> /// <param name="objectId"></param> /// <param name="type">1:询价 2:查勘</param> /// <returns></returns> public Dictionary <int, JArray> GetDynamicFormData(decimal objectId, int type) { ObjectDTO info = GetObjectById(objectId); Dictionary <int, JArray> lstFormData = new Dictionary <int, JArray>(); if (type == 1 && info.INQUIRY_FORM_ID > 0) //询价表单Id { FormStoreDTO formInfo = GetFormStore(info.INQUIRY_FORM_ID); JArray arry = JArray.Parse(formInfo.CONTENTS); lstFormData.Add(1, arry); } if (type == 2 && info.SURVEY_FORM_ID > 0) //查勘表单Id { FormStoreDTO formInfo = GetFormStore(info.SURVEY_FORM_ID); if (!lstFormData.ContainsKey(Convert.ToInt32(formInfo.INSTANCE_TYPE_ID))) { JArray arry = JArray.Parse(formInfo.CONTENTS); lstFormData.Add(2, arry); } } return(lstFormData); }
private void TreeItem_MouseRightButtonDown(object sender, MouseButtonEventArgs e, TreeViewItem treeItem, ObjectDTO item) { if (ObjectRightClick != null) { ObjectRightClickedArg arg = new MyProject_WPF.ObjectRightClickedArg(); arg.Node = treeItem; arg.Object = item; ObjectRightClick(sender, arg); } }
public static async Task <object> UpdateAsync(ObjectDTO objectToUpdate) { return(await TypeToServiceDictionary[objectToUpdate.GetType()].UpdateAsync(objectToUpdate)); }
public static async Task DeleteAsync(ObjectDTO objectToDelete) { await TypeToServiceDictionary[objectToDelete.GetType()].DeleteAsync(objectToDelete.Id); }
public static async Task <object> AddAsync(ObjectDTO objectToAdd) { return(await TypeToServiceDictionary[objectToAdd.GetType()].AddAsync(objectToAdd)); }
public void SaveConfiguration(string ArrayOfObjects, int planId) { //List<ObjectDTO> objects = (List<ObjectDTO>)JsonSerializer.DeserializeFromString(ArrayOfObjects, typeof(List<ObjectDTO>)); ObjectDTO o = (ObjectDTO)JsonSerializer.DeserializeFromString(ArrayOfObjects, typeof(ObjectDTO)); //foreach (ObjectDTO o in objects) //{ //} BoxDTO box = new BoxDTO() { PlanId = planId, Width = o.Width, Height = o.Height, Depth = o.Depth, BoardThickness = o.BoardThickness, PositionX = o.PositionX, PositionY = o.PositionY, PositionZ = o.PositionZ, Name = o.Name, Texture = o.Texture, vertikalno = o.vertikalno, horizontalno = o.horizontalno, globalX = o.globalX, globalY = o.globalY, globalZ = o.globalZ }; int boxId = Boxs.Create(box); foreach (BoardDTO b in o.childs) { BoardDTO board = new BoardDTO() { BoxId = boxId, Width = b.Width, Height = b.Height, Depth = b.Depth, BoardThickness = b.BoardThickness, PositionX = b.PositionX, PositionY = b.PositionY, PositionZ = b.PositionZ, Name = b.Name, Texture = b.Texture }; int boardId = Boards.Create(board); } List <int> pozicije = new List <int>(); if (o.pozicije_fioka != null) { for (int i = 0; i < o.childs.Count + 1; i++) { if (o.pozicije_fioka[i] == true) { pozicije.Add(i); } } } int k = 0; foreach (DrawerDTO d in o.nizFioka) { DrawerDTO drawer = new DrawerDTO() { BoxId = boxId, Width = d.Width, Height = d.Height, Depth = d.Depth, BoardThickness = d.BoardThickness, PositionX = d.PositionX, PositionY = d.PositionY, PositionZ = d.PositionZ, Name = d.Name, Texture = d.Texture, pregrada = pozicije[k] }; int drawerId = Drawers.Create(drawer); k++; } pozicije = new List <int>(); if (o.pozicije_vrata != null) { for (int i = 0; i < o.childs.Count + 1; i++) { if (o.pozicije_vrata[i] == true) { pozicije.Add(i); } } } k = 0; foreach (DoorDTO d in o.nizVrata) { DoorDTO door = new DoorDTO() { BoxId = boxId, Width = d.Width, Height = d.Height, Depth = d.Depth, PositionX = d.PositionX, PositionY = d.PositionY, PositionZ = d.PositionZ, Name = d.Name, Texture = d.Texture, pregrada = pozicije[k] }; int doorId = Doors.Create(door); k++; } }
//public DatabaseDTO GetDatabaseDTO(int entityID) //{ // using (var context = new MyProjectEntities()) // { // var entity = context.TableDrivedEntity.FirstOrDefault(x => x.ID == entityID); // if (entity != null) // { // var dbInfo = context.DatabaseInformation.FirstOrDefault(x => x.Name == entity.Table.Catalog); // if (dbInfo != null) // return ToDatabaseDTO(dbInfo); // } // return null; // } //} //public List<DatabaseDTO> GetDatabases() //{ // List<DatabaseDTO> result = new List<DatabaseDTO>(); // using (var projectContext = new DataAccess.MyProjectEntities()) // { // var list = projectContext.DatabaseInformation; // foreach (var item in list) // { // result.Add(ToDatabaseDTO(item)); // } // } // return result; //} //private DatabaseDTO ToDatabaseDTO(DataAccess.DatabaseInformation item) //{ // DatabaseDTO result = new DatabaseDTO(); // result.Name = item.Name; // result.ConnectionString = item.ConnectionString; // return result; //} //public List<SchemaDTO> GetSchemaDTO(string databaseName) //{ // List<SchemaDTO> result = new List<SchemaDTO>(); // using (var projectContext = new DataAccess.MyProjectEntities()) // { // foreach (var schema in projectContext.TableDrivedEntity.Where(x => x.Table.Catalog == databaseName).GroupBy(x => x.Table.RelatedSchema)) // { // result.Add(ToSchemaDTO(schema)); // } // } // return result; //} //private SchemaDTO ToSchemaDTO(IGrouping<string, DataAccess.TableDrivedEntity> schema) //{ // SchemaDTO result = new SchemaDTO(); // result.Name = schema.Key; // return result; //} public List <ObjectDTO> GetDatabaseChildObjects(DatabaseObjectCategory parentCategory, string parentTitle, int parentIdentity) { List <ObjectDTO> result = new List <ObjectDTO>(); using (var myProjectContext = new MyProjectEntities()) { //foreach (var database in myProjectContext.DatabaseInformation) //{ // ObjectDTO dbObject = ToObjectDTO(DatabaseObjectCategory.Database, database.Name, database.Name); // result.Add(dbObject); //} if (parentCategory == DatabaseObjectCategory.Database) { foreach (var schema in myProjectContext.DBSchema.Where(x => x.DatabaseInformationID == parentIdentity)) { //var schemaName = ""; //if (string.IsNullOrEmpty(schema.Key)) // schemaName = "Default Schema"; //else //schemaName = schema.Name; ObjectDTO schemaObject = ToObjectDTO(DatabaseObjectCategory.Schema, schema.ID, schema.Name, "", 0); result.Add(schemaObject); } } else if (parentCategory == DatabaseObjectCategory.Schema) { //var res = GetDBNameSchemaName(parentIdentity); foreach (var entity in myProjectContext.TableDrivedEntity.Where(x => x.IsDisabled == false && x.Table.DBSchemaID == parentIdentity)) { if (IgnoreNotIndependentOrAlreadyInNavigationTree) { if (entity.IndependentDataEntry != true || myProjectContext.NavigationTree.Any(x => x.Category == "Entity" && x.ItemIdentity == entity.ID)) { continue; } } if (IgnoreViews) { if (entity.IsView) { continue; } } ObjectDTO entityObject = ToObjectDTO(DatabaseObjectCategory.Entity, entity.ID, string.IsNullOrEmpty(entity.Alias) ? entity.Name : entity.Alias, entity.Name, entity.ID, entity.IsView ? EntityObjectType.View : EntityObjectType.Entity); result.Add(entityObject); } } else if (parentCategory == DatabaseObjectCategory.Entity) { int id = Convert.ToInt32(parentIdentity); var dbEntity = myProjectContext.TableDrivedEntity.First(x => x.ID == id); if (!IgnoreColumns) { List <Column> columns = null; if (dbEntity.TableDrivedEntity_Columns.Any()) { columns = dbEntity.TableDrivedEntity_Columns.Select(x => x.Column).ToList(); } else { columns = dbEntity.Table.Column.ToList(); } foreach (var column in columns) { bool skipColumn = false; if (HidePKColumns) { if (column.PrimaryKey) { skipColumn = true; } } if (HideFKRelationshipColumns) { var type = (int)Enum_MasterRelationshipType.FromForeignToPrimary; if (myProjectContext.Relationship.Any(x => x.Removed != true && x.MasterTypeEnum == type && x.RelationshipColumns.Any(y => y.FirstSideColumnID == column.ID && y.Column.PrimaryKey == false))) { skipColumn = true; } } if (!skipColumn) { ObjectDTO columnObject = ToObjectDTO(DatabaseObjectCategory.Column, column.ID, string.IsNullOrEmpty(column.Alias) ? column.Name : column.Alias, column.Name, id); result.Add(columnObject); } } } if (!IgnoreRelationships) { foreach (var relationship in dbEntity.Relationship.Where(x => x.Removed != true)) { ObjectDTO relationshipObject = ToObjectDTO(DatabaseObjectCategory.Relationship, relationship.ID, string.IsNullOrEmpty(relationship.Alias) ? relationship.Name : relationship.Alias, relationship.Name, id); result.Add(relationshipObject); } } if (!IgnoreCommands) { foreach (var command in dbEntity.TableDrivedEntity_EntityCommand) { ObjectDTO commandObject = ToObjectDTO(DatabaseObjectCategory.Command, command.EntityCommandID, command.EntityCommand.Title, "", id); result.Add(commandObject); } } if (!IgnoreReports) { foreach (var report in dbEntity.EntityReport) { ObjectDTO commandObject = ToObjectDTO(DatabaseObjectCategory.Report, report.ID, report.Title, "", id); result.Add(commandObject); } } if (dbEntity.IsView == false && !IgnoreEntityArchive) { ObjectDTO commandObject = ToObjectDTO(DatabaseObjectCategory.Archive, parentIdentity, "آرشیو" + " " + parentTitle, "", id); result.Add(commandObject); } if (dbEntity.IsView == false && !IgnoreEntityLetter) { ObjectDTO commandObject = ToObjectDTO(DatabaseObjectCategory.Letter, parentIdentity, "نامه ها" + " " + parentTitle, "", id); result.Add(commandObject); } if (!IgnoreDataView) { ObjectDTO commandObject = ToObjectDTO(DatabaseObjectCategory.DataView, parentIdentity, "نمای داده" + " " + parentTitle, "", id); result.Add(commandObject); } if (!IgnoreGridView) { ObjectDTO commandObject = ToObjectDTO(DatabaseObjectCategory.GridView, parentIdentity, "گرید داده" + " " + parentTitle, "", id); result.Add(commandObject); } } } return(result); }