private static void FindNityfyApi(NotifyItem item, EntityConfig friend)
        {
            var api = GlobalConfig.GetApi(p => p.Name == item.CommandId || p.ResultArg == item.NotifyEntity);

            if (api != null)
            {
                item.CommandId = api.Name;
                return;
            }
            var kw  = item.Name.MulitReplace2("", "On", "Rsp");
            var kw1 = kw;

            api = GlobalConfig.GetApi(p => p.Name == kw1);
            if (api != null)
            {
                item.CommandId = api.Name;
                return;
            }
            kw = kw.MulitReplace2("", "Qry");

            var kw2 = kw;

            api = GlobalConfig.GetApi(p => p.Name == kw2);
            if (api != null)
            {
                item.CommandId = api.Name;
                return;
            }
            kw = "Qry" + kw;

            var kw3 = kw;

            api = GlobalConfig.GetApi(p => p.Name == kw3);

            if (api != null)
            {
                item.CommandId = api.Name;
                return;
            }
            kw = item.Caption.MulitReplace2("", "时", "请求", "结构", "应答", "操作");

            var kw4 = kw;

            api = GlobalConfig.GetApi(p => p.Caption == kw4);
            if (api != null)
            {
                item.CommandId = api.Name;
                return;
            }
            kw = friend.Caption.MulitReplace2("", "时", "请求", "结构", "应答", "操作");
            var result = GlobalConfig.GetEntity(p => p != friend && p.Caption != null && p.Caption.Contains(kw));

            if (result != null)
            {
                api            = GlobalConfig.GetApi(p => p.CallArg == result.Name);
                item.CommandId = api?.Name;
            }
            item.CommandId = null;
        }
Beispiel #2
0
 /// <summary>
 /// 加入实体
 /// </summary>
 /// <param name="api"></param>
 public void Add(NotifyItem api)
 {
     api.Parent = this;
     if (!NotifyItems.Contains(api))
     {
         NotifyItems.Add(api);
     }
 }
Beispiel #3
0
 /// <summary>
 /// 加入实体
 /// </summary>
 /// <param name="api"></param>
 public void Remove(NotifyItem api)
 {
     api.Parent = this;
     NotifyItems.Remove(api);
 }
        private void FindNitifyClientEntity(EntityConfig friend, ProjectConfig apiProject, NotifyItem item)
        {
            var entity = GlobalConfig.GetEntity(p => p != friend && p.Tag == friend.Tag);

            if (entity == null)
            {
                entity = new EntityConfig
                {
                    Parent      = apiProject,
                    Project     = apiProject.Name,
                    CppName     = friend.Name,
                    Name        = ToClientName(friend.Name),
                    Caption     = item.Caption,
                    Description = item.Caption + "(消息通知)",
                    IsClass     = false,
                    Classify    = friend.Classify,
                    Tag         = friend.Tag
                };
                apiProject.Entities.Add(entity);
                SolutionConfig.Current.Entities.Add(entity);
            }
            item.ClientEntity = entity.Name;
            if (entity.PrimaryColumn == null)
            {
                entity.Properties.Add(new PropertyConfig
                {
                    Name         = entity.Name + "Id",
                    Caption      = entity.Caption + "ID",
                    Description  = entity.Caption + "ID",
                    IsPrimaryKey = true,
                    IsIdentity   = true,
                    CsType       = "int",
                    CppType      = "int",
                    Parent       = entity
                });
            }
            foreach (var property in friend.Properties)
            {
                property.CsType = CppTypeHelper.CppTypeToCsType(property);
                property.Tag    = friend.Tag + "," + property.Name;
                var fp = entity.Properties.FirstOrDefault(p => p.Tag != null && p.Tag == property.Tag)
                         ?? entity.Properties.FirstOrDefault(p => p.Name == property.Name);
                if (fp == null)
                {
                    fp = new PropertyConfig();
                    fp.CopyFrom(property);
                    fp.Parent = entity;
                    entity.Properties.Add(fp);
                }
                fp.Parent  = entity;
                fp.Tag     = property.Tag;
                fp.Caption = property.Caption;
            }
        }