예제 #1
0
        public int ToUpateStep([FromBody] AConFlowStep id)
        {
            var model = id;

            EnsureData(model);
            var allpos = m_codeService.UpdateSimpleCode(model);

            return(allpos);
        }
예제 #2
0
        public IActionResult ChangeDisable(int id)
        {
            var old = m_codeService.GetSimpleCodeLinq <DefaultUser>(p => p.Id == id)?.FirstOrDefault();

            if (old == null)
            {
                return(Json(new { isok = false, meg = "用户不存在" }));
            }
            old.IsDisable = true;
            var page = m_codeService.UpdateSimpleCode(old);

            return(Json(new { isok = true }));
        }
예제 #3
0
        public IActionResult SaveKeyvalue(int?id, string key, string value)
        {
            var recode = new  SystemDictionary();

            if (id == null)
            {
                recode = new SystemDictionary()
                {
                    AddTime = DateTime.Now, IsSystem = false, KeyName = key, Value = value, SystemDictionarytype = SystemDictionarytype.String
                };
                APPCommon.AppConfig.SystemDictionaries.Add(recode);
                var result = m_codeService.InsertCode <SystemDictionary>(recode);
            }
            else
            {
                //var sd = new SystemDictionary();// { AddTime = DateTime.Now, IsSystem = false, KeyName = key, Value = value, SystemDictionarytype = SystemDictionarytype.String };
                recode = m_codeService.GetSimpleCode <SystemDictionary>(new { Id = id }).FirstOrDefault();
                if (recode == null)
                {
                    recode = new  SystemDictionary()
                    {
                        AddTime = DateTime.Now, IsSystem = false, KeyName = key, Value = value, SystemDictionarytype = SystemDictionarytype.String
                    };
                    APPCommon.AppConfig.SystemDictionaries.Add(recode);
                    var result = m_codeService.InsertCode <SystemDictionary>(recode);
                }
                else
                {
                    recode.KeyName = key;
                    recode.Value   = value;
                    m_codeService.UpdateSimpleCode(recode);
                    var sindex = APPCommon.AppConfig.SystemDictionaries.FindIndex(p => p.Id == recode.Id);
                    APPCommon.AppConfig.SystemDictionaries[sindex].KeyName = key;
                    APPCommon.AppConfig.SystemDictionaries[sindex].Value   = value;
                }
            }


            return(new JsonResult(new { result = recode }));
        }
예제 #4
0
        public void ResgiterAllDll(string[] filepaths)
        {
            foreach (var f in filepaths)
            {
                Assembly asm      = Assembly.LoadFrom(f);
                var      fullname = asm.FullName;
                var      verunmer = asm.GetName().Version.ToString();

                var oldasscon = Dbclient.GetSimpleCode <AssemblyACon>(new { Name = asm.FullName }).FirstOrDefault();
                if (oldasscon == null)
                {
                    oldasscon         = new AssemblyACon();
                    oldasscon.AddTime = DateTime.Now;
                    AssemblyDescriptionAttribute asmdis = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyDescriptionAttribute));
                    AssemblyCopyrightAttribute   asmcpr = (AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyCopyrightAttribute));
                    AssemblyCompanyAttribute     asmcpn = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyCompanyAttribute));
                    string s = string.Format("Description:{0} Copyright:{1} Company:{2} ", asmdis != null ? asmdis.Description : string.Empty, asmcpr != null ? asmcpr.Copyright : string.Empty, asmcpn != null ? asmcpn.Company : string.Empty);
                    oldasscon.Description = s;
                    oldasscon.DllPath     = f;
                    oldasscon.IsVirtual   = false;
                    oldasscon.Name        = asm.FullName;
                    oldasscon.NameSpace   = asm.FullName;
                    oldasscon.VersionNum  = verunmer;
                    Dbclient.InsertCode(oldasscon);
                }
                else
                {
                    oldasscon.AddTime = DateTime.Now;
                    AssemblyDescriptionAttribute asmdis = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyDescriptionAttribute));
                    AssemblyCopyrightAttribute   asmcpr = (AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyCopyrightAttribute));
                    AssemblyCompanyAttribute     asmcpn = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyCompanyAttribute));
                    string s = string.Format("Description:{0} Copyright:{1} Company:{2} ", asmdis != null ? asmdis.Description : string.Empty, asmcpr != null ? asmcpr.Copyright : string.Empty, asmcpn != null ? asmcpn.Company : string.Empty);
                    oldasscon.Description = s;
                    oldasscon.DllPath     = f;
                    oldasscon.IsVirtual   = false;
                    oldasscon.NameSpace   = asm.FullName;
                    oldasscon.VersionNum  = verunmer;
                    Dbclient.UpdateSimpleCode(oldasscon);
                }
                var alltypes = asm.GetTypes().Where(p => p.IsAbstract == false &&
                                                    p.IsPublic == true
                                                    //&& p.Name != "ToString" && p.Name != "GetType"
                                                    && !p.Name.StartsWith("AspNetCore"));
                foreach (var t in alltypes)
                {
                    var oldtype = Dbclient.GetSimpleCode <TypeDefinition>(new { FullName = t.FullName }).FirstOrDefault();
                    if (oldtype == null)
                    {
                        oldtype                    = new TypeDefinition();
                        oldtype.AddTime            = DateTime.Now;
                        oldtype.ClassName          = t.Name;
                        oldtype.FullName           = t.FullName;
                        oldtype.GUID               = t.GUID;
                        oldtype.IsAbstract         = t.IsAbstract;
                        oldtype.IsArray            = t.IsArray;
                        oldtype.IsAutoLayout       = t.IsAutoLayout;
                        oldtype.IsClass            = t.IsClass;
                        oldtype.IsEnum             = t.IsEnum;
                        oldtype.IsGenericType      = t.IsGenericType;
                        oldtype.IsInterface        = t.IsInterface;
                        oldtype.IsNestedFamORAssem = t.IsNestedFamORAssem;
                        oldtype.IsNotPublic        = t.IsNotPublic;
                        oldtype.IsPublic           = t.IsPublic;
                        oldtype.IsSealed           = t.IsSealed;
                        oldtype.IsSpecialName      = t.IsSpecialName;
                        oldtype.IsValueType        = t.IsValueType;
                        oldtype.IsVisible          = t.IsVisible;
                        oldtype.Namespace          = t.Namespace;
                        oldtype.VersionNum         = verunmer;
                        oldtype.AliName            = t.FullName;
                        var reInt = Dbclient.InsertCode(oldtype);

                        oldtype.Id = reInt;
                    }
                    else
                    {
                        oldtype.AddTime            = DateTime.Now;
                        oldtype.VersionNum         = verunmer;
                        oldtype.ClassName          = t.Name;
                        oldtype.GUID               = t.GUID;
                        oldtype.IsAbstract         = t.IsAbstract;
                        oldtype.IsArray            = t.IsArray;
                        oldtype.IsAutoLayout       = t.IsAutoLayout;
                        oldtype.IsClass            = t.IsClass;
                        oldtype.IsEnum             = t.IsEnum;
                        oldtype.IsGenericType      = t.IsGenericType;
                        oldtype.IsInterface        = t.IsInterface;
                        oldtype.IsNestedFamORAssem = t.IsNestedFamORAssem;
                        oldtype.IsNotPublic        = t.IsNotPublic;
                        oldtype.IsPublic           = t.IsPublic;
                        oldtype.IsSealed           = t.IsSealed;
                        oldtype.IsSpecialName      = t.IsSpecialName;
                        oldtype.IsValueType        = t.IsValueType;
                        oldtype.IsVisible          = t.IsVisible;
                        oldtype.Namespace          = t.Namespace;
                        oldtype.AliName            = t.FullName;
                        Dbclient.UpdateSimpleCode(oldasscon);
                    }

                    var methodinfos = t.GetMethods().Where(p => p.IsAbstract == false && p.IsVirtual == false &&
                                                           p.MemberType == MemberTypes.Method && p.IsPublic == true &&
                                                           p.Name != "ToString" && p.Name != "GetType" &&
                                                           !p.Name.StartsWith("get") &&
                                                           !p.Name.StartsWith("set"));
                    foreach (var m in methodinfos)
                    {
                        string parameterInfo, retuentype, mfullname;
                        NewMethod(t, m, out parameterInfo, out retuentype, out mfullname);
                        var oldmethod = Dbclient.GetSimpleCode <MethodDefinition>(new { FullName = mfullname }).FirstOrDefault();
                        if (oldmethod == null)
                        {
                            oldmethod               = new MethodDefinition();
                            oldmethod.AddTime       = DateTime.Now;
                            oldmethod.BelongTypeId  = oldtype.Id;
                            oldmethod.FullName      = mfullname;
                            oldmethod.IsPrivate     = m.IsPrivate;
                            oldmethod.IsPublic      = m.IsPublic;
                            oldmethod.IsStatic      = m.IsStatic;
                            oldmethod.MemberType    = m.MemberType;
                            oldmethod.Name          = m.Name;
                            oldmethod.ParameterInfo = parameterInfo;
                            oldmethod.ReturnType    = retuentype;
                            oldmethod.VersionNum    = verunmer;
                            Dbclient.InsertCode(oldmethod);
                        }
                        else
                        {
                            oldmethod.AddTime       = DateTime.Now;
                            oldmethod.BelongTypeId  = oldtype.Id;
                            oldmethod.FullName      = mfullname;
                            oldmethod.IsPrivate     = m.IsPrivate;
                            oldmethod.IsPublic      = m.IsPublic;
                            oldmethod.IsStatic      = m.IsStatic;
                            oldmethod.MemberType    = m.MemberType;
                            oldmethod.Name          = m.Name;
                            oldmethod.ParameterInfo = parameterInfo;
                            oldmethod.ReturnType    = retuentype;
                            oldmethod.VersionNum    = verunmer;
                            Dbclient.UpdateSimpleCode(oldmethod);
                        }
                    }
                }
            }
        }