コード例 #1
0
        public static string CreateRecordUrl(string baseUrl, AppModule appModule, EntityReference entityReference, DynamicUrlParser dynamicUrlParser)
        {
            // Compose the URL with the query string parameters needed to access the Unified Interface apps.
            string queryString = string.Empty;

            if (appModule.ClientType == AppModule.ClientTypes.UNIFIED_INTERFACE)
            {
                queryString = string.Join("&", new string[] {
                    "appid=" + appModule.Id.ToString("D"),
                    "pagetype=entityrecord",
                    "etn=" + entityReference.LogicalName,
                    "id=" + entityReference.Id.ToString("D")
                });
            }
            else if (appModule.ClientType == AppModule.ClientTypes.CLASSIC_INTERFACE)
            {
                queryString = string.Join("&", new string[] {
                    "appid=" + appModule.Id.ToString("D"),
                    "etc=" + dynamicUrlParser.EntityTypeCode,
                    "id=" + entityReference.Id.ToString("D"),
                    "newWindow=true",
                    "pagetype=entityrecord"
                });
            }

            return(baseUrl + "?" + queryString);
        }
コード例 #2
0
        public async Task <JsonResult> Create(AppModule model)
        {
            try
            {
                var userService = new UserService(_userRepository);
                var user        = await userService.Get(User.Identity.Name);

                if (!string.IsNullOrEmpty(user.CurrentOrganisation))
                {
                    var appModuleService = new AppModuleService(_appModuleRepository);
                    model.OrganisationId = user.CurrentOrganisation;
                    await appModuleService.Create(model);

                    var result = new JsonGenericResult
                    {
                        IsSuccess = true
                    };
                    return(Json(result));
                }
                var ErrorResult = new JsonGenericResult
                {
                    IsSuccess = false,
                    Message   = "No current organisation. Please login into one."
                };
                return(Json(ErrorResult));
            }
            catch (Exception ex)
            {
                return(Json(new JsonGenericResult
                {
                    IsSuccess = false,
                    Message = ex.Message
                }));
            }
        }
コード例 #3
0
        public static AppModule GetAppModule(IOrganizationService service, string appName)
        {
            string fetchXml = $@"
                <fetch>
                    <entity name='{AppModule.EntityLogicalName}'>
                        <attribute name='{AppModule.FieldNames.Id}' />
                        <attribute name='{AppModule.FieldNames.ClientType}' />
                        <filter type='or'>
                            <condition attribute='{AppModule.FieldNames.Name}'
                                       operator='{FetchXmlOperators.Like}'
                                       value='{appName}' />
                            <condition attribute='{AppModule.FieldNames.UniqueName}'
                                       operator='{FetchXmlOperators.Like}'
                                       value='{appName}' />
                        </filter>
                    </entity>
                </fetch>".RemoveExtraWhiteSpaceInFetchXml();

            AppModule appModule = (AppModule)service.RetrieveMultiple(new FetchExpression(fetchXml)).Entities.FirstOrDefault();

            if (appModule == default(AppModule))
            {
                throw new InvalidWorkflowException($"No App was found with the name: {appName}.");
            }

            return(appModule);
        }
コード例 #4
0
    /// <summary>
    /// 外部调用显示UI
    /// </summary>
    /// <param name="type"></param>
    /// <param name="data"></param>
    public void Show(ModuleType type, object data = null)
    {
        //如果已经加载过则存入map,再次显示时直接show
        //如果未被加载,则从资源目录加载后,再进行show
        AppModule baseUI = null;

        if (uiObjMap.ContainsKey(type))
        {
            baseUI = uiObjMap[type];
            ShowModule(baseUI, type, data);
        }
        else
        {
            StartLoad(AssetType.Module, type.ToString(), (GameObject uiObj, string uiName) =>
            {
                Type className = uiClassNameMap[type];
                uiObj.AddComponent(className);

                baseUI = uiObj.GetComponent <AppModule>();
                ShowModule(baseUI, type, data);

                uiObjMap.Add(type, baseUI);
            });
        }
    }
コード例 #5
0
ファイル: ClientInfo.cs プロジェクト: jiguixin/MyLibrary
        public ClientInfo(AppModule appModuleData, string dbConnString)
        {
            string[] tmp = dbConnString.Split(CommomConst.SEMI);
            #if DEBUG
            // 给本地测试用的,以后要去掉
            if (tmp[0].Contains("localhost"))
            {
                Dictionary<string, string> setting = FileHelper.ReadConfig();
                tmp[0] = tmp[0].Replace("localhost", setting["LocalHostIP"]);
            }
            #endif
            string subnet = tmp[0].Substring("Data Source=".Length);
            subnet = subnet.Substring(0, subnet.LastIndexOf(CommomConst.DOT));

            string single = null;
            HostName = Environment.MachineName;
            IPAddress[] arr = Dns.GetHostAddresses(HostName);
            foreach (IPAddress ip in arr)
            {
                single = ip.ToString();

                // 要根据链接到默认数据库的地址设置使用的是哪个IP网段(如果此工作站支持VPN,可能有多网卡)
                if (ip.AddressFamily == AddressFamily.InterNetwork && single.Substring(0, single.LastIndexOf(CommomConst.DOT)) == subnet)
                {
                    HostIP = single;
                    break;
                }
            }

            AppModuleData = appModuleData;

            if (string.IsNullOrEmpty(HostIP))
                throw new ApplicationException("Cannot find network card, unable to talk to network.");
        }
コード例 #6
0
    private void OnGetAppModule(object content)
    {
        GameObject go = GameObject.Instantiate((GameObject)content);

        _module = go.AddComponent(_classType) as AppModule;
        _module.SetSiblingIndex(_siblingIndex);
        _module.Show(_showData);
    }
コード例 #7
0
 public void Destroy()
 {
     if (_module != null)
     {
         _module.Destroy();
     }
     _module = null;
     ResourceManager.Release(_path, OnGetAppModule);
 }
コード例 #8
0
        static void Main(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();
            ILog log = LogManager.GetLogger(typeof(Program));

            try
            {
                log.Info(LogFormat.Message("", "Application_start", LogStatus.Success, ""));

                MultiLanguageManager.SetDefaultLabelsDictionary <DSW.Localisation.Labels.Dictionary>();
                MultiLanguageManager.SetDefaultMessageDictionary <DSW.Localisation.Messages.Dictionary>();

                if (SingleInstanceApplication.IsExist())
                {
                    FormUtility.EnableTaskBar(false);
                    FormUtility.EnableTaskBar(true);

                    MessageUtility.DisplayErrorMsg(MultiLanguageManager.Messages.GetString(DSW.Localisation.Messages.Dictionary.Common.HT_COM_MS029),
                                                   MultiLanguageManager.Messages.GetString(DSW.Localisation.Messages.Dictionary.Common.HT_COM_CAP001));

                    log.Info(LogFormat.Message("", "Application_end", LogStatus.Failed, DSW.Localisation.Messages.Dictionary.Common.HT_COM_MS029));

                    Application.Exit();

                    return;
                }

                FormUtility.EnableTaskBar(false);

                AppDataService.SetSettingApiAddress(Setting.ApiAddress);

                var appModule       = new AppModule();
                var mvvmApplication = new MvvmApplication(appModule);

                mvvmApplication.Run <StocktakeNewView>();

                FormUtility.EnableTaskBar(true);

                log.Info(LogFormat.Message("", "Application_end", LogStatus.Success, ""));

                LogManager.Shutdown();
            }
            catch (Exception ex)
            {
                log.Info(LogFormat.Message("", "Application_end", LogStatus.Failed, ex.Message + Environment.NewLine + ex.StackTrace));

                LogManager.Shutdown();

                FormUtility.EnableTaskBar(false);
                FormUtility.EnableTaskBar(true);

                MessageUtility.DisplayErrorMsg(ex.Message,
                                               MultiLanguageManager.Messages.GetString(DSW.Localisation.Messages.Dictionary.Common.HT_COM_CAP001));

                Application.Exit();
            }
        }
コード例 #9
0
        public static void Init(bool allowDelayedLoad)
        {
            //nextsession = LoadNextSession();

            AppModule.Run(allowDelayedLoad, delegate(object state) {
                LoadPopularMonitors();
                LoadPopularBills();                 // after LoadPopularMonitors
            });
        }
コード例 #10
0
 public ElectronService(DialogModule dialogModule, MainWindowModule mainWindowModule, ClipboardModule clipBoardModule, AppModule appModule,
                        ShellModule shellModule, MenuModule menuModule)
 {
     Menu       = menuModule;
     Dialog     = dialogModule;
     ClipBoard  = clipBoardModule;
     MainWindow = mainWindowModule;
     App        = appModule;
     Shell      = shellModule;
 }
コード例 #11
0
        public IContainerBuilder RegisterModule(IModule module = null)
        {
            if (module == null)
            {
                module = new AppModule();
            }

            module.Load(this._services);

            return(this);
        }
コード例 #12
0
ファイル: HomeController.cs プロジェクト: riyuexing/Mock.luo
        /// <summary>
        /// 当前登录用户的菜单权限
        /// </summary>
        /// <returns>List树形递归数据</returns>
        private List <TreeNode> GetMenuList()
        {
            OperatorProvider op = OperatorProvider.Provider;
            //权限为空时,根据当前登录的用户Id,获取权限模块数据

            var userModuleEntities = _appModuleService.GetUserModules(op.CurrentUser.UserId);

            List <AppModule> userMenuEntities = userModuleEntities.Where(u => u.TypeCode != ModuleCode.Button.ToString() && u.TypeCode != ModuleCode.Permission.ToString()).ToList();

            List <TreeNode> treeNodes = AppModule.ConvertTreeNodes(userMenuEntities);

            return(treeNodes);
        }
コード例 #13
0
        public static string GenerateUrlForApp(IOrganizationService service, string recordUrl, string appName)
        {
            // Get base URL of the instance.
            string baseUrl = recordUrl.Split('?')[0];

            // Get the entity reference from the Dynamic Record URL passed to the CodeActivity.
            DynamicUrlParser dynamicUrlParser = new DynamicUrlParser(recordUrl);
            EntityReference  entityReference  = dynamicUrlParser.GetEntityReference(service);

            // Query for AppModule record.
            AppModule appModule = GetAppModule(service, appName);

            // Create URL.
            return(CreateRecordUrl(baseUrl, appModule, entityReference, dynamicUrlParser));
        }
コード例 #14
0
        public static void FacadeExample()
        {
            blankLine();
            Split("Facade");

            RAMModule      ram  = new RAMModule();
            AppModule      app  = new AppModule();
            RegistryModule regx = new RegistryModule();

            Facade cleaner = new Facade(ram, app, regx);

            User user = new User();

            user.StartCleaning(cleaner);
        }
コード例 #15
0
ファイル: Global.asax.cs プロジェクト: CoolikV/CourseWork
        protected void Application_Start()
        {
            AutoMapperConfig.InitializeConfig();
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // внедрение зависимостей
            NinjectModule modules       = new AppModule();
            NinjectModule serviceModule = new ServiceModule("NewNameForAgencyDatabase");

            var kernel = new StandardKernel(modules, serviceModule);

            DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel));
        }
コード例 #16
0
    /// <summary>
    /// 隐藏ui
    /// </summary>
    /// <param name="type"></param>
    public void Hide(ModuleType type)
    {
        AppModule baseUI = null;

        if (uiObjMap.ContainsKey(type))
        {
            baseUI = uiObjMap[type];
        }
        else
        {
            Debug.Log("找不到ui类型:" + type);
        }

        if (baseUI != null)
        {
            baseUI.OnHide();
        }
    }
コード例 #17
0
ファイル: CompositeApp.cs プロジェクト: qube7/qcomposite
        /// <summary>
        /// Raises the <see cref="Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            VerifyAccess();

            if (modules == null)
            {
                modules = new List <ModuleContext>(4);

                if (modulesUri != null && LoadComponent(modulesUri) is ModuleIterator iterator)
                {
                    modules.AddRange(iterator.OfType <ModuleContext>());
                }

                AppModule.Run(this);
            }

            base.OnStartup(e);
        }
コード例 #18
0
        static void Main(string[] args)
        {
            AppModule  AppModule = new AppModule();
            IContainer Container = AppModule.BuildContainer();

            using (ILifetimeScope scope = Container.BeginLifetimeScope())
            {
                IBookService bookService = scope.Resolve <IBookService>();
                bookService.ReadBooks();
            }

            using (ILifetimeScope scope = Container.BeginLifetimeScope())
            {
                IPersonService personService = scope.Resolve <IPersonService>();
                personService.PrintList();
            }

            Console.WriteLine("TaskUtil Test ---");
            var tasks = new List <Task <int> >();

            TaskUtils  taskUtils  = new TaskUtils(Container);
            Task <int> CalcTask   = taskUtils.GetCalcAsync();
            Task <int> PersonTask = taskUtils.GetPersonAsync();

            tasks.Add(CalcTask);
            tasks.Add(PersonTask);

            Task.WaitAll(tasks.ToArray());
            Console.WriteLine($"GetCalcAsync result={CalcTask.Result}");
            Console.WriteLine($"GetPersonAsync result={PersonTask.Result}");

            SongUtils songUtils = new SongUtils();

            songUtils.GetSongs();


            Container.Dispose();
        }
コード例 #19
0
ファイル: CompositeApp.cs プロジェクト: qube7/qcomposite
            /// <summary>
            /// Starts the specified composite application.
            /// </summary>
            /// <param name="app">The application to start.</param>
            internal static void Run(CompositeApp app)
            {
                List <Task <Module> > tasks = new List <Task <Module> >();

                foreach (ModuleContext context in app.modules)
                {
                    tasks.Add(Task.Run(() => context.Module));
                }

                AppModule module = new AppModule(app);

                module.Initialize();

                XContainer.Activate(module);

                while (tasks.Count > 0)
                {
                    int index = Task.WaitAny(tasks.ToArray());

                    XContainer.Activate(tasks[index].Result);

                    tasks.RemoveAt(index);
                }
            }
コード例 #20
0
ファイル: FolderPlugInSource.cs プロジェクト: lgjy143/App
        public List <Type> GetModules()
        {
            var modules = new List <Type>();

            foreach (var assembly in GetAssemblies())
            {
                try
                {
                    foreach (var type in assembly.GetTypes())
                    {
                        if (AppModule.IsAppModule(type))
                        {
                            modules.AddIfNotContains(type);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw new AppInitializationException("Could not get module types from assembly: " + assembly.FullName, ex);
                }
            }

            return(modules);
        }
コード例 #21
0
        /// <summary>
        /// APP个人中心填充数据
        /// </summary>
        /// <param name="set"></param>
        /// <returns></returns>
        public List <AppModule> FillPerModule(DataTable table)
        {
            string           web_url = BaseConfiguration.SercerIp;
            List <AppModule> apps    = new List <AppModule>();

            foreach (DataRow item in table.Rows)
            {
                AppModule app = new AppModule()
                {
                    ModuleName   = item["title"].ToString(),
                    SerialNumber = item["xh"].ToString(),
                    Point        = int.Parse(item["point"].ToString()),
                    Amount       = decimal.Parse(item["amount"].ToString()),
                    Type         = item["ImgType"].ToString().Trim()
                };
                if (item["img_url"].ToString() != "")
                {
                    app.ImgPath = web_url + item["img_url"].ToString();
                }
                else
                {
                    app.ImgPath = "";
                }
                if (item["link_url"].ToString() != "")
                {
                    app.SkipLink = item["link_url"].ToString();
                }
                else
                {
                    app.SkipLink = "";
                }
                apps.Add(app);
            }

            return(apps);
        }
コード例 #22
0
 public override string ToString()
 {
     return($"{AppModule.GetType().Name} : {ScannableAttributeAndTypeInfos.Count()}");
 }
コード例 #23
0
        protected AppModule GetObject(DataRow dr)
        {
            AppModule objAppModule = new AppModule();
            objAppModule.Id = (dr["Id"] == DBNull.Value) ? 0 : (Int32)dr["Id"];
            objAppModule.Module = (dr["Module"] == DBNull.Value) ? "" : (String)dr["Module"];
            objAppModule.CompanyId = (dr["CompanyId"] == DBNull.Value) ? 0 : (Int32)dr["CompanyId"];
            objAppModule.AdminId = (dr["AdminId"] == DBNull.Value) ? 0 : (Int32)dr["AdminId"];

            return objAppModule;
        }
コード例 #24
0
		void registerNumber(AppModule module, ref int next, int current) {
			if (current >= next) {
				next = current + 1;
				write(module);
			}
		}
コード例 #25
0
ファイル: AppBuilder.cs プロジェクト: savasda/Onion.NetCore
 public static void Register(IApplicationBuilder app)
 {
     AppModule.Register(app);
 }
コード例 #26
0
ファイル: Program.cs プロジェクト: ppetrov/Cchbc
        public static void Main(string[] args)
        {
            var freshDbPath = @"C:\Users\PetarPetrov\Desktop\data.sqlite";
            var clientDbPath = @"C:\Users\PetarPetrov\Desktop\features.sqlite";
            var serverDbPath = @"C:\Users\PetarPetrov\Desktop\server.sqlite";

            try
            {
                //var addViewModel = new AddActivityViewModel(new ActivityCreator(), new ConsoleDialog());
                //using (var dbContext = new TransactionContextCreator(string.Empty).Create())
                //{
                //	var modelData = new AddActivityViewModelData(dbContext);
                //	modelData.Load();

                //	addViewModel.Load(modelData);

                //	dbContext.Complete();
                //}

                var context = new AppContext((msg, level) =>
                {
                    Console.WriteLine(level + @":" + msg);
                },
                () => new DbContext(GetSqliteConnectionString(freshDbPath)),
                new ConsoleDialog());

                var module = new AppModule(context);
                module.Init();
                module.Load();

                return;

                if (!File.Exists(serverDbPath))
                {
                    CreateSchema(GetSqliteConnectionString(serverDbPath));
                }
                foreach (var date in new[]
                {
                    DateTime.Today.AddDays(-10),
                    DateTime.Today.AddDays(-9),
                    DateTime.Today.AddDays(-8),
                    DateTime.Today.AddDays(-7),
                    DateTime.Today.AddDays(-6),
                    DateTime.Today.AddDays(-5),
                    DateTime.Today.AddDays(-4),
                    DateTime.Today.AddDays(-3),
                    DateTime.Today.AddDays(-2),
                    DateTime.Today.AddDays(-1),
                    DateTime.Today,
                })
                {
                    ClientDataReplication.SimulateDay(serverDbPath, date);
                }

                var fm = new FeatureManager();

                fm.Load(null);

                return;

                //GenerateData(clientDbPath);
                //return;

                //WeatherTest();
                //return;

                if (!File.Exists(serverDbPath))
                {
                    CreateSchema(GetSqliteConnectionString(serverDbPath));
                }

                var w = Stopwatch.StartNew();
                GenerateData(clientDbPath);

                Console.WriteLine(@"Load client data");
                var s = Stopwatch.StartNew();

                ClientData clientData;
                using (var client = new TransactionContextCreator(GetSqliteConnectionString(clientDbPath)).Create())
                {
                    clientData = FeatureAdapter.GetData(client);
                    clientData.FeatureEntryRows.Clear();
                    client.Complete();
                }

                File.Delete(clientDbPath);

                s.Stop();
                Console.WriteLine(s.ElapsedMilliseconds);

                ServerData serverData;
                using (var client = new TransactionContextCreator(GetSqliteConnectionString(serverDbPath)).Create())
                {
                    serverData = FeatureServerManager.GetServerData(client);
                    client.Complete();
                }

                while (true)
                {
                    s.Restart();
                    Replicate(GetSqliteConnectionString(serverDbPath), clientData, serverData);
                    s.Stop();
                    Console.WriteLine(s.ElapsedMilliseconds);
                    //Console.ReadLine();
                }

                w.Stop();
                Console.WriteLine(w.ElapsedMilliseconds);
                return;

                var viewModel = new ExceptionsViewModel(
                    new TransactionContextCreator(GetSqliteConnectionString(serverDbPath)).Create,
                    ExceptionsSettings.Default);

                for (var i = 0; i < 100; i++)
                {
                    viewModel.Load(
                    ExceptionsDataProvider.GetTimePeriods,
                    ExceptionsDataProvider.GetVersions,
                    ExceptionsDataProvider.GetExceptions,
                    ExceptionsDataProvider.GetExceptionsCounts);
                }

                w.Stop();
                Console.WriteLine(w.ElapsedMilliseconds);

                Console.WriteLine(@"Time Periods");
                foreach (var v in viewModel.TimePeriods)
                {
                    Console.WriteLine('\t' + string.Empty + v.Name);
                }
                Console.WriteLine();

                Console.WriteLine(@"Versions");
                foreach (var v in viewModel.Versions)
                {
                    Console.WriteLine('\t' + string.Empty + v.Name);
                }
                Console.WriteLine();

                Console.WriteLine(@"Exceptions");
                foreach (var vm in viewModel.LatestExceptions)
                {
                    Console.WriteLine('\t' + string.Empty + new string(vm.Message.Take(40).ToArray()) + $@"... ({vm.CreatedAt.ToString(@"T")}) " + vm.User.Name + $@"({vm.Version.Name})");
                }
                Console.WriteLine();

                return;
                //SearchSourceCode();
                //return;
                //DisplayHistogram();
                //return;

                //GenerateDayReport(serverDbPath);

                //
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            return;

            var c = @"Data Source = C:\Users\PetarPetrov\Desktop\ifsa.sqlite; Version = 3;";

            ClientData data;
            using (var client = new TransactionContextCreator(c).Create())
            {
                data = FeatureAdapter.GetData(client);
                client.Complete();
            }

            data.FeatureEntryRows.Add(new DbFeatureEntryRow(@"#", DateTime.Today.AddDays(-1), -4));

            //var s = Stopwatch.StartNew();
            //var result = ClientDataPacker.Pack(data);

            //s.Stop();
            //Console.WriteLine(s.ElapsedMilliseconds);

            //s.Restart();
            //var back = ClientDataPacker.Unpack(result);
            //s.Stop();
            //Console.WriteLine(s.ElapsedMilliseconds);
            //Console.WriteLine(back);

            //Console.WriteLine();
            //Console.WriteLine();
            //Console.WriteLine();

            //Console.WriteLine(result.Length);

            return;

            //GenerateProject(PhoenixModel(), @"C:\temp\IfsaBuilder\IfsaBuilder\Phoenix");

            //GenerateProject(WordpressModel(), @"C:\temp\IfsaBuilder\IfsaBuilder\Wordpress");

            //var prj = new ClrProject();
            //prj.Save(@"C:\temp\IfsaBuilder\IfsaBuilder\", project);

            //var AppContext = new AppContext();
            //AppContext.DbContextCreator = new TransactionContextCreator(string.Empty);
            //AppContext.ModalDialog = new ConsoleDialog();
            //var viewModel = new LoginsViewModel(AppContext, new LoginAdapter());
            //try
            //{
            //	viewModel.InsertAsync(new Login(1, @"PPetrov", @"Password", DateTime.Now, false)).Wait();

            //	Console.WriteLine(@"Done");
            //}
            //catch (Exception ex)
            //{
            //	Console.WriteLine(ex);
            //}

            //return;

            //// Register helpers
            //var cache = AppContext.DataCache;
            //cache.Add(new BrandHelper());
            //cache.Add(new FlavorHelper());
            //cache.Add(new ArticleHelper());

            //try
            //{
            //	File.WriteAllText(@"C:\temp\diagnostics.txt", string.Empty);

            //	//var viewModel = new LoginsViewModel(AppContext, new LoginAdapter());
            //	//viewModel.LoadData();

            //	//var v = new LoginViewModel(new Login(1, @"PPetrov", @"QWE234!", DateTime.Now, true));
            //	//var dialog = new ConsoleDialog();
            //	//viewModel.AddAsync(v, dialog).Wait();
            //	//viewModel.AddAsync(v, dialog).Wait();
            //	//viewModel.ChangePasswordAsync(v, dialog, @"sc1f1r3hack").Wait();
            //	//viewModel.AddAsync(v, dialog).Wait();
            //	//viewModel.ChangePasswordAsync(v, dialog, @"sc1f1r3hackV2").Wait();

            //	//foreach (var login in viewModel.Logins)
            //	//{
            //	//	Console.WriteLine(login.Name + " " + v.Password);
            //	//}
            //}
            //catch (Exception e)
            //{
            //	Console.WriteLine(e);
            //}
        }
コード例 #27
0
 /// <summary>
 /// 读取数据绑定权限
 /// </summary>
 /// <param name="appmodule">模块实体</param>
 private void BindPrivilegeDescFormModel(AppModule appmodule)
 {
     if (appmodule == null ||appmodule.PrivilegeDesc==null|| appmodule.PrivilegeDesc == 0) return ;
     var items = chklPrivilegeDesc.Items;
     chklPrivilegeDesc.ClearSelection();
     if (items == null || items.Count == 0) return ;
     for (var i = 0; i < items.Count; i++)
     {
         var item = items[i];
         var value = Convert.ToString(Convert.ToInt32(item.Value) & appmodule.PrivilegeDesc);
         if (value == item.Value)
         {
             item.Selected = true;
         }
     }
 }
コード例 #28
0
		void write(AppModule module) {
			module.Database.Update(this);
		}
コード例 #29
0
 /// <summary>
 /// Import a whole Qif file to the database as new accounts, transactions, etc.
 /// </summary>
 public void Import(TextReader r, AppModule module)
 {
     lock (this) {
         _transactionsOnly = false;
         _reader = r;
         _module = module;
         Line = 0;
         Character = 0;
         _accountsProcessed = new List<int>();
         _transactions = new List<Transaction>();
         if (!getLine()) return;
         while (!_eof) {
             switch (_line) {
                 case "!Type:Cash":
                 case "!Type:Bank":
                     importTransactions(DocType.Cheque, DocType.Deposit);
                     break;
                 case "!Type:CCard":
                     importTransactions(DocType.CreditCardCharge, DocType.CreditCardCredit);
                     break;
                 case "!Type:Invst":
                     importInvestments();
                     break;
                 case "!Type:Oth A":
                 case "!Type:Oth L":
                 case "!Account":
                     importAccount();
                     break;
                 case "!Type:Cat":
                     importCategories();
                     break;
                 case "!Type:Security":
                     importSecurity();
                     break;
                 case "!Type:Prices":
                     importPrices();
                     break;
                 case "!Type:Class":
                 case "!Type:Memorized":
                 case "!Type:Invoice":
                     // We are not interested in these
                     // TODO: Process invoices
                     skip();
                     break;
                 default:
                     if (_line.StartsWith("!Option:") || _line.StartsWith("!Clear:"))
                         getLine();
                     else
                         throw new CheckException("Unexpected input:{0}", _line);
                     break;
             }
         }
         postTransactions();
     }
 }
コード例 #30
0
		public void RegisterNumber(AppModule module, int? docType, int current) {
			switch (docType) {
				case (int)DocType.Invoice:
				case (int)DocType.CreditMemo:
					registerNumber(module, ref NextInvoiceNumber, current);
					break;
				case (int)DocType.Bill:
				case (int)DocType.Credit:
					registerNumber(module, ref NextBillNumber, current);
					break;
				case (int)DocType.GeneralJournal:
					registerNumber(module, ref NextJournalNumber, current);
					break;
			}
		}
コード例 #31
0
 private void ShowModule(AppModule baseUI, ModuleType type, object data = null)
 {
     baseUI.type = type;
     baseUI.transform.SetAsLastSibling(); //新生成的ui放在最后
     baseUI.OnShow(data);
 }
コード例 #32
0
        /// <summary>
        /// 获取App信息桌面权限
        /// </summary>
        private string GetAppPermissions(DataRow row)
        {
            using (var conn = new SqlConnection(PubConstant.hmWyglConnectionString))
            {
                var commId    = 0;
                var organCode = "";

                if (row.Table.Columns.Contains("CommID"))
                {
                    commId = AppGlobal.StrToInt(row["CommID"].ToString());
                }

                if (row.Table.Columns.Contains("OrganCode"))
                {
                    organCode = row["OrganCode"].ToString();
                    if (string.IsNullOrEmpty(organCode))
                    {
                        organCode = "01";
                    }
                }

                //信息桌面
                var _1 = new AppModule <AppWebModule>()
                {
                    Name = "信息桌面", Code = "9999", Submodules = new List <AppWebModule>()
                };

                // 桌面模块
                var sql = @"SELECT Code,FunName AS Name FROM Tb_Sys_Function 
                        WHERE isnull(IsDelete,0)=0 AND Code<>'9999' AND Code LIKE '99__' ORDER BY Code;";
                var _2  = conn.Query <AppModule <AppSubmodule> >(sql).ToList();

                // 桌面子模块
                sql = @"SELECT Code,FunName AS Name,isnull(Memo,'') AS Memo 
                        FROM Tb_Sys_Function WHERE isnull(IsDelete,0)=0 AND isnull(Memo,'')<>'App操作权限' 
                        AND Code IN
                        (
                            SELECT FunCode FROM Tb_Sys_FunctionPope WHERE FunCode LIKE '99____' 
                                AND RoleCode IN(SELECT RoleCode FROM Tb_Sys_Role 
                                    WHERE RoleCode IN(SELECT RoleCode FROM Tb_Sys_UserRole WHERE UserCode=@UserCode))
                            UNION
                            SELECT FunCode FROM Tb_Sys_FunctionPope WHERE FunCode LIKE '99____' 
                                AND RoleCode IN(SELECT SysRoleCode FROM Tb_Sys_Role 
                                        WHERE RoleCode IN(SELECT RoleCode FROM Tb_Sys_UserRole WHERE UserCode=@UserCode))
                        ) ORDER BY Code;";
                var _3 = conn.Query <AppSubmodule>(sql, new { UserCode = Global_Var.LoginUserCode }).ToList();

                // 总部、片区、区域、公司级:只显示决策支撑信息桌面
                // 项目级:没有权限时,默认显示项目员工信息桌面

                if (commId == 0)
                {
                    _1.Submodules.Add(new AppWebModule()
                    {
                        Code = "999908", Name = "决策支撑信息桌面"
                    });
                }
                else
                {
                    var tmp = _3.FindAll(obj => obj.Code.StartsWith("9999"))
                              .Select(obj => { return(new AppWebModule()
                        {
                            Code = obj.Code, Name = obj.Name
                        }); });

                    _1.Submodules.AddRange(tmp);

                    if (_1.Submodules.Count() == 0)
                    {
                        _1.Submodules.Add(new AppWebModule()
                        {
                            Code = "999901", Name = "项目员工信息桌面"
                        });
                    }
                }

                _1.Submodules.ForEach(obj =>
                {
                    obj.Url = $"frame/PolyPropertyAPP/H5KanBan_{obj.Code.Last()}.aspx";
                });

                foreach (var module in _2)
                {
                    module.Submodules = new List <AppSubmodule>();

                    var tmp = _3.FindAll(obj => obj.Code.StartsWith(module.Code));
                    if (tmp.Count != 0)
                    {
                        module.Submodules.AddRange(tmp);

                        foreach (var item in tmp)
                        {
                            _3.Remove(item);
                        }
                    }
                }

                _2.RemoveAll(m => m.Submodules == null || m.Submodules.Count == 0);

                return(new ApiResult(true, new
                {
                    AppDesktops = _1.Submodules,
                    AppModules = _2,
                    ERPMessage = new
                    {
                        Notifies = GetERPNotifies(Global_Var.LoginUserCode, organCode, commId, conn),
                        UnreadMessageCount = GetERPUnreadMessageCount(Global_Var.LoginUserCode, conn)
                    }
                }).toJson());
            }
        }
コード例 #33
0
ファイル: Role_Privilege.cs プロジェクト: alejsherion/gggets
     private void FixupAppModule(AppModule previousValue, bool skipKeys = false)
     {
         if (IsDeserializing)
         {
             return;
         }
 
         if (previousValue != null && previousValue.Role_Privilege.Contains(this))
         {
             previousValue.Role_Privilege.Remove(this);
         }
 
         if (AppModule != null)
         {
             if (!AppModule.Role_Privilege.Contains(this))
             {
                 AppModule.Role_Privilege.Add(this);
             }
 
             ModuleID = AppModule.ModuleID;
         }
         else if (!skipKeys)
         {
             ModuleID = null;
         }
 
         if (ChangeTracker.ChangeTrackingEnabled)
         {
             if (ChangeTracker.OriginalValues.ContainsKey("AppModule")
                 && (ChangeTracker.OriginalValues["AppModule"] == AppModule))
             {
                 ChangeTracker.OriginalValues.Remove("AppModule");
             }
             else
             {
                 ChangeTracker.RecordOriginalValue("AppModule", previousValue);
             }
             if (AppModule != null && !AppModule.ChangeTracker.ChangeTrackingEnabled)
             {
                 AppModule.StartTracking();
             }
         }
     }
コード例 #34
0
        public async Task <AppModule> Create(AppModule appMoodule)
        {
            await _appModuleRepository.CreateSync(appMoodule);

            return(appMoodule);
        }
コード例 #35
0
        /// <summary>
        /// App模块数据填充
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        public Information FillList(DataSet set)
        {
            Information     information = new Information();
            string          web_url     = BaseConfiguration.SercerIp;
            List <Carousel> carousels   = new List <Carousel>();

            foreach (DataRow item in set.Tables[0].Rows)
            {
                Carousel carousel = new Carousel()
                {
                    CarouselName    = item["title"].ToString(),
                    SerialNumber    = item["xh"].ToString(),
                    ArticleID       = item["ArticleID"].ToString(),
                    AndroidLinkType = int.Parse(item["androidlinktype"].ToString())
                };
                if (item["img_url"].ToString() != "")
                {
                    carousel.ImgPath = web_url + item["img_url"].ToString();
                }
                else
                {
                    carousel.ImgPath = "";
                }
                if (item["link_url"].ToString() != "")
                {
                    carousel.SkipLink = item["link_url"].ToString();
                }
                else
                {
                    carousel.SkipLink = "";
                }
                if (item["androidlinkurl"].ToString() != "")
                {
                    carousel.AndroidLinkUrl = item["androidlinkurl"].ToString();
                }
                else
                {
                    carousel.AndroidLinkUrl = "";
                }
                carousels.Add(carousel);
            }
            information.Carousel = carousels;
            List <AppModule> apps = new List <AppModule>();

            foreach (DataRow item in set.Tables[1].Rows)
            {
                AppModule app = new AppModule()
                {
                    ModuleName   = item["title"].ToString(),
                    SerialNumber = item["xh"].ToString(),
                    SkipLink     = item["link_url"].ToString()
                };
                if (item["img_url"].ToString() != "")
                {
                    app.ImgPath = web_url + item["img_url"].ToString();
                }
                else
                {
                    app.ImgPath = "";
                }
                apps.Add(app);
            }
            information.AppModul = apps;
            return(information);
        }
コード例 #36
0
ファイル: Settings.cs プロジェクト: nikkilocke/AccountServer
 public ImportBatchJob(AppModule module, FileProcessor file, Action action)
     : base(module, action)
 {
     _file = file;
 }
コード例 #37
0
 /// <summary>
 /// 修改模块
 /// </summary>
 /// <param name="module"></param>
 public void Modify(AppModule module)
 {
     _appModuleRepository.Modify(module);
 }
コード例 #38
0
ファイル: WebServer.cs プロジェクト: nikkilocke/AccountServer
 /// <summary>
 /// Process a single request
 /// </summary>
 /// <param name="listenerContext"></param>
 void ProcessRequest(object listenerContext)
 {
     DateTime started = DateTime.Now;			// For timing response
     HttpListenerContext context = null;
     AppModule module = null;
     StringBuilder log = new StringBuilder();	// Session log writes to here, and it is displayed at the end
     try {
         context = (HttpListenerContext)listenerContext;
         log.AppendFormat("{0} {1}:{2}:[ms]:",
             context.Request.RemoteEndPoint.Address,
             context.Request.Headers["X-Forwarded-For"],
             context.Request.RawUrl);
         Session session = null;
         string filename = HttpUtility.UrlDecode(context.Request.Url.AbsolutePath).Substring(1);
         if (filename == "") filename = "company";			// Default page is Company
         string moduleName = null;
         string methodName = null;
         string baseName = filename.Replace(".html", "");	// Ignore .html - treat as a program request
         if (baseName.IndexOf(".") < 0) {
             // Urls of the form /ModuleName[/MethodName][.html] call a C# AppModule
             string[] parts = baseName.Split('/');
             if (parts.Length <= 2) {
                 Type type = AppModule.GetModule(parts[0]);
                 if (type != null) {
                     // The AppModule exists - create the object
                     module = (AppModule)Activator.CreateInstance(type);
                     moduleName = parts[0];
                     if (parts.Length == 2) methodName = parts[1];
                 }
             }
         }
         if (moduleName == null) {
             // No AppModule found - treat url as a file request
             moduleName = "FileSender";
             module = new FileSender(filename);
             session = new Session(null);
         } else {
             // AppModule found - retrieve or create a session for it
             Cookie cookie = context.Request.Cookies["session"];
             if (cookie != null) {
                 _sessions.TryGetValue(cookie.Value, out session);
                 if (AppSettings.Default.SessionLogging)
                     log.AppendFormat("[{0}{1}]", cookie.Value, session == null ? " not found" : "");
             }
             if (session == null) {
                 session = new Session(this);
                 cookie = new Cookie("session", session.Cookie, "/");
                 if (AppSettings.Default.SessionLogging)
                     log.AppendFormat("[{0} new session]", cookie.Value);
             }
             context.Response.Cookies.Add(cookie);
             cookie.Expires = session.Expires = Utils.Now.AddHours(1);
         }
         // Set up module
         module.Session = session;
         module.LogString = log;
         if (moduleName.EndsWith("Module"))
             moduleName = moduleName.Substring(0, moduleName.Length - 6);
         using (module) {
             // Call method
             module.Call(context, moduleName, methodName);
         }
     } catch (Exception ex) {
         while (ex is TargetInvocationException)
             ex = ex.InnerException;
         if (ex is System.Net.Sockets.SocketException) {
             log.AppendFormat("Request error: {0}\r\n", ex.Message);
         } else {
             log.AppendFormat("Request error: {0}\r\n", ex);
             if (module == null || !module.ResponseSent) {
                 try {
                     module = new AppModule();
                     module.Session = _empty;
                     module.LogString = log;
                     module.Context = context;
                     module.Module = "exception";
                     module.Method = "default";
                     module.Title = "Exception";
                     module.Exception = ex;
                     module.WriteResponse(module.Template("exception", module), "text/html", HttpStatusCode.InternalServerError);
                 } catch (Exception ex1) {
                     log.AppendFormat("Error displaying exception: {0}\r\n", ex1);
                     if (module == null || !module.ResponseSent) {
                         try {
                             module.WriteResponse("Error displaying exception:" + ex.Message, "text/plain", HttpStatusCode.InternalServerError);
                         } catch {
                         }
                     }
                 }
             }
         }
     }
     if (context != null) {
         try {
                 context.Response.Close();
         } catch {
         }
     }
     try {
         Log(log.ToString().Replace(":[ms]:", ":" + Math.Round((DateTime.Now - started).TotalMilliseconds, 0) + " ms:"));
     } catch {
     }
 }
コード例 #39
0
 /// <summary>
 /// 添加模块
 /// </summary>
 /// <param name="appModule"></param>
 public void Add(AppModule appModule)
 {
     _appModuleRepository.Add(appModule);
     _appModuleRepository.UnitOfWork.Commit();
 }
コード例 #40
0
        /// <summary>
        /// 修改或者保存权限
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            var appmodule = new AppModule();
            try
            {
                var opStatus = Convert.ToString(ViewState["OpStatus"]);
                if (opStatus == "Add")
                {
                    appmodule.ModuleID = Guid.NewGuid();
                    GetDataFormPage(appmodule);
                    appmodule.CreateTime = DateTime.Now;
                    _appModuleManagementService.Add(appmodule);
                }
                else
                {
                    appmodule.ModuleID = (Guid) ViewState["Id"];
                    GetDataFormPage(appmodule);
                    _appModuleManagementService.Modify(appmodule);
                }
                Cache.Remove("RoleArry");
                Page.ClientScript.RegisterStartupScript(GetType(), ""
                                                     , "alert('添加成功!')", true);

            }
            catch
            {
                Page.ClientScript.RegisterStartupScript(GetType(), ""
                                                     , "alert('添加失败!')", true);
            }
            
        }
コード例 #41
0
        ///// <summary>
        ///// 绑定角色
        ///// </summary>
        //private void BindRoleId()
        //{
        //    var dataSouce = _roleManagementService.GetAllRole();
        //    if (dataSouce!=null)
        //    Cache["RoleArry"] = dataSouce;
        //    chkRoleID.DataSource = dataSouce;
        //    chkRoleID.DataTextField = "Name";
        //    chkRoleID.DataValueField = "RoleID";
        //    chkRoleID.DataBind();
        //}

        /// <summary>
        /// 获取页面数据
        /// </summary>
        private void GetDataFormPage(AppModule appmodule)
        {
            if (appmodule == null) appmodule = new AppModule();
            var result = Validation();
            if (!result) return; 
            appmodule.Description = txtDescription.Text;
            appmodule.Remark = txtRemark.Text;
            var pageType = rbtnIsLeft.SelectedValue;
            if (pageType == "1")
            {
                appmodule.IsLeft = true;
                appmodule.ParentId = new Guid(dropParentId.SelectedValue);
                appmodule.URL = txtURL.Text;
                var privileges = GetPrivileges();
                appmodule.PrivilegeDesc = DataConversion.GetCurrentPrivilege(privileges);
                //GetRoles(appmodule);
            } 
        }
コード例 #42
0
ファイル: Importer.cs プロジェクト: nikkilocke/AccountServer
 /// <summary>
 /// Set up import, import the data, commit to the database if no errors
 /// </summary>
 public void Import(CsvParser csv, AppModule module)
 {
     lock (this) {
         _module = module;
         _keys = new HashSet<string>();
         ImportData(csv);
         _module.Database.Commit();
     }
 }
コード例 #43
0
 /// <summary>
 /// Import a bank statement, and return it (no posting is made to the database)
 /// </summary>
 public JArray ImportTransactions(TextReader r, AppModule module)
 {
     lock (this) {
         JArray result = new JArray();
         _transactionsOnly = true;
         _reader = r;
         _module = module;
         Line = 0;
         Character = 0;
         _accountsProcessed = new List<int>();
         _transactions = new List<Transaction>();
         if (!getLine()) return result;
         while (!_eof) {
             switch (_line) {
                 case "!Type:Cash":
                 case "!Type:Bank":
                     importTransactions(DocType.Cheque, DocType.Deposit);
                     break;
                 case "!Type:CCard":
                     importTransactions(DocType.CreditCardCharge, DocType.CreditCardCredit);
                     break;
                 default:
                     skip();
                     break;
             }
         }
         // Now copy wanted data to the output
         foreach (Transaction t in _transactions) {
             JObject j = new JObject();
             j["Name"] = string.IsNullOrEmpty(t.Name) ? t.DocumentMemo : t.Name;
             j["Amount"] = t.Amount;
             j["Date"] = t.DocumentDate;
             if (!string.IsNullOrEmpty(t.DocumentIdentifier)) j["Id"] = t.DocumentIdentifier;
             j["Memo"] = t.DocumentMemo;
             result.Add(j);
         }
         return result;
     }
 }