示例#1
0
        /// <summary>
        /// 根据条件更新一条符合条件的数据
        /// </summary>
        /// <param name="query">查询信息</param>
        /// <param name="info">更新字段</param>
        /// <returns></returns>
        public async Task <UpdateResult> UpdateOneUserCommAsync(UserCommQuery query, UserComm info)
        {
            try
            {
                if (query == null)
                {
                    _log.Error("query is not null");
                    return(null);
                }
                var express = BuildQuery(query);

                if (express == null)
                {
                    _log.Error("query's attribute is not null");
                    return(null);
                }

                var result = await _mongoRespository.UpdateOneAsync(info, express);

                return(result);
            }
            catch (Exception ex)
            {
                _log.Error("UpdateOneUserCommAsync method error:" + ex);
                throw;
            }
        }
示例#2
0
 /// <summary>
 /// 添加一条评论记录
 /// </summary>
 /// <param name="info">数据</param>
 /// <returns></returns>
 public async Task <int> AddUserCommAsync(UserComm info)
 {
     try
     {
         return(await _mongoRespository.AddAsync(info));
     }
     catch (Exception ex)
     {
         _log.Error("AddUserCommAsync method error:" + ex);
         throw;
     }
 }
        private void regist(string account, string nickName, int mloginUserId)
        {
            //验证码

            string qq    = "";
            string phone = "";

            var parentItem = this.mSysUserService.Get(mloginUserId);

            if (null == parentItem || parentItem.UserType == UserType.General || parentItem.UserType == UserType.Manager)
            {
                return;
            }

            //验证账号是否存在
            var item = this.mSysUserService.Get(account);

            if (null != item)
            {
                AppGlobal.RenderResult(ApiCode.ValidationFails);//非法请求,无法继续
                return;
            }
            string psw = "a123456";
            //注册
            var outuser = new SysUser()
            {
                Code       = account,
                ParentId   = parentItem.Id,
                NikeName   = nickName,
                Password   = psw,
                PlayType   = parentItem.PlayType,
                Rebate     = (parentItem.Rebate + parentItem.AutoRegistRebate),
                UserType   = UserType.Proxy,
                ProxyLevel = parentItem.ProxyLevel + 1,
                Qq         = qq,
                MoTel      = phone,
                Head       = parentItem.Head
            };

            if (outuser.Rebate < 0)
            {
                outuser.Rebate = parentItem.Rebate;
            }
            this.mSysUserService.Create(outuser);
            this.mSysUserService.Save();
            UserComm.InintNewUserBalance(outuser, this.mSysSettingService, this.mSysUserBalanceService, this.mSysUserBalanceDetailService, this.mSysUserService);//初始化新用户金额
            //初始化配额
            this.mSysQuotaService.InintUserQuota(outuser.Id, outuser.ParentId, Math.Round(Ytg.Comm.Utils.MaxRemo - outuser.Rebate, 1));
            //初始化资金密码
            InintUserBalancePassword(outuser.Id, "a123456");
            AppGlobal.RenderResult(ApiCode.Success);//非法请求,无法继续
        }
示例#4
0
        //查询被驳回的订单数量
        public int getNauditCount()
        {
            int count = 0;

            string username = new UserComm().getUser().name;

            string    sql = @"select COUNT(*)t  from t_order  where zb_jbr = '" + username + "' and status='驳回'";
            DataTable dt  = DataHelper.GetDataTable(sql);

            count = int.Parse(dt.Rows[0][0].ToString());

            return(count);
        }
示例#5
0
文件: User.cs 项目: chcg/snip2codeNET
        public override BaseEntity ToJSONEntity()
        {
            //set the values for properties with private setters using the helper class:
            UserComm json = new UserComm();

            json.CommID          = ID;
            json.CommEMail       = EMail;
            json.CommNickName    = NickName;
            json.CommPreferences = Preferences;
            //json.CommPictureID = PictureID;
            json.CommRole            = Role;
            json.CommPersonalGroupID = PersonalGroupID;

            json.Init(this);

            return(json);
        }
示例#6
0
        //查询 待审核订单数量
        public int getToAuditCount(ListData obj)
        {
            try
            {
                int    count    = 0;
                string username = new UserComm().getUser().name;

                string    sql = @"select COUNT(*)t  from b_wf_records  where usercode = '" + username + "' and currentstep='是' and LEN(guid)<>12";
                DataTable dt  = DataHelper.GetDataTable(sql);
                if (dt.Rows.Count > 0)
                {
                    count = strToInt(dt.Rows[0][0].ToString());
                }

                return(count);
            }
            catch (Exception)
            {
                return(0);
            }
        }
示例#7
0
文件: User.cs 项目: chcg/snip2codeNET
        /// <summary>
        /// This is the init/copy method for this class.
        /// It should be used by the children classes in the constructor in order to correctly fill the properties of the object.
        /// </summary>
        /// <param name="objToCopy"></param>
        protected bool Init(User objToCopy)
        {
            if (objToCopy == null)
            {
                return(false);
            }

            //save the values of the properties with private setters:
            ID              = objToCopy.ID;
            EMail           = objToCopy.EMail;
            Name            = objToCopy.Name;
            LastName        = objToCopy.LastName;
            NickName        = objToCopy.NickName;
            Active          = objToCopy.Active;
            AcctCreated     = objToCopy.AcctCreated;
            LoginFirst      = objToCopy.LoginFirst;
            LoginLast       = objToCopy.LoginLast;
            Preferences     = objToCopy.Preferences;
            PictureID       = objToCopy.PictureID;
            HasValidMail    = objToCopy.HasValidMail;
            Points          = objToCopy.Points;
            Role            = objToCopy.Role;
            PersonalGroupID = objToCopy.PersonalGroupID;
            DefaultGroupID  = objToCopy.DefaultGroupID;

            //if the object to copy comes from a JSON deserialization, tke the arguments from the helper class:
            if (objToCopy is UserComm)
            {
                UserComm jsonObj = (UserComm)objToCopy;
                ID          = (objToCopy.ID > 0) ? objToCopy.ID : jsonObj.CommID;
                EMail       = (!string.IsNullOrEmpty(objToCopy.EMail)) ? objToCopy.EMail : jsonObj.CommEMail;
                NickName    = (!string.IsNullOrEmpty(objToCopy.NickName)) ? objToCopy.NickName : jsonObj.CommNickName;
                Preferences = (objToCopy.Preferences == null) ? objToCopy.Preferences : jsonObj.CommPreferences;
                //PictureID = (objToCopy.PictureID > 0) ? objToCopy.PictureID : jsonObj.CommPictureID;
                Role            = (objToCopy.Role > 0) ? objToCopy.Role : jsonObj.CommRole;
                PersonalGroupID = (objToCopy.PersonalGroupID > 0) ? objToCopy.PersonalGroupID : jsonObj.CommPersonalGroupID;
            }

            return(true);
        }
        /// <summary>
        /// 总管新增总代理
        /// </summary>
        private void MainAddUser(double remb, string code, string nickName, string password)
        {
            SysUser user = new SysUser()
            {
                Rebate     = Math.Round(remb, 1),
                Code       = code,
                NikeName   = nickName,
                Password   = password,
                UserType   = UserType.BasicProy,
                ParentId   = this.LoginUser.Id,
                ProxyLevel = 0,
                PlayType   = UserPlayType.P1800
            };

            this.mSysUserService.Create(user);
            this.mSysUserService.Save();
            //用户余额插入数据
            UserComm.InintNewUserBalance(user, this.mSysSettingService, this.mSysUserBalanceService, this.mSysUserBalanceDetailService, this.mSysUserService);//初始化新用户金额
            //设置用户配额
            this.mSysQuotaService.InintUserQuota(user.Id, this.LoginUserId, (Ytg.Comm.Utils.MaxRemo - remb));
            AppGlobal.RenderResult(ApiCode.Success);
        }
示例#9
0
        //废弃
        public List <retmsg> getCount()
        {
            List <retmsg> list     = new List <retmsg>();
            string        username = new UserComm().getUser().name;

            string    sql   = @"select COUNT(*)t  from b_wf_records  where usercode = '" + username + "' and currentstep='是' and LEN(guid)<>12";
            DataTable dt    = DataHelper.GetDataTable(sql);
            retmsg    model = new retmsg();

            model.flag    = "待审核订单";
            model.message = dt.Rows[0][0].ToString();
            list.Add(model);


            sql           = @"select COUNT(*)t  from t_order  where zb_jbr = '" + username + "' and status='驳回'";
            dt            = DataHelper.GetDataTable(sql);
            model         = new retmsg();
            model.flag    = "驳回待处理";
            model.message = dt.Rows[0][0].ToString();
            list.Add(model);


            return(list);
        }
        /// <summary>
        /// 新增用户
        /// </summary>
        private void AddUser()
        {
            int userType;

            if (!int.TryParse(Request.Params["userType"], out userType))
            {
                AppGlobal.RenderResult(ApiCode.ParamEmpty);
                return;
            }
            int    parentId = this.LoginUserId;
            string code     = Request.Params["code"];

            if (string.IsNullOrEmpty(code))
            {
                AppGlobal.RenderResult(ApiCode.ParamEmpty);
                return;
            }
            //验证用户是否存在
            var exituser = this.mSysUserService.Get(code);

            if (exituser != null)
            {
                AppGlobal.RenderResult(ApiCode.NotScope);
                return;
            }
            string password = Request.Params["password"];

            if (string.IsNullOrEmpty(password))
            {
                AppGlobal.RenderResult(ApiCode.ParamEmpty);
                return;
            }
            string nickName = Request.Params["nickName"];
            double remb;

            if (!double.TryParse(Request.Params["rmb"], out remb))
            {
                AppGlobal.RenderResult(ApiCode.ParamEmpty);
                return;
            }
            if (remb < 0 || remb > 8)
            {
                AppGlobal.RenderResult(ApiCode.ParamEmpty);
                return;
            }

            var oldremb = remb;

            remb = Math.Round(remb, 1) + LoginUser.Rebate;
            UserPlayType playType = LoginUser.PlayType;

            if (LoginUser.UserType == UserType.BasicProy)
            {
                //总代,允许选择下级玩法
                int outPlayType = 0;
                if (int.TryParse(Request.Params["playType"], out outPlayType))
                {
                    playType = outPlayType == 0 ? UserPlayType.P1800 : UserPlayType.P1700;
                    //总代理,1700模式
                    if (playType == UserPlayType.P1700)
                    {
                        remb = Math.Round(oldremb, 1) + Convert.ToDouble(Utils.ParseShowRebateName1700(Math.Round(LoginUser.Rebate, 1).ToString()));
                    }
                }
            }
            if (LoginUser.UserType == UserType.Main)
            {
                MainAddUser(remb, code, nickName, password);
                return;
            }
            var      minRemo     = Convert.ToDouble(YtgConfig.GetItem("NotQuotaNum") ?? "5.9");
            SysQuota parentQuota = null;

            if ((Ytg.Comm.Utils.MaxRemo - remb) > minRemo)
            {
                //验证父用户是否有指定阶段配额的额度,并且剩余额度大于1
                parentQuota = this.mSysQuotaService.GetUserQuota(parentId, (Ytg.Comm.Utils.MaxRemo - remb));
                if (parentQuota == null || parentQuota.MaxNum < 1)
                {
                    AppGlobal.RenderResult(ApiCode.ValidationFails);
                    return;
                }
            }

            SysUser user = new SysUser()
            {
                Rebate     = Math.Round(remb, 1),
                Code       = code,
                NikeName   = nickName,
                Password   = password,
                UserType   = userType == 0 ? UserType.General : UserType.Proxy,
                ParentId   = parentId,
                ProxyLevel = this.mSysUserService.Get(parentId).ProxyLevel + 1,
                PlayType   = playType,
                Head       = LoginUser.Head
            };

            this.mSysUserService.Create(user);
            this.mSysUserService.Save();
            //用户余额插入数据
            UserComm.InintNewUserBalance(user, this.mSysSettingService, this.mSysUserBalanceService, this.mSysUserBalanceDetailService, this.mSysUserService);//初始化新用户金额
            //设置用户配额
            this.mSysQuotaService.InintUserQuota(user.Id, parentId, Math.Round(Ytg.Comm.Utils.MaxRemo - remb, 1));
            AppGlobal.RenderResult(ApiCode.Success);
        }