Exemplo n.º 1
0
    protected void menuList_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "Edit")
        {
            id = int.Parse(e.CommandArgument.ToString());
        }
        else if (e.CommandName == "Cancel")
        {
            id = -1;
        }
        else if (e.CommandName == "Update")
        {
            string PrizeName   = ((TextBox)this.menuList.Items[e.Item.ItemIndex].FindControl("txtEditPrizeName")).Text.Trim();
            string PresetValue = "";// ((TextBox)this.menuList.Items[e.Item.ItemIndex].FindControl("txtEditPresetValue")).Text.Trim();

            int UserId = int.Parse(e.CommandArgument.ToString());

            Model.AwardsStatisticsModel m = dal.GetModel(UserId);

            if (m.Id > 0)
            {
                m.PrizeName   = PrizeName;
                m.PresetValue = PresetValue;

                dal.UpdatePrizeNameById(m);
            }
        }
        else if (e.CommandName == "Delete")
        {
        }

        bd();
    }
Exemplo n.º 2
0
    //生成订单
    public Model.ReturnValue ProcessCode(HttpContext context)
    {
        Model.ReturnValue result = new Model.ReturnValue();

        #region 验证Session
        result = CheckSession();
        if (result.Success == false)
        {
            ESLogMethod.ESLogInstance.Debug("Session不通过", "");

            return(result);
        }
        #endregion

        string OpenId = orderSession.OpenId;
        string Mobile = context.Request["mob"];
        //string Code = context.Request["code"];

        #region 验证OpenId
        if (Common.ValidateHelper.IsOpenid(OpenId) == false)
        {
            ESLogMethod.ESLogInstance.Debug("Openid格式异常", OpenId);

            result.ErrMessage = "系统繁忙,请稍后再试";
            result.Success    = false;
            return(result);
        }
        #endregion

        #region 验证手机号
        if (Common.ValidateHelper.IsMobile(Mobile) == false)
        {
            ESLogMethod.ESLogInstance.Debug("手机号错误", Mobile);

            result.ErrMessage = "请填写正确手机号";
            result.Success    = false;
            return(result);
        }
        #endregion

        string Ip     = Common.ClientIP.GetIp();
        int    FileId = orderSession.FileId;
        #region 检查IP
        if (Db.Security.IpAccessControlDal.CheckIpIsOK(false, CacheBase.IPSettingModel, Ip, "", "") == false)
        {
            ESLogMethod.ESLogInstance.Debug("IP模型超过限制", Ip);

            result.ErrMessage = "系统繁忙,请稍后再试";
            result.Success    = false;
            return(result);
        }
        #endregion

        #region //验证激活码
        //if (Common.ValidateHelper.IsCode(Code, 13) == false)
        //{

        //    #region 登记IP
        //    Db.Security.IpAccessControlDal.CheckIpIsOK(true, CacheBase.IPSettingModel, Ip, Code, "激活码格式错误");
        //    #endregion

        //    ESLogMethod.ESLogInstance.Debug("激活码格式错误", Code, Mobile);

        //    result.ErrMessage = "请填写正确的激活码";
        //    result.Success = false;
        //    return result;
        //}
        #endregion

        lock (_SyncLock)
        {
            //Model.PassCodeInfoModel PassCodeModel = PassCodeDal.GetModelByCode(Code);

            #region //验证激活码状态
            //if (PassCodeModel.Id <= 0)
            //{
            //    #region 登记IP
            //    Db.Security.IpAccessControlDal.CheckIpIsOK(true, CacheBase.IPSettingModel, Ip, Code, "库无此激活码");
            //    #endregion

            //    ESLogMethod.ESLogInstance.Debug("激活码不存在", Code, Mobile);

            //    result.ErrMessage = "请填写正确的激活码";
            //    result.Success = false;
            //    return result;
            //}

            //if (PassCodeModel.StatusId == 1)
            //{
            //    Model.OrderInfoModel orderdel = OrderDal.GetModelByCode(Code);

            //    if (orderdel.Id <= 0)
            //    {
            //        #region 登记IP
            //        Db.Security.IpAccessControlDal.CheckIpIsOK(true, CacheBase.IPSettingModel, Ip, Code, "订单无此串码");
            //        #endregion

            //        ESLogMethod.ESLogInstance.Debug("激活码已激活无订单", Code, Mobile);

            //        result.ErrMessage = "请填写正确的激活码";
            //        result.Success = false;
            //        return result;
            //    }

            //    if (orderdel.OpenId != OpenId)
            //    {
            //        ESLogMethod.ESLogInstance.Debug("激活码已绑定其他微信号", OpenId, Code);

            //        result.ErrMessage = "激活码已绑定其他微信号";
            //        result.Success = false;
            //        return result;
            //    }

            //    result.ErrMessage = "提交成功";
            //    result.Success = true;
            //    return result;
            //}
            #endregion

            #region 检查手机号-openid-IP 参与次数是否超限
            string maxcont = WebFramework.OrderService.OrderMethod.OrderInstance.CheckMobOpidIp(Mobile, OpenId, Ip);

            if (string.IsNullOrEmpty(maxcont) == false)
            {
                ESLogMethod.ESLogInstance.Debug("参与次数超限", maxcont);

                result.ErrMessage = maxcont;
                result.Success    = false;
                return(result);
            }
            #endregion


            Model.FileInfoModel filedel = new Db.FileInfoDal().GetModel(FileId);
            if (filedel.Id <= 0)
            {
                WebFramework.GeneralMethodBase.WebDebugLog(OpenId, "小票不存在:" + FileId);

                result.ErrMessage = "请上传小票";
                result.Success    = false;
                return(result);
            }

            #region 验证小票是否重复
            if (Common.TypeHelper.ObjectToBool(WebFramework.GeneralMethodBase.GetKeyConfig(11).Val, true))
            {
                int RepetCount = new Db.OrderInfoDal().CheckFilesRepeatCount(filedel.Hashdata);

                if (RepetCount > 0)
                {
                    filedel.States = -1;
                }
            }
            #endregion

            #region 抽奖-保存订单
            int goid = WebFramework.GeneralMethodBase.GenerationOrderId(0);

            #region 抽奖
            Model.AwardsStatisticsModel PrizeModel = WebFramework.GeneralMethodBase.GetPrize(3, 1);
            #endregion

            Model.OrderInfoModel model = new Model.OrderInfoModel();
            model.OrderCode  = WebFramework.GeneralMethodBase.CreateOrderCode(goid);
            model.Jx         = PrizeModel.AwardsName;
            model.Jp         = PrizeModel.PrizeName;
            model.DateStamp  = DateTime.Now.ToString("yyyyMMdd");
            model.Ip         = Ip;
            model.IpAddress  = string.Join("-", Common.ClientIP.GetArrayAdds(model.Ip));
            model.CreateTime = DateTime.Now;
            model.OpenId     = OpenId;
            model.Mob        = Mobile;

            model.FilesId = FileId;
            if (filedel.States == -1)
            {
                model.States = filedel.States;//-1表示已作废
            }
            else
            {
                model.States = 2;//2------>表示上传未抽奖
            }

            #region 抽取红包奖项
            Model.AwardsStatisticsModel RedPackPrizeModel = new Model.AwardsStatisticsModel();

            if (model.Jp == "微信红包")
            {
                //RedPackPrizeModel = WebFramework.GeneralMethodBase.GetPrize(7, 2);
                //model.HbOrderCode = WebFramework.GeneralMethodBase.CreateHbCode(goid);//创建红包单号
                //model.RedPackMoney = Common.TypeHelper.ObjectToInt(RedPackPrizeModel.PrizeName, 0);//获取红包金额
            }
            #endregion

            #region 节流
            //if (WebFramework.PrivacyDemand.PrivacyMethod.PrivacyInstance.Throttling())
            //{
            //    model.States = 1;
            //}
            #endregion

            //PassCodeModel.Mob = Mobile;
            //PassCodeModel.StatusId = 1;
            //PassCodeModel.ActiveTime = DateTime.Now;
            //PassCodeModel.OpenId = model.OpenId;

            Model.OrderLogModel mdlog = new Model.OrderLogModel();
            mdlog.OId       = 0;
            mdlog.OrderCode = model.OrderCode;
            mdlog.Mob       = Mobile;
            mdlog.UpTime    = DateTime.Now;
            mdlog.LStatus   = 0;
            mdlog.Status    = 1;
            mdlog.Notes     = "";

            int OrderId = 0;//插入订单ID

            //此方法不可替换更改,因与抽奖查询关联
            if (OrderDal.AddOrderInfo_UpdatePassCodeInfo_AddOrderLog(model, null, mdlog, PrizeModel.Id, RedPackPrizeModel.Id, ref OrderId) > 0)
            {
                #region 虚拟订单
                WebFramework.PrivacyDemand.PrivacyMethod.PrivacyInstance.AddFictitiousOrder(model);
                #endregion
                #region 发送自动作废短信
                if (model.States == -1)
                {
                    WebFramework.GeneralMethodBase.GetMsg(2, model.Mob, model.OrderCode);
                }
                #endregion
                orderSession.OrderKey = model.OrderCode;
                SessionMethod.SessionInstance.SetSession(orderSession);
                result.ErrMessage = "提交成功";
                result.Success    = true;
                return(result);;
            }
            #endregion
        }

        ESLogMethod.ESLogInstance.Error("添加订单失败", Mobile);

        result.ErrMessage = "系统繁忙,请稍后再试";
        result.Success    = false;
        return(result);
    }
Exemplo n.º 3
0
    public Model.ReturnValue ProcessUpload(HttpContext context)
    {
        Model.ReturnValue result = new Model.ReturnValue();

        #region 验证Session
        result = CheckSession();
        if (result.Success == false)
        {
            ESLogMethod.ESLogInstance.Debug("Session不通过", "");
            return(result);
        }
        #endregion

        string OpenId = orderSession.OpenId;
        string Mobile = context.Request["mob"];
        int    FileId = orderSession.FileId;
        string Ip     = Common.ClientIP.GetIp();

        #region 验证OpenId
        if (Common.ValidateHelper.IsOpenid(OpenId) == false)
        {
            ESLogMethod.ESLogInstance.Debug("Openid格式异常", OpenId, Mobile);

            result.ErrMessage = "系统繁忙,请稍后再试";
            result.Success    = false;
            return(result);
        }
        #endregion

        #region 验证手机号
        if (Common.ValidateHelper.IsMobile(Mobile) == false)
        {
            ESLogMethod.ESLogInstance.Debug("手机号错误", Mobile);

            result.ErrMessage = "请填写正确手机号";
            result.Success    = false;
            return(result);
        }
        #endregion

        lock (_SyncLock)
        {
            #region 验证小票
            Model.FileInfoModel filedel = new Db.FileInfoDal().GetModel(FileId);
            if (filedel.Id <= 0)
            {
                ESLogMethod.ESLogInstance.Debug("小票不存在", FileId.ToString(), Mobile);

                result.ErrMessage = "请上传小票";
                result.Success    = false;
                return(result);
            }

            #region 验证小票是否重复
            if (Common.TypeHelper.ObjectToBool(WebFramework.GeneralMethodBase.GetKeyConfig(11).Val, true))
            {
                int RepetCount = new Db.OrderInfoDal().CheckFilesRepeatCount(filedel.Hashdata);

                if (RepetCount > 0)
                {
                    filedel.States = -1;
                }
            }
            #endregion
            #endregion

            #region 检查是否有中奖未完善信息订单

            //Model.OrderInfoModel Nomobdel = oddal.GetModel(string.Format(" Mob='{0}' and Types=0 and Jx<>'参与奖' and States=0", mob));
            //if (Nomobdel.Id > 0)
            //{
            //    orderSession.Id = Nomobdel.Id;

            //    returnErro(context, "true", "提交成功", "");
            //    context.Response.End();
            //    return;
            //}
            #endregion

            #region 检查手机号-openid-IP 参与次数是否超限
            string maxcont = WebFramework.OrderService.OrderMethod.OrderInstance.CheckMobOpidIp(Mobile, OpenId, Ip);

            if (string.IsNullOrEmpty(maxcont) == false)
            {
                ESLogMethod.ESLogInstance.Debug("参与总数超限", maxcont);

                result.ErrMessage = maxcont;
                result.Success    = false;
                return(result);
            }
            #endregion

            #region 抽奖-保存订单
            int goid = WebFramework.GeneralMethodBase.GenerationOrderId(0);

            #region 抽奖
            Model.AwardsStatisticsModel PrizeModel = WebFramework.GeneralMethodBase.GetPrize(7, 1);
            #endregion

            Model.OrderInfoModel model = new Model.OrderInfoModel();

            model.Jx         = PrizeModel.AwardsName;
            model.OrderCode  = WebFramework.GeneralMethodBase.CreateOrderCode(goid);
            model.Jp         = PrizeModel.PrizeName;
            model.States     = filedel.States;
            model.DateStamp  = DateTime.Now.ToString("yyyyMMdd");
            model.Ip         = Ip;
            model.IpAddress  = string.Join("-", Common.ClientIP.GetArrayAdds(model.Ip));
            model.CreateTime = DateTime.Now;
            model.OpenId     = OpenId;
            model.Mob        = Mobile;
            model.FilesId    = FileId;

            #region 抽取红包奖项
            Model.AwardsStatisticsModel RedPackPrizeModel = new Model.AwardsStatisticsModel();
            if (model.Jp == "微信红包")
            {
                //RedPackPrizeModel = WebFramework.GeneralMethodBase.GetPrize(7, 2);
                //model.HbOrderCode = WebFramework.GeneralMethodBase.CreateHbCode(goid);//创建红包单号
                //model.RedPackMoney = Common.TypeHelper.ObjectToInt(RedPackPrizeModel.PrizeName, 0);//获取红包金额
            }
            #endregion

            int OrderId = 0;

            //此方法不可替换更改,因与抽奖查询关联
            if (oddal.AddOrderInfo_UpdatePassCodeInfo_AddOrderLog(model, null, null, PrizeModel.Id, RedPackPrizeModel.Id, ref OrderId) > 0)
            {
                #region 发送自动作废短信
                if (model.States == -1)
                {
                    WebFramework.GeneralMethodBase.GetMsg(2, model.Mob, model.OrderCode);
                }
                #endregion

                #region OCR预录
                if (filedel != null)
                {
                    WebFramework.OrderService.OrderMethod.OrderInstance.OcrRecorded(model.OrderCode, filedel.Hashdata, filedel.FileName);
                }
                #endregion

                orderSession.Id = OrderId;
                WebFramework.SessionManage.SessionMethod.SessionInstance.SetSession(orderSession);

                result.ErrMessage = "提交成功";
                result.Success    = true;
                return(result);
            }
            #endregion
        }

        ESLogMethod.ESLogInstance.Error("添加订单失败", Mobile);

        result.ErrMessage = "系统繁忙,请稍后再试";
        result.Success    = false;
        return(result);
    }