Inheritance: MonoBehaviour
        public string CouponVlidateForPKID(int rulePkId, int oid)
        {
            JObject json     = new JObject();
            var     rules    = ActivityManager.GetPCodeModelByRulePKID(rulePkId);
            var     products = QueryProduct(oid);
            var     result   = CalculateUseCouponEffect(products, rules);

            if (result != null)
            {
                json.Add("RuleID", result.CouponPkId.ToString());
                json.Add("Name", "");
                json.Add("Description", result.CouponDescription.ToString());
                json.Add("Minmoney", result.Minmoney.ToString());
                json.Add("Discount", result.Discount.ToString());
                json.Add("CouponStartTime", result.StartTime.ToString());
                json.Add("CouponEndTime", result.EndTime.ToString());
                json.Add("CouponDuration", result.CouponDuration.ToString());
                json.Add("GrossProfit", result.GrossProfit.ToString());
                json.Add("PriceAfterCoupon", result.PriceAfterCoupon.ToString());
                json.Add("Quantity", "");
                json.Add("SupportUserRange", "");
                json.Add("Status", result.Status);
            }
            else
            {
                json.Add("RuleID", "");
                json.Add("Name", "");
                json.Add("Description", "");
                json.Add("Minmoney", "");
                json.Add("Discount", "");
                json.Add("CouponStartTime", "");
                json.Add("CouponEndTime", "");
                json.Add("CouponDuration", "");
                json.Add("Quantity", "");
                json.Add("GrossProfit", "");
                json.Add("PriceAfterCoupon", "");
                json.Add("SupportUserRange", "");
                json.Add("Status", "");
            }
            return(json.ToString());
        }
        public bool IsServiceRunning(Type cls)
        {
            try
            {
                ActivityManager manager = (ActivityManager)Android.App.Application.Context.GetSystemService(Context.ActivityService);

                foreach (var service in manager.GetRunningServices(int.MaxValue))
                {
                    if (service.Service.ClassName.Equals(Java.Lang.Class.FromType(cls).CanonicalName))
                    {
                        return(true);
                    }
                }
            }
            catch (Exception Ex)
            {
                Console.WriteLine(Ex.Message + Ex.StackTrace);
            }

            return(false);
        }
Ejemplo n.º 3
0
        public bool IsAppInForeground()
        {
            Context         context         = Application.Context;
            ActivityManager activityManager = (ActivityManager)context.GetSystemService(Context.ActivityService);
            IList <Android.App.ActivityManager.RunningAppProcessInfo> appProcesses = activityManager.RunningAppProcesses;

            if (appProcesses == null)
            {
                return(false);
            }
            string packageName = context.PackageName;

            foreach (Android.App.ActivityManager.RunningAppProcessInfo appProcess in appProcesses)
            {
                if (appProcess.Importance == Importance.Foreground && appProcess.ProcessName == packageName && appProcesses.IndexOf(appProcess) == 0)
                {
                    return(true);
                }
            }
            return(false);
        }
        public bool IsInForeground()
        {
            Context         context         = Context;
            ActivityManager activityManager = (ActivityManager)context.GetSystemService(Context.ActivityService);
            IList <ActivityManager.RunningAppProcessInfo> appProcesses = activityManager.RunningAppProcesses;

            if (appProcesses == null)
            {
                return(false);
            }
            string packageName = context.PackageName;

            foreach (ActivityManager.RunningAppProcessInfo appProcess in appProcesses)
            {
                if (appProcess.Importance == Importance.Background && appProcess.ProcessName == packageName)
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 5
0
        public ActionResult Create(Activity activity)
        {
            this.allowedRoles.Add(this.ROLE_MANAGER);
            RedirectToRouteResult redirectToHome = this.RouteAccessAllowedRoles();

            if (redirectToHome != null)
            {
                return(redirectToHome);
            }

            if (activity.Name != null && HttpContext.Request.HttpMethod == "POST")
            {
                ActivityManager am = new ActivityManager();
                activity.EventId = this.EVENT_ID;
                am.InsertActivity(activity);
                return(RedirectToAction("Index"));
            }
            activity = new Activity();

            return(View(activity));
        }
Ejemplo n.º 6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtUpdate.Visible == false)
            {
                Actiivity F = new Actiivity()
                {
                    AName    = txtActivityTitle.Text,
                    ATime    = dtpStartTime.Value,
                    ATimeEnd = dtpOverTime.Value,
                };
                int n = InsertTextActivity(F);
                if (n > 0)
                {
                    dgvTextAInfo.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                    dgvTextAInfo.DataSource = ActivityManager.SelectFestivalActivityAll();

                    MessageBox.Show("添加成功");
                    lbl.Visible       = false;
                    txtUpdate.Visible = false;
                    btnSave.Visible   = false;
                }
            }
            if (txtUpdate.Visible == true)
            {
                string   name  = txtUpdate.Text;
                string   name2 = txtActivityTitle.Text;
                DateTime time  = dtpStartTime.Value;
                DateTime time2 = dtpOverTime.Value;
                int      n     = ActivityManager.UpdateActivity(name, time, time2, name2);
                if (n > 0)
                {
                    dgvTextAInfo.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                    dgvTextAInfo.DataSource = ActivityManager.SelectFestivalActivityAll();
                    MessageBox.Show("修改成功!");
                    lbl.Visible       = false;
                    txtUpdate.Visible = false;
                    btnSave.Visible   = false;
                }
            }
        }
Ejemplo n.º 7
0
        public async Task Init()
        {
            await AppProfileManager.Instance.LoadProfile();

            await Business.Dashboard.Configuration.ResourceManager.Instance.Load();

            PowerPointManager.Init();

            MasterWizardManager.Instance.Load();
            SettingsManager.Instance.LoadSharedSettings();
            SlideManager.LoadSlides(ResourceManager.Instance.SlideMastersFolder);

            HelpManager.LoadHelpLinks();

            TextResourcesManager.Load();
            ImageResourcesManager.Load();

            FormStyleManager = new FormStyleManager(Business.Dashboard.Configuration.ResourceManager.Instance.FormStyleConfigFile);

            ActivityManager = ActivityManager.OpenStorage();
            ActivityManager.AddActivity(new UserActivity("Application started"));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 管理员注册
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <OperationResult <bool> > ManagerRegisterAsync(T_ActivityManagerUserInfo_xhrModel request)
        {
            if (string.IsNullOrWhiteSpace(request.Name))
            {
                return(OperationResult.FromError <bool>("-31", string.Format(Resource.ParameterError_IsRequired, "账号")));
            }
            if (string.IsNullOrWhiteSpace(request.PassWords))
            {
                return(OperationResult.FromError <bool>("-31", string.Format(Resource.ParameterError_IsRequired, "密码")));
            }
            string passWordsSalt = ActivityManager.GetPassWordsSalt(request);

            if (!string.IsNullOrWhiteSpace(passWordsSalt))
            {
                return(OperationResult.FromError <bool>("-31", "用户名已存在"));
            }
            request.PassWordsSalt = Guid.NewGuid().ToString();
            request.PassWords     = HashSecurityHelper.Sha1Encrypt(request.PassWords + request.PassWordsSalt);
            //if(request.PassWords.Length>0)
            //return OperationResult.FromError<bool>("-31", "密码"+ request.PassWords+"密码盐"+ request.PassWordsSalt);
            return(OperationResult.FromResult <bool>(await ActivityManager.ManagerRegisterAsync(request)));
        }
        /*public void DoBindService()
         * {
         *  Intent serviceToStart = new Intent(this, typeof(GPS_Service_Android));
         *  BindService(serviceToStart, serviceConnection, Bind.AutoCreate);
         * }
         *
         * public void DoUnBindService()
         * {
         *  UnbindService(serviceConnection);
         * }
         */
        private bool IsmMyServiceRunning()
        {
            ActivityManager am = (ActivityManager)GetSystemService(ActivityService);

            try
            {
                foreach (ActivityManager.RunningServiceInfo service in am.GetRunningServices(int.MaxValue))
                {
                    Console.WriteLine(service.Service.ClassName);
                    if ("app1.droid.Servis".Equals(service.Service.ClassName))
                    {
                        Console.WriteLine("found it\n\n\n");
                        return(true);
                    }
                }
                return(false);
            }catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.StackTrace);
                return(false);
            }
        }
Ejemplo n.º 10
0
        private ActionResult SendDocumentToAgreement(Guid docId, Guid[] executorIds, string documentType, string taskType = null)
        {
            taskType = string.IsNullOrEmpty(taskType) ? null : taskType;
            var db = new ncelsEntities();
            var activityManager = new ActivityManager();

            switch (documentType)
            {
            case Dictionary.ExpAgreedDocType.DirectionToPay:
                var coc = db.EXP_DirectionToPays.FirstOrDefault(e => e.Id == docId);
                if (coc != null)
                {
                    activityManager.SendToExecution(Dictionary.ExpActivityType.DirectionToPayAgrement, docId,
                                                    Dictionary.ExpAgreedDocType.DirectionToPay, taskType ?? Dictionary.ExpTaskType.Agreement,
                                                    string.Empty, coc.CreateDate, executorIds);
                    //var primaryDocStatus = repository.GetPrimaryFinalDocumentStatus(docId);
                }
                return(Json(DictionaryHelper.GetDicItemByCode(CodeConstManager.STATUS_ONAGREEMENT,
                                                              CodeConstManager.STATUS_ONAGREEMENT).Name, JsonRequestBehavior.AllowGet));
            }
            return(null);
        }
Ejemplo n.º 11
0
    private void OnEnable()
    {
        if (main)
        {
            Log.Error($"Tried to instantiate a second {nameof(DiscordClient)}");
            return;
        }

        main = this;
        DontDestroyOnLoad(gameObject);

        discord = new DiscordGameSDKWrapper.Discord(CLIENT_ID, (ulong)CreateFlags.NoRequireDiscord);
        discord.SetLogHook(DiscordGameSDKWrapper.LogLevel.Debug, (level, message) => Log.Write((NitroxModel.Logger.LogLevel)level, "[Discord] " + message));

        activityManager = discord.GetActivityManager();

        activityManager.RegisterSteam((uint)GameInfo.Subnautica.SteamAppId);
        activityManager.OnActivityJoinRequest += ActivityJoinRequest;
        activityManager.OnActivityJoin        += ActivityJoin;

        activity = new Activity();
    }
Ejemplo n.º 12
0
        public SocialFeedResponseWrapper GetMyActivities(string currentUserName)
        {
            var socialThreads = new List<SocialThread>();
            SPSecurity.RunWithElevatedPrivileges(() =>
            {
                using (var sitecollection = new SPSite(SharepointSiteUrl))
                {
                    var currentcontext = SPServiceContext.GetContext(sitecollection);
                    var userprofmanager = new UserProfileManager(currentcontext);
                    var currentuser = userprofmanager.GetUserProfile(currentUserName);
                    var activitymanager = new ActivityManager(currentuser, currentcontext);
                    var eventscollection = activitymanager.GetActivitiesByMe();
                    foreach (ActivityEvent activity in eventscollection)
                    {
                        if (activity.LinksList != null)
                        {
                            socialThreads.Add(new SocialThread()
                            {
                                Actors = new SocialThreadActor()
                                {
                                    Results = new List<SocialThreadActorResult>()
                                    {
                                        new SocialThreadActorResult()
                                        {
                                            Name = activity.Publisher.Name
                                        }
                                    }
                                }, RootPost = new SocialThreadRootPost()
                                {
                                    Text = activity.Value,
                                }
                            });
                        }
                    }
                }
            });

            var response = new SocialFeedResponseWrapper()
            {
                SocialResponse = new SocialResponse()
                {
                    Metadata = new SocialResponseMetaData() { },
                    SocialFeed = new SocialResult()
                    {
                        Threads = socialThreads
                    }
                }
            };

            return response;
        }