Esempio n. 1
0
        private EntityCommandDTO ToEntityCommandDTO(DR_Requester requester, EntityCommand item, bool withDetails)
        {
            EntityCommandDTO result = new EntityCommandDTO();

            //result.FormulaID = item.FormulaID ?? 0;
            //if (result.FormulaID != 0 && withDetails)
            //{
            //    var bizFormula = new BizFormula();
            //    result.Formula = bizFormula.GetFormula(item.FormulaID.Value);
            //}
            result.CodeFunctionID = item.CodeFunctionID;
            if (result.CodeFunctionID != 0 && withDetails)
            {
                var bizCodeFunction = new BizCodeFunction();
                result.CodeFunction = bizCodeFunction.GetCodeFunction(requester, item.CodeFunctionID);
            }
            //  result.TableDrivedEntityID = item.TableDrivedEntityID;
            foreach (var citem in item.TableDrivedEntity_EntityCommand)
            {
                result.Entities.Add(new EntityCommandEntityDTO()
                {
                    ID = citem.ID, EntityID = citem.TableDrivedEntityID
                });
            }
            result.ID = item.ID;
            //result.Message = item.Message;
            result.Title = item.Title;
            result.Type  = (EntityCommandType)item.Type;
            //result.Value = item.Value;
            return(result);
        }
Esempio n. 2
0
 public EntityCommand(EntityCommandDTO entityCommand, I_EditEntityArea editArea)
 {
     EntityCommandDTO = entityCommand;
     EditArea         = editArea;
     CommandManager.SetTitle(EntityCommandDTO.Title);
     //CommandManager.ImagePath = EntityCommandDTO. "Images//clear.png";
     CommandManager.Clicked += CommandManager_Clicked;
 }
Esempio n. 3
0
        public void UpdateEntityCommands(EntityCommandDTO EntityCommand)
        {
            using (var projectContext = new DataAccess.MyProjectEntities())
            {
                var dbEntityCommand = projectContext.EntityCommand.FirstOrDefault(x => x.ID == EntityCommand.ID);
                if (dbEntityCommand == null)
                {
                    dbEntityCommand = new DataAccess.EntityCommand();
                    dbEntityCommand.SecurityObject      = new SecurityObject();
                    dbEntityCommand.SecurityObject.Type = (int)DatabaseObjectCategory.Command;
                }
                //if (EntityCommand.FormulaID != 0)
                //    dbEntityCommand.FormulaID = EntityCommand.FormulaID;
                //else
                //    dbEntityCommand.FormulaID = null;
                //if (EntityCommand.CodeFunctionID != 0)
                //{
                dbEntityCommand.CodeFunctionID = EntityCommand.CodeFunctionID;

                //}
                //else
                //    dbEntityCommand.CodeFunctionID = null;
                //    dbEntityCommand.TableDrivedEntityID = EntityCommand.TableDrivedEntityID;
                dbEntityCommand.ID = EntityCommand.ID;
                //dbEntityCommand.Message = EntityCommand.Message;
                dbEntityCommand.Title = EntityCommand.Title;
                dbEntityCommand.Type  = (short)EntityCommand.Type;

                var entityIds  = EntityCommand.Entities.Select(x => x.EntityID).ToList();
                var removeList = dbEntityCommand.TableDrivedEntity_EntityCommand.Where(x => !entityIds.Contains(x.TableDrivedEntityID));
                foreach (var item in removeList)
                {
                    projectContext.TableDrivedEntity_EntityCommand.Remove(item);
                }
                foreach (var item in entityIds)
                {
                    if (!dbEntityCommand.TableDrivedEntity_EntityCommand.Any(x => x.TableDrivedEntityID == item))
                    {
                        dbEntityCommand.TableDrivedEntity_EntityCommand.Add(new TableDrivedEntity_EntityCommand()
                        {
                            TableDrivedEntityID = item
                        });
                    }
                }
                //dbEntityCommand.Value = EntityCommand.Value;
                if (dbEntityCommand.ID == 0)
                {
                    projectContext.EntityCommand.Add(dbEntityCommand);
                }
                projectContext.SaveChanges();
            }
        }
 //   int EntityID { set; get; }
 //string Catalog { set; get; }
 //int EntityCommandID { set; get; }
 public frmEntityCommand(int entityID, int entityCommandID)
 {
     InitializeComponent();
     //    EntityID = entityID;
     // EntityCommandID = entityCommandID;
     //GetCatalog();
     SetEnumType();
     SetLookups();
     //SetFromulas();
     if (entityCommandID == 0)
     {
         CommandMessage = new EntityCommandDTO();
     }
     else
     {
         GetEntityCommand(entityCommandID);
     }
     dtgEntities.ItemsSource = CommandMessage.Entities;
     ControlHelper.GenerateContextMenu(dtgEntities);
     SetEntities();
 }
 private void btnNew_Click(object sender, RoutedEventArgs e)
 {
     CommandMessage = new EntityCommandDTO();
     ShowCommandMessage();
 }
 private void GetEntityCommand(int EntityCommandID)
 {
     CommandMessage = bizEntityCommand.GetEntityCommand(MyProjectManager.GetMyProjectManager.GetRequester(), EntityCommandID, false);
     ShowCommandMessage();
 }