Esempio n. 1
0
 public static string GetTableName <TTable>(this SchemaBuilder schemaBuilder)
 {
     return(string.Concat(
                ModuleHelper.GetModuleName <TTable>().ChangeToUnderScore(),
                "_",
                typeof(TTable).Name
                ));
 }
 void InitHelpers()
 {
     _baseRefs  = new BaseRefs(ModuleDefinition);
     _helper    = new ModuleHelper(ModuleDefinition, _baseRefs);
     _anchor    = new Anchor(ModuleDefinition, _helper, _baseRefs);
     _attribute = new AnchorAttribute(ModuleDefinition, _helper, _baseRefs);
     _tie       = new Tie(ModuleDefinition, _helper, _baseRefs);
 }
 private static void InitializeContainer(Container container)
 {
     ModuleHelper.GetModuleTypes(typeof(SimpleInjectorInitializer).Assembly)
     .CreateModules()
     .Cast <IPackage>()
     .ToList()
     .ForEach(x => x.RegisterServices(container));
 }
Esempio n. 4
0
        public void GetDefaultConstructorReturnsValidConstructorTest()
        {
            var type = ModuleHelper.LoadType <SampleWithConstructors>();

            var method = type.GetDefaultConstructor();

            Assert.NotNull(method);
            Assert.Equal("System.Void FodyTools.Tests.TypeExtensionMethodsTests/SampleWithConstructors::.ctor()", method.FullName);
        }
Esempio n. 5
0
        private void OpenFile(string path)
        {
            menuToolsQuickCRC.Enabled = false;
            _filePath = path;
            var fs          = new FileStream(_filePath, FileMode.Open, FileAccess.ReadWrite);//File.OpenWrite(_filePath));
            var type        = ModuleHelper.GetModuleType(_filePath, fs);
            var tempContext = ModuleHelper.CreateByType(type);

            if (tempContext == null)
            {
                MessageBox.Show("This file is unsupported!");
                fs.Close();
                return;
            }
            fs.Seek(0, SeekOrigin.Begin);
            if (!tempContext.Open(fs))
            {
                MessageBox.Show(string.Format("Error: {0}", tempContext.GetErrorMessage()));
                fs.Close();
                return;
            }
            var fileSize = fs.Length;

            fs.Close();

            //Start the open process
            LoadText(_filePath);
            treeView.Nodes.Clear();
            var nodes = tempContext.GetExplorerTopNode();

            treeView.Nodes.Add(nodes);
            treeView.ExpandAll();
            lvFileTree.Nodes.Clear();
            nodes = tempContext.GetFileSystemTopNode();
            if (nodes != null)
            {
                lvFileTree.Nodes.Add(nodes);
            }
            lvFileTree.ExpandAll();

            _currentContext       = tempContext;
            treeView.SelectedNode = treeView.Nodes[0];

            if (type == ModuleType.CCI)
            {
                file_path = path;
                var cciContext = (CCIContext)_currentContext;
                menuCci.Visible = false;
                if (cciContext.NcsdInfo.CCI_File_Status == 1 || cciContext.NcsdInfo.CCI_File_Status == 2) //Enable CCI Size Manipulation by 3DSGuy
                {
                    handleCciMenu(cciContext);
                }
            }
            menuFileSave.Enabled      = _currentContext.CanCreate();
            menuToolsQuickCRC.Enabled = true;
        }
Esempio n. 6
0
        protected override void OnSubModuleLoad()
        {
            base.OnSubModuleLoad();

            Initialize();
            Module.CurrentModule.GlobalTextManager.LoadGameTexts(
                ModuleHelper.GetXmlPath(ModuleId, "module_strings"));
            Module.CurrentModule.GlobalTextManager.LoadGameTexts(
                ModuleHelper.GetXmlPath(ModuleId, "MissionLibrary"));
        }
Esempio n. 7
0
        public void OnGenericTypeTest1()
        {
            var module   = ModuleHelper.LoadModule <EmptyClass>();
            var importer = new CodeImporter(module)
            {
                CompactMode = false
            };

            var type   = importer.Import <SimpleSampleClass>();
            var method = importer.ImportMethod(() => default(SimpleGenericClass <T>) !.Method(default));
        public IEnumerable <Tuple <string, string> > GetExtraResources()
        {
            var publicVirtualPath = ModuleHelper.GetPublicVirtualPath(Constants.ModuleName);

            return(new List <Tuple <string, string> >()
            {
                new Tuple <string, string>("script", publicVirtualPath + "/ClientResources/ViewMode/datetimepicker.modified.js"),
                new Tuple <string, string>("script", publicVirtualPath + "/ClientResources/ViewMode/DateTimeElementBlock.js")
            });
        }
Esempio n. 9
0
    public static Type[] GetModulesWithAllDependencies([NotNull] this IPlugInSource plugInSource, ILogger logger)
    {
        Check.NotNull(plugInSource, nameof(plugInSource));

        return(plugInSource
               .GetModules()
               .SelectMany(type => ModuleHelper.FindAllModuleTypes(type, logger))
               .Distinct()
               .ToArray());
    }
        public void LoadData()
        {
            var resource    = ModuleHelper.GetDataFromDatasourceOrResource(RawToMultiply, ResourceToMultiply, RawToMultiply != null);
            var otherData   = resource.GetFlatData();
            var ourResource = resource.CreateSimilarArray <float>();
            var data        = ourResource.GetFlatData();

            VectorHelper.Multiply(data, 0, otherData, 0, Factor, data.Length);
            Data   = ourResource;
            Loaded = true;
        }
        private static List <ModuleInfo> GetModules(string[] moduleNames)
        {
            List <ModuleInfo> moduleInfoList = new List <ModuleInfo>();

            for (int index = 0; index < moduleNames.Length; ++index)
            {
                ModuleInfo moduleInfo = ModuleHelper.GetModuleInfo(moduleNames[index]);
                moduleInfoList.Add(moduleInfo);
            }
            return(moduleInfoList);
        }
Esempio n. 12
0
        public IEnumerable <Tuple <string, string> > GetExtraResources()
        {
            var currentPageLanguage = FormsExtensions.GetCurrentPageLanguage();
            var publicVirtualPath   = ModuleHelper.GetPublicVirtualPath(Constants.ModuleName);

            return(new List <Tuple <string, string> >()
            {
                new Tuple <string, string>("script", publicVirtualPath + "/ClientResources/ViewMode/RecaptchaElementBlock.js"),
                new Tuple <string, string>("script", string.Format("https://www.google.com/recaptcha/api.js?onload=initRecaptchaElements&render=explicit&hl={0}", currentPageLanguage))
            });
        }
Esempio n. 13
0
        public void ImportMethodTest()
        {
            var module = ModuleHelper.LoadModule <EmptyClass>();

            var target = new CodeImporter(module)
            {
                CompactMode = false
            };

            var importedMethod1 = target.ImportMethod(() => default(MyEventArgs) !.GetValue());
            var importedMethod2 = target.ImportMethod(() => default(MyEventArgs) !.GetValue(default !));
Esempio n. 14
0
        private static Container RegisterPackages(string dbSystem)
        {
            var container = new Container();

            ModuleHelper.GetModuleTypes(typeof(SystemConfig).Assembly)
            .CreateModules()
            .FilterWith(dbSystem)
            .ForEach(x => ((IPackage)x).RegisterServices(container));

            return(container);
        }
 public static void InitializeFromConfigFile(string fileName)
 {
     if (fileName.IsStringNoneOrEmpty())
     {
         return;
     }
     foreach (string readAllLine in File.ReadAllLines(ModuleHelper.GetModuleFullPath("Native") + fileName))
     {
         GameNetwork.HandleConsoleCommand(readAllLine);
     }
 }
Esempio n. 16
0
        public Task <IEnumerable <SidebarMenuViewModel> > Get()
        {
            List <SidebarMenuViewModel> menu = new List <SidebarMenuViewModel>();

            var settings = ModuleHelper.AddModule(ModuleHelper.Module.Setting);

            settings.TreeChild.Add(ModuleHelper.AddModule(ModuleHelper.Module.User));
            settings.TreeChild.Add(ModuleHelper.AddModule(ModuleHelper.Module.Role));

            menu.Add(settings);
            return(Task.FromResult(menu.AsEnumerable()));
        }
Esempio n. 17
0
        public AptekaModule()
        {
            InitializeComponent();
            DevExpress.ExpressApp.Security.SecurityModule.UsedExportedTypes = DevExpress.Persistent.Base.UsedExportedTypes.Custom;
            AdditionalExportedTypes.Add(typeof(DevExpress.Persistent.BaseImpl.EF.Analysis));

            // Register entites from another assembly
            AdditionalExportedTypes.AddRange(
                ModuleHelper.CollectExportedTypesFromAssembly(
                    typeof(Invoice).Assembly,
                    type => type.Namespace.StartsWith("Apteka.Model.Entities")));
        }
Esempio n. 18
0
        public void LoadData()
        {
            float[][] operateOnMe = ModuleHelper.GetDataFromDatasourceOrResource(RawDataSource, ResourceDataSource, RawDataSource != null).GetFlatData();
            var       sum         = 0.0f;

            for (int i = 0; i < operateOnMe.Length; i++)
            {
                sum += VectorHelper.Sum(operateOnMe[i], 0, operateOnMe[i].Length);
            }
            Data   = sum;
            Loaded = true;
        }
Esempio n. 19
0
        static void Main()
        {
            var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;

            var assemblyPath = Path.Combine(baseDirectory, "ShellAssembly.exe");
            var module       = ModuleHelper.LoadModule(assemblyPath);

            var codeImporter = new CodeImporter(module)
            {
                HideImportedTypes = false,
                ModuleResolver    = new AssemblyModuleResolver(
                    typeof(Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialog).Assembly,
                    typeof(Microsoft.WindowsAPICodePack.Dialogs.TaskDialog).Assembly,
                    typeof(Newtonsoft.Json.JsonConvert).Assembly)
            };

            codeImporter.ILMerge();

            var tempPath = TestHelper.TempPath;

            var importedModules = codeImporter.ListImportedModules();

            foreach (var m in importedModules)
            {
                foreach (var resource in m.Resources.OfType <EmbeddedResource>())
                {
                    module.Resources.Add(resource);
                }
            }

            var targetAssemblyPath = Path.Combine(tempPath, "ShellAssembly2.exe");

            module.Assembly.Name.Name = "ShellAssembly2";
            var now = DateTime.Now;

            module.Assembly.Name.Version = new Version(now.Year, now.Month, now.Day, (int)now.TimeOfDay.TotalMilliseconds);
            module.Write(targetAssemblyPath);

            var peVerify = TestHelper.PEVerify.Verify(targetAssemblyPath, line => Console.WriteLine(line));

            Assert.True(peVerify);

            var importedTypes = codeImporter.ListImportedTypes();

            TestHelper.VerifyTypes(importedTypes, importedModules, targetAssemblyPath, AssertIl);

            var il = TestHelper.ILDasm.Decompile(targetAssemblyPath);

            File.WriteAllText(Path.ChangeExtension(targetAssemblyPath, ".il"), il);

            Console.WriteLine("Done - press any key...");
            Console.ReadKey();
        }
Esempio n. 20
0
        /// <summary>
        /// add a new VPP folders to point to this own plugin folders,
        /// so we don't need to modify the EPiServerFramework.config
        /// <remarks>This is protected AddOn, so public end user cannot access its files under /se/EPiServer.Forms.Samples/ClientResources, ... </remarks>
        /// </summary>
        private void AddVppForPublicFolderInsideThisAddOn()
        {
            // TECHNOTE: allow access to protected module's client resources
            // because anonymous user views Forms's Elements in ViewMode, we need to provide them .js file inside the addon (protected) folder
            var publicVpp = new NameValueCollection();

            publicVpp.Add("virtualPath", "~" + ModuleHelper.GetPublicVirtualPath(Constants.ModuleName) + "/ClientResources/ViewMode");
            publicVpp.Add("physicalPath", ModuleHelper.ToPhysicalVPPClientResource(this.GetType(), @"ClientResources\ViewMode"));
            publicVpp.Add("bypassAccessCheck", "true");
            HostingEnvironment.RegisterVirtualPathProvider(new VirtualPathNonUnifiedProvider("PublicEPiServerFormsClientResourcesVpp", publicVpp));
            _logger.Information("Create VPP for EPiServer.Forms.Samples {0} ==> {1}", publicVpp["virtualPath"], publicVpp["physicalPath"]);
        }
Esempio n. 21
0
        /// <summary>
        /// 注册第三方组件
        /// </summary>
        /// <param name="builder">容器构建器</param>
        protected override void ConfigureContainer(ContainerBuilderWrapper builder)
        {
            base.ConfigureContainer(builder);
            var services = new ServiceCollection();

            _application = AbpApplicationFactory.Create <AbpStartupModule>(services, options =>
            {
                var assemblies  = ModuleHelper.GetAssemblies();
                var moduleTypes = ReflectionHelper.FindTypes <IAbpStartupModule>(assemblies.ToArray());
                options.PlugInSources.AddTypes(moduleTypes.ToArray());
            });
            builder.ContainerBuilder.Populate(_application.Services);
        }
Esempio n. 22
0
        public void GetBaseTypesTest()
        {
            var type = ModuleHelper.LoadType <SampleWithConstructors>();

            var expected = new []
            {
                "FodyTools.Tests.TypeExtensionMethodsTests/SampleWithConstructorBase",
                "System.Object"
            };
            var result = type.GetBaseTypes().Select(t => t.FullName);

            Assert.Equal(expected, result);
        }
Esempio n. 23
0
        protected virtual void SetDependencies(List <ModuleDescriptor> modules, ModuleDescriptor module)
        {
            foreach (var dependedModuleType in ModuleHelper.FindDependedModuleTypes(module.Type))
            {
                var dependedModule = modules.FirstOrDefault(m => m.Type == dependedModuleType);
                if (dependedModule == null)
                {
                    throw new Exception("Could not find a depended module " + dependedModuleType.AssemblyQualifiedName + " for " + module.Type.AssemblyQualifiedName);
                }

                module.AddDependency(dependedModule);
            }
        }
Esempio n. 24
0
        /// <summary>
        ///     Finds the specified function in the remote module.
        /// </summary>
        /// <param name="functionName">The name of the function (case sensitive).</param>
        /// <returns>A new instance of a <see cref="RemoteFunction" /> class.</returns>
        /// <remarks>
        ///     Interesting article on how DLL loading works: http://msdn.microsoft.com/en-us/magazine/bb985014.aspx
        /// </remarks>
        public IProcessFunction FindFunction(string functionName)
        {
            // Create the tuple
            var tuple = Tuple.Create(functionName, Process.Handle);

            // Check if the function is already cached
            if (CachedFunctions.ContainsKey(tuple))
            {
                return(CachedFunctions[tuple]);
            }

            // If the function is not cached
            // Check if the local process has this module loaded
            var localModule =
                System.Diagnostics.Process.GetCurrentProcess()
                .Modules.Cast <ProcessModule>()
                .FirstOrDefault(m => m.FileName.ToLower() == Path.ToLower());
            var isManuallyLoaded = false;

            try
            {
                // If this is not the case, load the module inside the local process
                if (localModule == null)
                {
                    isManuallyLoaded = true;
                    localModule      = ModuleHelper.LoadLibrary(Native.FileName);
                }

                // Get the offset of the function
                var offset = localModule.GetProcAddress(functionName).ToInt64() -
                             localModule.BaseAddress.ToInt64();

                // Rebase the function with the remote module
                var function = new RemoteFunction(Process, new IntPtr(Native.BaseAddress.ToInt64() + offset),
                                                  functionName);

                // Store the function in the cache
                CachedFunctions.Add(tuple, function);

                // Return the function rebased with the remote module
                return(function);
            }
            finally
            {
                // Free the module if it was manually loaded
                if (isManuallyLoaded)
                {
                    localModule.FreeLibrary();
                }
            }
        }
Esempio n. 25
0
        public IViewComponentResult Invoke(string filter)
        {
            var sidebars = new List <SidebarMenu> {
                ModuleHelper.AddHeader("NAVEGAÇÃO")
            };

            if (User.Identity.IsAuthenticated)
            {
                sidebars.Add(ModuleHelper.AddModule(ModuleHelper.Module.Jogos, Tuple.Create(0, 0, 0)));
                sidebars.Add(ModuleHelper.AddModule(ModuleHelper.Module.Amigos, Tuple.Create(0, 0, 0)));
                sidebars.Add(ModuleHelper.AddModule(ModuleHelper.Module.Emprestimos, Tuple.Create(0, 0, 0)));
            }
            return(View(sidebars));
        }
 public IEnumerable <Tuple <string, string> > GetExtraResources()
 {
     if (!string.IsNullOrWhiteSpace(Settings.Instance.GoogleMapsApiV3Url))
     {
         var publicVirtualPath   = ModuleHelper.GetPublicVirtualPath(Constants.ModuleName);
         var currentPageLanguage = FormsExtensions.GetCurrentPageLanguage();
         return(new List <Tuple <string, string> >()
         {
             new Tuple <string, string>("script", string.Format(Settings.Instance.GoogleMapsApiV3Url, currentPageLanguage)),
             new Tuple <string, string>("script", publicVirtualPath + "/ClientResources/ViewMode/AddressesElementBlock.js")
         });
     }
     return(new List <Tuple <string, string> >());
 }
Esempio n. 27
0
        public void ComplexTypesTest(int numberOfTypes, params Type[] types)
        {
            var module = ModuleHelper.LoadModule <EmptyClass>();

            var governingType = types.First();

            var target = new CodeImporter(module)
            {
                // else IL comparison will fail:
                HideImportedTypes = false,
                CompactMode       = false
            };

            foreach (var type in types)
            {
                target.Import(type);
            }

            var tempPath = TestHelper.TempPath;

            var targetAssemblyPath = Path.Combine(tempPath, "TargetAssembly2.dll");

            module.Write(targetAssemblyPath);

            var sourceAssemblyPath = Path.Combine(tempPath, "SourceAssembly2.dll");

            var sourceModule = ModuleHelper.LoadModule(new Uri(governingType.Assembly.CodeBase).LocalPath);

            sourceModule.Assembly.Name.Name = "SourceAssembly";
            sourceModule.Write(sourceAssemblyPath);

            var importedTypes = target.ListImportedTypes();

            if (importedTypes.Keys.Select(t => t.FullName).Contains("TomsToolbox.Core.NetStandardExtensions"))
            {
                numberOfTypes += 1;
            }

            foreach (var type in importedTypes)
            {
                _testOutputHelper.WriteLine(type.Key.FullName);
            }


            Assert.Equal(numberOfTypes, importedTypes.Count);

            TestHelper.VerifyTypes(importedTypes, target.ListImportedModules(), targetAssemblyPath);

            Assert.True(TestHelper.PEVerify.Verify(targetAssemblyPath, _testOutputHelper));
        }
Esempio n. 28
0
        public override void Setup(ApplicationModulesManager moduleManager)
        {
            base.Setup(moduleManager);
            AdditionalExportedTypes.AddRange(ModuleHelper.CollectExportedTypesFromAssembly(Assembly.GetAssembly(typeof(Analysis)), IsExportedType));
            AdditionalExportedTypes.AddRange(ModuleHelper.CollectExportedTypesFromAssembly(Assembly.GetAssembly(typeof(SequenceObject)), IsExportedType));
            AdditionalExportedTypes.AddRange(ModuleHelper.CollectExportedTypesFromAssembly(Assembly.GetAssembly(typeof(Customer)), IsExportedType));

            var modelDifferenceBaseModule = (ModelDifferenceModule)moduleManager.Modules.SingleOrDefault(mbase => mbase is ModelDifferenceModule);

            if (modelDifferenceBaseModule != null)
            {
                modelDifferenceBaseModule.CreateCustomModelDifferenceStore += ModelDifferenceBaseModuleOnCreateCustomModelDifferenceStore;
            }
        }
Esempio n. 29
0
        private IEnumerable <Type> GetRegularTypes(IList <ModuleBase> modules)
        {
            List <Type> types = new List <Type>();

            foreach (ModuleBase module in modules)
            {
                IEnumerable <Type> regularTypes = ModuleHelper.GetRegularTypes(module);
                if (regularTypes != null)
                {
                    types.AddRange(regularTypes);
                }
            }
            return(types);
        }
Esempio n. 30
0
        public void LoadData()
        {
            var original = ModuleHelper.GetDataFromDatasourceOrResource(RawOriginalData, OriginalData);
            var oData    = original.GetFlatData();
            var ours     = original.CreateSimilarArray <float>();
            var ourData  = ours.GetFlatData();

            for (int i = 0; i < oData.Length; i++)
            {
                ourData[i] = 1.0f / (1.0f + (float)Math.Exp(Stretch * -(oData[i] + OffsetX)));
            }
            Data   = ours;
            Loaded = true;
        }
Esempio n. 31
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string title = "OA(协同办公)";

        if (Request["pid"] != null)
        {
            pid = Convert.ToString(Request["pid"]);
        }
        switch (pid)
        {
            case "1": title = "CRM(客户关系管理)"; break;
            case "2": title = "WeChat(微信)"; break;
            default: break;
        }

        appPath = WebHelper.GetAppPath();
        if (!IsPostBack) {
            SYS_THEME themeObj = BLLTable<SYS_THEME>.Factory(conn).GetRowData(SYS_THEME.Attribute.THEME_NAME, _ThemeName);
            if (theme != null && themeObj != null && !string.IsNullOrEmpty(themeObj.LOGIN_HTML))
            {
                theme = themeObj.THEME_NAME;
            }
            else
            {
                theme = BasePage._ThemeName;
            }
            if (theme.Equals("PMMS"))//logo图形
            {
                titleOrLogoHtml = "<div id=\"logo\" style=\"background:url({logoUrl}) 0 -10px;\"></div>"
                    .Replace("{logoUrl}", "Themes/" + theme + "/img/main_logo.jpg");
            }
            else
            {
                //titleOrLogoHtml = "<h1 title='企业级基础管理平台" + sqlconstr + "'>{litSiteName}</h1>"
                //    .Replace("{litSiteName}", themeObj.SYS_NAME);
            }
            litName.Text = userBase.RealName == "" ? userBase.UserName : userBase.RealName;
            if (userBase.DeptName != "")
            {
                litName.Text = userBase.DeptName + "--" + litName.Text;
            }
            litNameExd.Text = userBase.UserName;
            ModuleHelper md = new ModuleHelper(conn);
            md.pid = pid;
            //litMenu.Text = md.ShowMemuHtml(userBase);

            if (pid.Equals("1"))
            {
                litMenu.Text += "<span class=\"insertimage sel\"><a href=\"index_crm.aspx\">政务通</a></span>";
                litMenu.Text += "<span class=\"insertimage\"><a href=\"index_wec.aspx\">生意通</a></span>";
            }
            else if (pid.Equals("2"))
            {
                litMenu.Text += "<span class=\"insertimage\"><a href=\"index_crm.aspx\">政务通</a></span>";
                litMenu.Text += "<span class=\"insertimage sel\"><a href=\"index_wec.aspx\">生意通</a></span>";
            }

           // litLeftNav.Text = md.ShowLeftNavHtml(userBase);
            //if (litMenu.Text != "") {
            //    litMenu.Text += "<li style='width:20px;min-width:20px;'></li>";
            //}

            //DEL START 添加权限管理 jin-shenjian 2013/11/26
            //sqlconstr = DoSqlHelper.Factory("conn").ConnectStr.Replace("sa", "*").Replace("chintchint", "*")
            //     .Replace("Password", "*").Replace("Persist Security Info=True;", "");

            ////WF_INFO cond = new WF_INFO();
            //WF_WFOBJECT cond = new WF_WFOBJECT();
            //cond.STATUS = 1;
            ////List<WF_INFO> lst = BLLTable<WF_INFO>.Factory(conn).Select(new WF_INFO(), cond);
            //List<WF_WFOBJECT> lst = BLLTable<WF_WFOBJECT>.Factory(conn).Select(new WF_WFOBJECT(), cond);

            //List<WF_TYPE> lstType = BLLTable<WF_TYPE>.Factory(conn).Select(new WF_TYPE(), new WF_TYPE());
            //for (int i = 0; i < lstType.Count; i++) {
            //    var lll = lst.Where(l => l._TYPE_ID == lstType[i]._TYPE_ID);
            //    litNewWF.Text += "<li><div><a>" + lstType[i].TYPE_NAME + "</a></div><ul>";
            //    LitMyWF.Text += "<li><div><a href='WF/FORMBaseList.aspx?mine=1&TypeID=" + lstType[i].TYPE_ID + "' data=\"{key:'wf_" + lstType[i].TYPE_ID + "'}\">" + lstType[i].TYPE_NAME + "</a></div><ul>";
            //    foreach (WF_WFOBJECT l in lll)
            //    {
            //        litNewWF.Text += "<li><a href='" + appPath + "WF/Edit.aspx?WFID=" + l.WF_OBJ_ID + "' data=\"{key:'wf" + l.WF_OBJ_ID + "new'}\">" + l.WF_OBJ_NAME + "</a></li>";

            //        LitMyWF.Text += "<li><a href='" + appPath + "WF/FORMList.aspx?mine=1&WFID=" + l.WF_OBJ_ID + "' data=\"{key:'wf" + l.WF_OBJ_ID + "mylist'}\">" + l.WF_OBJ_NAME + "管理</a></li>";
            //    }
            //    litNewWF.Text += "</ul></li>";
            //    LitMyWF.Text += "</ul></li>";
            //}
            //    //for (int i = 0; i < lst.Count; i++)
            //    //{
            //    //    //litWFS.Text += "<li><a href='" + WebHelper.GetAppPath() + "WF/FORMList.aspx?WFID=" + lst[i].WFID + "' data=\"{key:'wf" + lst[i].WFID + "list'}\">" + lst[i].WFCNAME + "管理</a></li>";
            //    //    litNewWF.Text += "<li><a href='" + appPath + "WF/Edit.aspx?WFID=" + lst[i].WFID + "' data=\"{key:'wf" + lst[i].WFID + "new'}\">" + lst[i].WFCNAME + "</a></li>";

            //    //    LitMyWF.Text += "<li><a href='" + appPath + "WF/FORMList.aspx?mine=1&WFID=" + lst[i].WFID + "' data=\"{key:'wf" + lst[i].WFID + "mylist'}\">" + lst[i].WFCNAME + "管理</a></li>";
            //    //}
            //litWFSP.Text += "<li><a href='" + appPath + "WF/FormBaseList.aspx?getType=0' data=\"{key:'dsh'}\">待审核</a></li>";
            //litWFSP.Text += "<li><a href='" + appPath + "WF/FormBaseList.aspx?getType=1' data=\"{key:'wtg'}\">我通过</a></li>";
            //litWFSP.Text += "<li><a href='" + appPath + "WF/FormBaseList.aspx?getType=2' data=\"{key:'wfj'}\">我否决</a></li>";
            //litWFSP.Text += "<li><a href='" + appPath + "WF/FormBaseList.aspx?getType=CK' data=\"{key:'wcl'}\">我处理</a></li>";

            //DEL END 添加权限管理 jin-shenjian 2013/11/26
        }
        this.DataBind();
    }
Esempio n. 32
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        #region//��������
        string gotoUrl = "../../OK.aspx?p=0";//&preUrl=
        if (pid != "")
        {
            gotoUrl += "&PID=" + pid;
        }
        int re = 0;
        string msg ="������¼";
        SYS_MODULE valObj = new SYS_MODULE();
        #endregion

        #region//ʵ������ֵ
        valObj.PAGE_URL = txtPageUrl.Value.ToLower();
        if (keyid == "" && !string.IsNullOrEmpty(valObj.PAGE_URL))
        {
            SYS_MODULE hadObj = BLLTable<SYS_MODULE>.Factory(conn).GetRowData(new SYS_MODULE(), valObj);

            if (hadObj != null) {
                litWarn.Text = "ģ�顰"+hadObj.MDL_NAME + "���Ѿ�ʹ�ô����ӵ�ַ�������븽�Ӳ������硰aaa.aspx?p=1����֤һ��ҳ���ַ��ӦΨһ��ģ�顣";
                return;
            }
        }
        valObj.MDL_NAME = txtModuleName.Value;

        valObj.SORT_NO =Convert.ToInt32(txtSortNum.Value);
        valObj.USE_FLAG = selState.Value;

        valObj.NEED_POWER =rblNeedPower.SelectedValue;
        valObj.REAL_PAGES = txtREALPAGES.Value.ToLower();
        //valObj.EN = txtEN.Value;
        #endregion

        #region//ִ���޸Ļ�����
        if (keyid != "")
        {
            valObj.MDL_ID = keyid;
            re = BLLTable<SYS_MODULE>.Factory(conn).Update(valObj, SYS_MODULE.Attribute.MDL_ID);
            if (re > 0)
            {
                if (hidPageUrl.Value != txtPageUrl.Value.ToLower())
                {
                    SYS_MODULE hadCond = new SYS_MODULE();
                    hadCond.PAGE_URL = hidPageUrl.Value;
                    if (!BLLTable<SYS_MODULE>.Exists(hadCond))
                    {
                        SYS_MDLPOWER_DIC dicVal = new SYS_MDLPOWER_DIC();
                        dicVal.PAGE_URL = txtPageUrl.Value.ToLower();

                        SYS_MDLPOWER_DIC dicCond = new SYS_MDLPOWER_DIC();
                        dicCond.PAGE_URL = hidPageUrl.Value;

                        BLLTable<SYS_MDLPOWER_DIC>.Factory(conn).Update(dicVal, dicCond);
                    }
                }
            }
        }
        else
        {

            valObj.P_MDL_ID = pid;

            keyid = new ModuleHelper(conn).GetNewMenuID(pid);
            valObj.MDL_ID = keyid;
            re = BLLTable<SYS_MODULE>.Factory(conn).Insert(valObj);
            if (re > 0 && pid != "")
            {
                SYS_MODULE cond = new SYS_MODULE();
                cond.MDL_ID = pid;
            }
        }
        if (re > 0)
        {
            if (valObj.NEED_POWER == "1")
            {
                //���ij���Ӳ˵���Ҫ����Ȩ�ޣ����������и��˵�Ҳ��Ҫ����Ȩ�ޣ������Ӳ˵��޷����ã����BUG
                string pids = "";//01020304
                for (int i = 0; i < keyid.Length - 2; i += 2)
                {
                    if (pids != "")
                    {
                        pids += ",";
                    }
                    pids += keyid.Substring(0, i + 2);
                }
                if (pids != "")
                {
                    SYS_MODULE condUPParent = new SYS_MODULE();
                    SYS_MODULE valUPParent = new SYS_MODULE();
                    valUPParent.NEED_POWER = "1";
                    condUPParent.In(SYS_MODULE.Attribute.MDL_ID, pids);
                    BLLTable<SYS_MODULE>.Factory(conn).Update(valUPParent, condUPParent);
                }
            }
            else {
                //�����ǰ�˵�����Ҫ����Ȩ�ޣ�������������ֵܽڵ��Ƿ���Ҫ����Ȩ�ޣ����������Ҫ���򽫸��˵�����Ϊ����Ҫ����Ȩ��
                string pmenuid = "";//01020304
                SYS_MODULE condhad;
                for (int i = keyid.Length - 2; i>0; i -= 2)
                {
                    pmenuid = keyid.Substring(0, i);
                    condhad = new SYS_MODULE();

                    condhad.Where("MDL_ID like '" + pmenuid + "%' and MDL_ID<>'" + pmenuid + "' and NEED_POWER=1");
                    if (!BLLTable<SYS_MODULE>.Exists(condhad)) {
                        BLLTable<SYS_MODULE>.Factory(conn).Update(SYS_MODULE.Attribute.MDL_ID, pmenuid, SYS_MODULE.Attribute.NEED_POWER, 0);
                    }
                }
            }
        }
        #endregion

        #region//ִ�н������
        if (re > 0)
        {

            if (Request["tree"] != null)
            {
                StringBuilder sb = new StringBuilder("{");
                sb.Append("rid:'").Append(pid).Append("',id:'");
                sb.Append(keyid).Append("',pid:'").Append(pid).Append("',no:").Append(valObj.SORT_NO).Append(",sc:0,name:'");
                sb.Append(valObj.MDL_NAME).Append("',ntype:'mdl'}");
                if (Request["edit"] == null)
                {
                    AgileFrame.Core.ScriptHelper.ResponseScript(Page, "parent.TV.showSubNodes(\"" + sb.ToString() + "\");", false);
                }
                else
                {
                    AgileFrame.Core.ScriptHelper.ResponseScript(Page, "parent.TV.editNodeInfo(\"" + sb.ToString() + "\");", false);
                }
                //if (Request["toEdit"] == null)
                //{

                //    AgileFrame.Core.ScriptHelper.ResponseScript(Page, "parent.addSubNodeForOprPage(\"" + sb.ToString() + "\");location.href='" + gotoUrl + "';", false);
                //}
                //else
                //{
                //    AgileFrame.Core.ScriptHelper.ResponseScript(Page, "parent.editNodeForOprPage(\"" + sb.ToString() + "\");location.href='" + gotoUrl + "';", false);
                //}
            }
            else
            {
                ScriptHelper.AlertAndGo(Page, msg + "�ɹ���", gotoUrl);
            }
        }
        else
        {
            ScriptHelper.AlertAndGo(Page, msg + "ʧ�ܣ�", gotoUrl);
        }
        #endregion
    }
Esempio n. 33
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["UpPageCols"] != null)
        {
            string[] cols = StringHelperExd.GetStringArray(Request["UpPageCols"], ',');
            string[] names = StringHelperExd.GetStringArray(Microsoft.JScript.GlobalObject.unescape(Request["colnames"]), ',');
            string pageurl = Request["PageUrl"];//hr/manage.aspx?dptid=1

            if (!string.IsNullOrEmpty(pageurl))
            {
                SYS_MODULE mdl = new ModuleHelper(conn).GetModuleByPageUrl(pageurl.ToLower());
                if (mdl != null)
                {
                    pageurl = mdl.PAGE_URL;
                    List<SYS_PAGE_TBFIND_COLS> lst = BLLTable<SYS_PAGE_TBFIND_COLS>.Factory(conn).Select(SYS_PAGE_TBFIND_COLS.Attribute.PAGE_URL, pageurl);
                    Dictionary<string, string> dic = new Dictionary<string, string>();
                    if (lst.Count > 0)
                    {
                        for (int i = 0; i < lst.Count; i++)
                        {
                            if (!dic.ContainsKey(lst[i].COL_NAME))
                            {
                                dic.Add(lst[i].COL_NAME, lst[i].TB_SHOW + "," + lst[i].FIND_SHOW);
                            }
                        }
                    }
                    BLLTable<SYS_PAGE_TBFIND_COLS>.Factory(conn).Delete(SYS_PAGE_TBFIND_COLS.Attribute.PAGE_URL, pageurl);

                    SYS_PAGE_TBFIND_COLS valObj = new SYS_PAGE_TBFIND_COLS();
                    int colNameNullCount = 0;
                    for (int i = 0; i < cols.Length; i++)
                    {
                        valObj.PAGE_URL = pageurl;
                        valObj.FOR_TYPE = 0;//
                        valObj.COL_NAME = cols[i].Replace("[", "").Replace("]", "");
                        valObj.SHOW_NAME = names[i];
                        if (string.IsNullOrEmpty(valObj.COL_NAME.Trim()))
                        {
                            colNameNullCount++;
                            continue;
                        }
                        else if (string.IsNullOrEmpty(valObj.SHOW_NAME.Trim()))
                        {
                            colNameNullCount++;
                            continue;
                        }
                        valObj.TB_SHOW = 1;//
                        valObj.FIND_SHOW = 1;//
                        if (dic.ContainsKey(cols[i]))
                        {
                            string[] aaa = dic[cols[i]].Split(',');
                            valObj.TB_SHOW = decimal.Parse(aaa[0]);//
                            valObj.FIND_SHOW = decimal.Parse(aaa[1]);//
                        }
                        BLLTable<SYS_PAGE_TBFIND_COLS>.Factory(conn).Insert(valObj, SYS_PAGE_TBFIND_COLS.Attribute.P_COLID);
                    }
                    Response.Write("上传成功!" + (colNameNullCount > 0 ? ("发现列名为空字段:" + colNameNullCount + "个!") : ""));
                }
                else {
                    Response.Write("获取不到对应模块!");
                }

            }
            else {
                Response.Write("缺少页面参数值!");
            }

        }
        else
        {
            string btnType = Request["btnType"];
            string dicCode = Request["dicCode"];
            string btnName = Request["btnName"];
            string pageDir = Request["pageDir"].ToLower();//hr/manage.aspx?dptid=1
            SYS_MODULE mdl = new ModuleHelper(conn).GetModuleByPageUrl(pageDir);
            if (mdl != null)
            {
                pageDir = mdl.PAGE_URL;
                SYS_MDLPOWER_DIC valObj = new SYS_MDLPOWER_DIC();
                SYS_MDLPOWER_DIC condDic = new SYS_MDLPOWER_DIC();
                condDic.PAGE_URL = pageDir;
                condDic.DIC_NAME = btnName;
                condDic.DIC_CODE = dicCode;

                valObj.PAGE_URL = pageDir;
                valObj.DIC_NAME = btnName;
                valObj.CTRL_TYPE = btnType;
                valObj.DIC_CODE = dicCode;
                valObj.DEAL_TYPE = EnumInfo.OprCtrlDealType.Disabled.ToString("d");
                int re = 0;
                if (BLLTable<SYS_MDLPOWER_DIC>.Exists(condDic))
                {
                    re = BLLTable<SYS_MDLPOWER_DIC>.Factory(conn).Update(valObj, condDic);
                }
                else
                {
                    re = BLLTable<SYS_MDLPOWER_DIC>.Factory(conn).Insert(valObj, SYS_MDLPOWER_DIC.Attribute.DIC_ID);
                }

                Response.Write(re.ToString());
            }
            else {
                Response.Write("0");
            }
        }
        Response.End();
    }