Ejemplo n.º 1
0
        /// <summary>
        /// 当该用户信息不存在,则存到表中
        /// </summary>
        /// <param name="model"></param>
        public void UserInfoOpe(WX_ZZSCUserInfo model)
        {
            WX_ZZSCUserDAL userDal = new WX_ZZSCUserDAL();

            //1.该用户是否已经存在于表中
            WX_ZZSCUserInfo queryMod = userDal.Query<WX_ZZSCUserInfo>("OpenID = @OpenID", model).FirstOrDefault();

            //2.判断
            if (queryMod == null)
            {
                model.Flag = 1;
                model.Type = 1;
                model.OpeDate = DateTime.Now;

                userDal.Add(model);

                LogFileHelper.WriteLogByTxt("UserService:新加入一位用户:" + model.Name);
            }
        }
Ejemplo n.º 2
0
        public ActionResult AdminUserDataOpe(WX_ZZSCUserInfo par1)
        {
            //Request
            WX_ZZSCUserInfo userInfo = par1;

            //Init
            string openid = Session["adm_openid"].ToString();
            userInfo.OpenID = openid;

            //Ope
            Tuple<bool, WX_ZZSCUserInfo> tupResult = new UserService().AdminUserDataOpe(userInfo);

            bool flag = tupResult.Item1;
            string strMsg = flag ? "保存成功!" : "保存失败!";

            //Session数据操作
            if (flag)
            {
                Session["adm_name"] = userInfo.Name;
                Session["adm_loginName"] = userInfo.LoginName;
                Session["adm_phoneNum"] = userInfo.PhoneNum;
            }

            return Content(JsonConvert.SerializeObject(new { Flag = flag, Msg = strMsg }));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 后台用户注册业务逻辑
        /// </summary>
        /// <param name="par1"></param>
        /// <returns></returns>
        public ActionResult SiginOpe(WX_ZZSCUserInfo par1, string par2)
        {
            //Request
            WX_ZZSCUserInfo userInfo = par1;
            string strReferrerPhone = par2;

            //Result
            bool flag = false;
            string strMsg = string.Empty;

            if (!strReferrerPhone.Equals(ZZSCResource.AdminConfig.ReferrerPhone.ToString()))
            { //验证推荐手机号码是否相同:是否允许注册后台
                flag = false;
                strMsg = "推荐人电话号码有误,您无法进行注册!";
            }
            else
            {
                //Ope
                Tuple<bool, string, string> tupResult = new UserService().AdminSiginOpe(userInfo);

                flag = tupResult.Item1;
                strMsg = tupResult.Item3;
            }

            return Content(JsonConvert.SerializeObject(new { Flag = flag, Msg = strMsg }));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Address"></param>
        /// <param name="PhoneNum"></param>
        /// <returns></returns>
        public ActionResult UserInfoOpe(string Address, string PhoneNum, string Name)
        {
            string userID = Session["UserID"] == null || string.IsNullOrEmpty(Session["UserID"].ToString()) ?
                string.Empty :
                Session["UserID"].ToString();

            //userID = "o0J0Jt4FeIf0Rbrwgv1aKG4ULRS4";

            WX_ZZSCUserInfo model = new WX_ZZSCUserInfo() { OpenID = userID, Address = Address, PhoneNum = PhoneNum, Name = Name };

            new UserService().UserInfoOpe(model);

            return Content(string.Empty);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 后台用户注册业务逻辑
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public Tuple<bool, string, string> AdminSiginOpe(WX_ZZSCUserInfo userInfo)
        {
            //Init
            StringBuilder sbWhere = new StringBuilder();

            //DAL
            WX_ZZSCUserDALCNa userDal = new WX_ZZSCUserDALCNa();

            //Result
            string strMsg = string.Empty;
            string strState = string.Empty;
            bool flag = false; //true:注册成功、false:注册失败

            //1.该手机号码是否已注册过 OR 用户名是否重复
            sbWhere.Append(" PhoneNum = @PhoneNum OR LoginName = @LoginName");

            //2.查询数据
            IEnumerable<WX_ZZSCUserInfo> list = userDal.Query<WX_ZZSCUserInfo>(sbWhere.ToString(), userInfo);

            //3.没有用户信息,也没有账号信息,则Insert
            if (list == null || list.Count().Equals(0))
            {
                userInfo.OpenID = Guid.NewGuid().ToString("N");
                userInfo.Address = string.Empty;
                userInfo.Flag = 1;
                userInfo.Type = 2;
                userInfo.OpeDate = DateTime.Now;
                userInfo.Remark = string.Empty;
                flag = userDal.Add(userInfo) > 0;

                strState = "NewAdminUser";

                return new Tuple<bool, string, string>(flag, strState, strMsg);
            }

            //4.验证用户名是否重复 若有用户信息,没有账号信息,则Update
            if (list.FirstOrDefault(x => x.LoginName.Equals(userInfo.LoginName)) != null) { strState = "LoginNameRepeat"; strMsg = "该用户名已被注册!"; flag = false; return new Tuple<bool, string, string>(flag, strState, strMsg); }

            //5.手机号码信息存在
            WX_ZZSCUserInfo userItem = list.FirstOrDefault(x => x.PhoneNum.Equals(userInfo.PhoneNum));
            if (userItem != null)
            {
                if (string.IsNullOrEmpty(userItem.LoginName) || string.IsNullOrEmpty(userItem.Password))
                { //用户登录信息不存在
                    userItem.LoginName = userInfo.LoginName;
                    userItem.Password = userInfo.Password;
                    userItem.Name = userInfo.Name;
                    flag = userDal.Update(userItem) > 0;

                    strState = "ComplationCustomUser";

                    return new Tuple<bool, string, string>(flag, strState, strMsg);
                }
                else
                {
                    strState = "PhoneNumRepeat";
                    flag = false;
                    strMsg = "该手机号码已被注册!";

                    return new Tuple<bool, string, string>(flag, strState, strMsg);
                }
            }

            strMsg = flag ? string.Empty : "注册失败!";
            return new Tuple<bool, string, string>(flag, strState, strMsg);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 用户设置业务逻辑方法
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public Tuple<bool, WX_ZZSCUserInfo> AdminUserDataOpe(WX_ZZSCUserInfo userInfo)
        {
            //Query
            WX_ZZSCUserInfo userItem = this.RequestUserInfo(userInfo.OpenID);

            userItem.Name = userInfo.Name;
            userItem.PhoneNum = userInfo.PhoneNum;
            userItem.Password = userInfo.Password;

            bool flag = new WX_ZZSCUserDALCNa().Update(userItem) > 0;

            return new Tuple<bool, WX_ZZSCUserInfo>(flag, userItem);
        }