Exemplo n.º 1
0
        /// <summary>
        /// 分页处理
        /// </summary>
        /// <param name="src"></param>
        /// <param name="e"></param>
        protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
        {
            AspNetPager1.CurrentPageIndex = e.NewPageIndex;

            CY.UME.Core.Business.AccountOperation ao = new CY.UME.Core.Business.AccountOperation();

            ao.AccountName = HFAccountName.Value;
            ao.Email = HFEmail.Value;
            ao.Remark = HFRemark.Value;
            ao.IsSuccess = CY.Utility.Common.ConvertUtility.ConvertToInt(HFIsSuccess.Value, -1);

            Bind(ao, HFStartTime.Value, HFEndTime.Value, HFSort.Value, true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BtnSearch_Click(object sender, EventArgs e)
        {
            HFAccountName.Value = TxtAccountName.Text.Trim();
            HFEmail.Value = TxtEmail.Text.Trim();
            HFStartTime.Value = TxtStartTime.Text.Trim();
            HFEndTime.Value = TxtEndTime.Text.Trim();
            HFIsSuccess.Value = DDLIsSuccess.SelectedValue;
            HFSort.Value = DDLSort.SelectedValue;
            HFRemark.Value = TxtRemark.Text.Trim();

            CY.UME.Core.Business.AccountOperation ao = new CY.UME.Core.Business.AccountOperation();

            ao.AccountName = HFAccountName.Value;
            ao.Email = HFEmail.Value;
            ao.Remark = HFRemark.Value;
            ao.IsSuccess = CY.Utility.Common.ConvertUtility.ConvertToInt(HFIsSuccess.Value, -1);

            Bind(ao, HFStartTime.Value, HFEndTime.Value, HFSort.Value, true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 用户签到
        /// </summary>
        /// <param name="context"></param>
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";

            CY.UME.Core.Business.Account account = CY.UME.Core.Global.GetCurrentAccount();

            if (account == null)
            {
                context.Response.Write("{success:false,msg:'请先登陆'}");
                return;
            }

            try
            {
                CY.UME.Core.Business.AccountOperation ao = new CY.UME.Core.Business.AccountOperation();

                if (account != null)
                {
                    ao.AccountId = account.Id;
                    ao.AccountName = account.Name;
                }

                ao.Email = account.Email;//Email一直都有
                ao.DateCreated = DateTime.Now;
                ao.Type = "SignIn";
                ao.IP = CY.Utility.Common.RequestUtility.ClientIP;
                ao.Remark = "用户签到。";

                if (account.Id <= 0)
                {//操作保存失败
                    ao.IsSuccess = 0;
                    ao.Save();

                    context.Response.Write("{success:false,msg:'登陆超时,请重新登陆。'}");
                    return;
                }
                else
                {//保存成功,加积分。
                    int SignInCredit;
                    if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditSignIn", out SignInCredit) && (SignInCredit != 0))
                    {
                        DateTime now = DateTime.Now;
                        DateTime startOfDay = new DateTime(now.Year, now.Month, now.Day);
                        // 获取用户当日内由登录而获得的积分
                        int creditsAlreadyGainToday;
                        List<CY.UME.Core.Business.CreditHistory> creditHistories = CY.UME.Core.Business.CreditHistory.GetCreditHistory(
                                "SignIn",
                                account.Id,
                                new long?(),
                                string.Empty,
                                startOfDay,
                                startOfDay.AddDays(1),
                                new CY.UME.Core.PagingInfo
                                {
                                    CurrentPage = 1,
                                    PageSize = int.MaxValue
                                }
                            );
                        creditsAlreadyGainToday = creditHistories.Sum<CY.UME.Core.Business.CreditHistory>(ch => ch.Variation);
                        if (creditsAlreadyGainToday < 1)
                        {
                            int orgCredit = account.Credit;
                            int modifiedCredit = orgCredit + SignInCredit;

                            account.Credit = modifiedCredit;
                            account.Save();

                            CY.UME.Core.Business.CreditHistory ch = new CY.UME.Core.Business.CreditHistory();
                            ch.AccountId = account.Id;
                            ch.DateCreated = DateTime.Now;
                            ch.Id = Guid.NewGuid();
                            ch.InstanceId = account.Id.ToString();
                            ch.Original = orgCredit;
                            ch.Modified = modifiedCredit;
                            ch.Variation = SignInCredit;
                            ch.Type = "SignIn";
                            ch.Description = "用户签到";
                            ch.Save();

                            ao.IsSuccess = 1;
                            ao.Save();

                            context.Response.Write("{success:true,msg:'签到成功'}");
                            return;
                        }
                        else
                        {
                            ao.IsSuccess = 0;
                            ao.Save();

                            context.Response.Write("{success:true,msg:'每天只能签到一次'}");
                            return;
                        }
                    }
                }
            }
            catch
            {
                context.Response.Write("{success:false,msg:'系统忙,请稍后再试'}");
                return;
            }
        }