Example #1
0
        protected string GetAppActionIconUrl(Guid appID, int actionType)
        {
            FeedTemplate template = FeedBO.Instance.GetFeedTemplate(appID, actionType);

            if (template != null)
            {
                return(template.IconUrl);
            }

            AppBase app = AppManager.GetApp(appID);

            if (app == null)
            {
                return(string.Empty);
            }

            AppAction appAction = app.AppActions.GetValue(actionType);

            if (appAction == null)
            {
                return(string.Empty);
            }

            return(appAction.IconUrl);
        }
Example #2
0
        internal void SendMessage(MessageBottle n)
        {
            switch (VarAttrs["block-type"])
            {
            case "Antenna":

                MyTransmitTarget m;
                if (n.MetaData == null)
                {
                    AppBase.Debug("wow");
                }
                switch (n.MetaData.VarAttrs["method"])
                {
                case "Public": m = MyTransmitTarget.Everyone; break;

                case "Private": m = MyTransmitTarget.Ally; break;

                case "Protected": m = MyTransmitTarget.Ally; break;

                default: m = MyTransmitTarget.Default; break;
                }

                AppBase.Debug("Sending: " + n.ToString());
                ((IMyRadioAntenna)Block).TransmitMessage(n.ToString(), m);

                break;

            case "LaserAntenna":
                AppBase.Debug("Sending: " + n.ToString());
                ((IMyLaserAntenna)Block).TransmitMessage(n.ToString());
                break;
            }
        }
Example #3
0
 public override void Begin()
 {
     //On Me.CustomData
     //<component-ui name='ui-tp' key='1234' />
     SetAttribute("name", AppBase.GetAttribute("name"));
     base.Begin();
 }
Example #4
0
        public void ShouldGetStringReturnEmpty()
        {
            AppBase pb  = new AppBase();
            string  str = pb.GetString(0);

            str.Should().Be(string.Empty);
        }
Example #5
0
        protected AppActionCollection GetAppActionList(AppBase app)
        {
            AppActionCollection appActions = new AppActionCollection();

            foreach (AppAction appAction in app.AppActions)
            {
                if (FeedBO.Instance.IsSiteFeed(app.AppID, appAction.ActionType))
                {
                    continue;
                }

                bool display = true;
                foreach (FeedSendItem tempItem in AllSettings.Current.PrivacySettings.FeedSendItems)
                {
                    if ((tempItem.DefaultSendType == FeedSendItem.SendType.ForceSend || tempItem.DefaultSendType == FeedSendItem.SendType.ForceNotSend) &&
                        tempItem.AppID == app.AppID && tempItem.ActionType == appAction.ActionType)
                    {
                        display = false;
                        break;
                    }
                }

                if (display)
                {
                    appActions.Add(appAction);
                }
            }

            return(appActions);
        }
Example #6
0
 public JsonResult Login(string LoginName, string Password)
 {
     Studio.Dto.ResultDto <string> result = new Studio.Dto.ResultDto <string>();
     using (AdminsService admin = new AdminsService())
     {
         var model = admin.Reposity.GetAllList().Where(o => o.LoginName == LoginName).FirstOrDefault();
         if (model != null)
         {
             if (model.Password == Password)
             {
                 result.code    = 100;
                 result.message = "success";
                 AppBase.SetCookie("AdminId", model.Id.ToString(), 1);
             }
             else
             {
                 result.code    = 101;
                 result.message = "Password error";
             }
         }
         else
         {
             result.code    = 102;
             result.message = "Not exist";
         }
     }
     return(Json(result));
 }
Example #7
0
        //统计负荷特性
        void btnSummary_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            zButton btn = sender as zButton;

            if (btn.isChecked)
            {
                if (app != null && !(app is Interact.IParaSetSummary))
                {
                    app.end();                           //不为空,不为本身,执行结束操作
                }
                if (!(app is Interact.IParaSetSummary))  //不为本身,执行创建
                {
                    app = new Interact.IParaSetSummary(root);
                    app.begin();
                }
                else
                {
                    (app as Interact.IParaSetSummary).show();
                }
            }
            else
            if (app is Interact.IParaSetSummary)
            {
                (app as Interact.IParaSetSummary).hide();
            }
        }
Example #8
0
        // Connect to database
        // return true if connection ok
        // return false if connection failed
        public bool connect()
        {
            // create connection string
            string cmdConnect;

            cmdConnect = "Database=" + dbname + ";" +
                         "Data Source=" + host + ";" +
                         "User Id=" + username + ";" +
                         "Password="******"Připojení k databázi OK");
                this.connected = true;
            }
            catch (MySqlException ex)
            {
                AppBase.addOutput("Připojení k databázi selhalo:");
                this.connected = false;
                AppBase.addOutput(ex.Message);
            }

            return(true);
        }
Example #9
0
        //区块负荷预测
        void btnLoadForcast_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            zButton btn = sender as zButton;

            if (btn.isChecked)
            {
                if (app != null && !(app is Planning.PRunLoadForcast))
                {
                    app.end();                           //不为空,不为本身,执行结束操作
                }
                if (!(app is Planning.PRunLoadForcast))  //不为本身,执行创建
                {
                    app = new Planning.PRunLoadForcast(root);
                    app.begin();
                }
            }
            else
            {
                if (app != null && (app is Planning.PRunLoadForcast))
                {
                    app.end();
                    app = null;
                }
            }
        }
Example #10
0
        protected AppActionCollection GetFiltratedAppActionList(Guid appID)
        {
            AppActionCollection appActions = new AppActionCollection();
            AppBase             app        = AppManager.GetApp(appID);

            foreach (FeedFilter feedFilter in UserFeedFilters)
            {
                if (feedFilter.AppID == appID)
                {
                    if (feedFilter.FilterType == FilterType.FilterApp)
                    {
                        appActions = app.AppActions;
                        break;
                    }
                    else if (feedFilter.FilterType == FilterType.FilterAppAction)
                    {
                        AppAction appAction = app.AppActions.GetValue(feedFilter.ActionType.Value);
                        if (appAction != null)
                        {
                            appActions.Add(appAction);
                        }
                    }
                }
            }

            return(appActions);
        }
Example #11
0
        public ClassRegisters()
        {
            //register region --
            //AppBase.Register(c => new QX_Frame.Bantina.Service.RabbitMQ_Service_DG());
            AppBase.Register(c => new BloodTypeNameService());
            AppBase.Register(c => new BookService());
            AppBase.Register(c => new CategoryService());
            AppBase.Register(c => new ChineseZodiacNameService());
            AppBase.Register(c => new CommentReplyService());
            AppBase.Register(c => new ConstellationNameService());
            AppBase.Register(c => new DisplayCodeService());
            AppBase.Register(c => new LimitCodeService());
            AppBase.Register(c => new SexNameService());
            AppBase.Register(c => new UserAccountService());
            AppBase.Register(c => new UserAuthenCodesService());
            AppBase.Register(c => new UserInfoService());
            AppBase.Register(c => new UserRoleStatusService());
            AppBase.Register(c => new UserRoleStatusService());
            AppBase.Register(c => new CmsStatusNameService());
            AppBase.Register(c => new CmsStatusService());



            //end register region --
            AppBase.RegisterComplex();
        }
Example #12
0
 public static void RegisterApp(AppBase app)
 {
     lock (addAppLocker)
     {
         if(apps.GetValue(app.AppID)==null)  
             apps.Add(app);
     }
 }
Example #13
0
        public static void Initialize(TestContext testContext)
        {
            List <Type> allTypes = AppBase.GetAlltypes().ToList();

            AppBase.DependencyInjectionManager = new UnityDependencyInjectionManager(allTypes);

            Core.Cmn.AppBase.LogService = new Core.Service.LogService(BuildNewContext());
            //Core.Cmn.AppBase.BuildEntityInfoDic(Core.Cmn.AppBase.GetAlltypes());
        }
Example #14
0
        public JsonResult GetQRCode(string strCode)
        {
            AppBase apps       = new AppBase();
            var     bitmap     = apps.CreateQRCode(strCode);
            string  guid       = Guid.NewGuid().ToString().Replace("-", "") + ".png";
            string  qrCodePath = this.Server.MapPath("~/") + "/UploadResource/" + guid;

            bitmap.Save(qrCodePath, System.Drawing.Imaging.ImageFormat.Png);
            return(Json("/UploadResource/" + guid));
        }
Example #15
0
 public static void RegisterApp(AppBase app)
 {
     lock (addAppLocker)
     {
         if (apps.GetValue(app.AppID) == null)
         {
             apps.Add(app);
         }
     }
 }
Example #16
0
        /// <summary>
        /// 表单数据加载
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public Hashtable LoadForm(Guid?Id)
        {
            var _Sys_Function = db.FindById <Sys_Function>(Id);

            var _Form = AppBase.ObjectToHashtable(new
            {
                Id
            }, _Sys_Function);

            return(_Form);
        }
Example #17
0
        public void AppActionList(AppBase app, AppActionsTemplate template)
        {
            AppActionCollection appActions = app.AppActions;

            int j = 0;

            foreach (AppAction appAction in appActions)
            {
                template(j++, appAction);
            }
        }
Example #18
0
        public ClassRegisters()
        {
            //register region --
            AppBase.Register(c => new QX_Frame.Bantina.Service.RabbitMQ_Service_DG());
            AppBase.Register(c => new ClassNameService());
            AppBase.Register(c => new PeopleService());
            AppBase.Register(c => new ScoreService());


            //end register region --
            AppBase.RegisterComplex();
        }
Example #19
0
 public JsonResult SwitchTenant(int tenantId)
 {
     using (TenantsService tenantS = new TenantsService())
     {
         var tenant = tenantS.Reposity.Get(tenantId);
         if (tenant != null)
         {
             AppBase.SetCookie("TenantId", tenantId.ToString(), 1);
         }
         return(Json(tenant));
     }
 }
Example #20
0
        /// <summary>
        /// 表单数据加载
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public Dictionary <string, object> LoadForm(Guid?Id)
        {
            var _MemberM   = db.FindById <Member>(Id);
            var _Sys_UserM = db.FindById <Sys_User>(_MemberM.Member_UserID);

            var _Dictionary = AppBase.ObjectToDictionary(new
            {
                Id,
                User_Name = _Sys_UserM.User_Name
            }, _MemberM);

            return(_Dictionary);
        }
Example #21
0
        /// <summary>
        /// 表单数据加载
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public Dictionary <string, object> LoadForm(Guid?Id)
        {
            var _Sys_AppLog = db.FindById <Sys_AppLog>(Id);
            var _Sys_User   = db.FindById <Sys_User>(_Sys_AppLog.AppLog_UserID);

            var _Dictionary = AppBase.ObjectToDictionary(new
            {
                Id,
                UserName = _Sys_User.User_Name
            }, _Sys_AppLog);

            return(_Dictionary);
        }
Example #22
0
        public string GetActionNameByType(AppBase app, int actionType)
        {
            AppAction appAction = app.AppActions.GetValue(actionType);

            if (appAction != null)
            {
                return(appAction.ActionName);
            }
            else
            {
                return(string.Empty);
            }
        }
Example #23
0
 public override void Tick()
 {
     Block = AppBase.GetGemeObject <IMyTerminalBlock>(VarAttrs["name"]);
     if (Block != null)
     {
         OnWorking();
         base.Tick();
     }
     else
     {
         End();
     }
 }
Example #24
0
    public static async Task Run(AppBase app, CancellationToken cancellationToken = default)
    {
        var rnd = new Random(10);

        for (var i = 0;; i++)
        {
            var productId = app.ExistingProducts[rnd.Next(app.ExistingProducts.Length)].Id;
            var product   = await app.ClientProductService.Get(productId);

            var price   = rnd.Next(10);
            var command = new EditCommand <Product>(product !with {
                Price = price
            });
Example #25
0
 public override void Begin()
 {
     Block = AppBase.GetGemeObject <IMyTerminalBlock>(GetAttribute("name"));
     if (Block != null)
     {
         strXML    = Block.CustomData;
         textPanel = Block as IMyTextPanel;
         OnStart();
     }
     else
     {
         End();
     }
 }
Example #26
0
        public JsonResult InsertOrUpdate(Members input)
        {
            ResultDto <int> result = new ResultDto <int>();

            try
            {
                using (MembersService Member = new MembersService())
                {
                    if (input.Id == 0)
                    {
                        input.CreationTime = DateTime.Now;
                    }
                    else
                    {
                        input.UpdateTime = DateTime.Now;
                    }
                    MembersService ObjRead = new MembersService();
                    var            obj     = ObjRead.Reposity.GetAllList(o => o.UserID == input.UserID && o.Id != input.Id && o.UserID != "00" && o.UserID != "").FirstOrDefault();
                    if (obj != null)
                    {
                        result.code    = 500;
                        result.message = "身份证号已存在";
                    }
                    else
                    {
                        input.TenantId = TenantId;

                        BirthdayAgeSex user = AppBase.GetBirthdayAgeSex(input.UserID);
                        if (user != null)
                        {
                            input.Age      = user.Age;
                            input.Birthday = user.Birthday;
                            input.Sex      = user.Sex;
                        }

                        Member.Reposity.InsertOrUpdate(input);
                        result.code    = 100;
                        result.datas   = input.Id;
                        result.message = "ok";
                    }
                    ObjRead.Dispose();
                }
            }
            catch (Exception ex)
            {
                result.code    = 500;
                result.message = ex.Message;
            }
            return(Json(result));
        }
Example #27
0
        public static AppBaseCollection GetApps(IEnumerable <Guid> appIDs)
        {
            AppBaseCollection tempApps = new AppBaseCollection();

            foreach (Guid appID in appIDs)
            {
                AppBase app = GetApp(appID);
                if (app != null)
                {
                    tempApps.Add(app);
                }
            }
            return(tempApps);
        }
Example #28
0
 internal static AppBase CreateInstance()
 {
     if (_Singleton == null)
     {
         lock (_Lock)
         {
             if (_Singleton == null)
             {
                 _Singleton = new AppBase();
             }
         }
     }
     return(_Singleton);
 }
        public static void Init(AppBase app)
        {
            var types = ReflectionHelper.GetAllPublicClasses();

            var iAppAutoInit = typeof(IAppAutoInit);

            var needInit = types.Where(t =>
                                       iAppAutoInit.IsAssignableFrom(t) && !t.IsInterface
                                       ).ToArray();

            foreach (var type in needInit)
            {
                var initMethod = ReflectionHelper.GetPublicStaticMethod(type, "Init");
                initMethod.Invoke(null, new object[] { app });
            }
        }
Example #30
0
        //指标鱼骨图
        void btnIndexFish_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            zButton btn = sender as zButton;

            if (btn.isChecked)
            {
                if (app != null && !(app is Planning.PEvaluteIndexFish))
                {
                    app.end();                             //不为空,不为本身,执行结束操作
                }
                if (!(app is Planning.PEvaluteIndexFish))  //不为本身,执行创建
                {
                    app = new Planning.PEvaluteIndexFish(root);
                    app.begin();
                }
            }
        }
Example #31
0
        //可靠性
        void btnReliability_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            zButton btn = sender as zButton;

            if (btn.isChecked)
            {
                if (app != null && !(app is Planning.PAnalyseReliability))
                {
                    app.end();                               //不为空,不为本身,执行结束操作
                }
                if (!(app is Planning.PAnalyseReliability))  //不为本身,执行创建
                {
                    app = new Planning.PAnalyseReliability(root);
                    app.begin();
                }
            }
        }
        //
        // This method is invoked when the application has loaded and is ready to run. In this 
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Forms.Init();

            _window = new UIWindow(UIScreen.MainScreen.Bounds);

            var navigation = new Navigation.Navigation();

            AppBase = CreateApp();

            LoadApplication(AppBase);

            AppBase.InitializeContainer(builder =>
            {
                builder.RegisterType<LocalServerDiscovery>().As<ILocalServerDiscovery>().SingleInstance();
                builder.RegisterType<Contacts.Contacts>().As<IContacts>().SingleInstance();
                builder.RegisterType<ImageHelper>().As<IImageHelper>().SingleInstance();
                builder.RegisterType<KeyboardHelper>().As<IKeyboardHelper>().SingleInstance();
                builder.RegisterType<SocialMediaConnections>().As<ISocialMediaConnections>().SingleInstance();
                builder.RegisterType<InAppPurchase>().As<IInAppPurchase>().SingleInstance();
                builder.RegisterType<Share>().As<IShare>().SingleInstance();
                builder.RegisterInstance(new UriHelper(app)).As<IUriHelper>().SingleInstance();
                builder.RegisterInstance(navigation).As<INavigation>().SingleInstance();

                OnInitializeContainer(builder);
            });

            _applicationEvents = AppBase.ComponentContext.Resolve<IApplicationEvents>();

            _window.RootViewController = AppBase.GetMainPage().CreateViewController();
            navigation.RootViewController = _window.RootViewController;

            _window.MakeKeyAndVisible();

            return true;
        }
Example #33
0
        public void AppActionList(
              AppBase app
            , GlobalTemplateMembers.CannotDoTemplate cannotDo
            , GlobalTemplateMembers.NodataTemplate nodata
            , AppActionListHeadFootTemplate head
            , AppActionListHeadFootTemplate foot
            , AppActionListItemTemplate item)
        {
            AppActionCollection appActions = app.AppActions;

            head();

            int j = 0;

            foreach (AppAction appAction in appActions)
            {
                if (FeedBO.Instance.IsSiteFeed(app.AppID, appAction.ActionType))
                    continue;

                bool display = true;
                foreach (FeedSendItem tempItem in AllSettings.Current.PrivacySettings.FeedSendItems)
                {
                    if ((tempItem.DefaultSendType == FeedSendItem.SendType.ForceSend || tempItem.DefaultSendType == FeedSendItem.SendType.ForceNotSend)
                        && tempItem.AppID == app.AppID && tempItem.ActionType == appAction.ActionType)
                        display = false;

                }

                if (display)
                    item(j++, appAction);
            }

            if (appActions.Count == 0)
                nodata();

            foot();

        }
Example #34
0
 public string GetActionNameByType(AppBase app, int actionType)
 {
     AppAction appAction = app.AppActions.GetValue(actionType);
     if (appAction != null)
         return appAction.ActionName;
     else
         return string.Empty;
 }
Example #35
0
        public void AppActionList(AppBase app, AppActionsTemplate template)
        {
            AppActionCollection appActions = app.AppActions;

            int j = 0;

            foreach (AppAction appAction in appActions)
            {
                template(j++, appAction);
            }
        }
Example #36
0
        protected AppActionCollection GetAppActionList(AppBase app)
        {
            AppActionCollection appActions = new AppActionCollection();

            foreach (AppAction appAction in app.AppActions)
            {
                if (FeedBO.Instance.IsSiteFeed(app.AppID, appAction.ActionType))
                    continue;

                bool display = true;
                foreach (FeedSendItem tempItem in AllSettings.Current.PrivacySettings.FeedSendItems)
                {
                    if ((tempItem.DefaultSendType == FeedSendItem.SendType.ForceSend || tempItem.DefaultSendType == FeedSendItem.SendType.ForceNotSend)
                        && tempItem.AppID == app.AppID && tempItem.ActionType == appAction.ActionType)
                    {
                        display = false;
                        break;
                    }
                }

                if (display)
                    appActions.Add(appAction);
            }

            return appActions;
        }