Пример #1
0
        public M_LiteUser GetModelFromReader(DataRow rdr)
        {
            M_LiteUser model = new M_LiteUser();

            model.userId    = Convert.ToInt32(rdr["UserID"]);
            model.groupId   = ConvertToInt(rdr["groupId"]);
            model.userFace  = ConverToStr(rdr["userFace"]);
            model.userName  = ConverToStr(rdr["UserName"]);
            model.honeyName = ConverToStr(rdr["HoneyName"]);
            model.trueName  = ConverToStr(rdr["trueName"]);
            model.openid    = ConverToStr(rdr["openid"]);
            model.puid      = ConvertToInt(rdr["puid"]);
            model.puname    = ConverToStr(rdr["puname"]);
            model.address   = ConverToStr(rdr["address"]);
            model.mobile    = ConverToStr(rdr["mobile"]);
            model.sex       = ConvertToInt(rdr["userSex"]) == 1 ? "男" : "女";
            model.cardType  = ConverToStr(rdr["cardType"]);
            model.idcard    = ConverToStr(rdr["idCard"]);
            model.age       = ConvertToInt(rdr["age"]);
            model.siteId    = ConvertToInt(rdr["siteId"]);
            //------------
            //if (string.IsNullOrEmpty(model.userFace))
            //{
            //    model.userFace = SiteConfig.SiteInfo.SiteUrl + "/Images/UserFace/noface.png";
            //}
            //else if (!model.userFace.Contains("://"))
            //{
            //    model.userFace = SiteConfig.SiteInfo.SiteUrl + model.userFace;
            //}
            return(model);
        }
Пример #2
0
        public override SqlParameter[] GetParameters()
        {
            M_LiteUser model = this;

            SqlParameter[] sp = GetSP();
            return(sp);
        }
Пример #3
0
        public M_LiteUser SelReturnModel(int uid)
        {
            DataTable dt = DBCenter.Sel(TbName, "UserID=" + uid, "");

            if (dt.Rows.Count < 1)
            {
                return(null);
            }
            M_LiteUser model = new M_LiteUser().GetModelFromReader(dt.Rows[0]);

            return(model);
        }
Пример #4
0
        public M_LiteUser SelModelByOpenId(string openid)
        {
            if (string.IsNullOrEmpty(openid))
            {
                return(null);
            }
            List <SqlParameter> sp = new List <SqlParameter>()
            {
                new SqlParameter("openid", openid)
            };
            DataTable dt = DBCenter.Sel(TbName, "openid=@openid", "", sp);

            if (dt.Rows.Count < 1)
            {
                return(null);
            }
            M_LiteUser model = new M_LiteUser().GetModelFromReader(dt.Rows[0]);

            return(model);
        }
Пример #5
0
        public M_LiteUser SelModelByPasswd(string uname, string passwd)
        {
            if (string.IsNullOrEmpty(uname) || string.IsNullOrEmpty(passwd))
            {
                return(null);
            }
            passwd = StringHelper.MD5(passwd);
            List <SqlParameter> sp = new List <SqlParameter>()
            {
                new SqlParameter("uname", uname),
                new SqlParameter("passwd", passwd)
            };
            DataTable dt = DBCenter.Sel(TbName, "UserName=@uname AND UserPwd=@passwd", "", sp);

            if (dt.Rows.Count < 1)
            {
                return(null);
            }
            M_LiteUser model = new M_LiteUser().GetModelFromReader(dt.Rows[0]);

            return(model);
        }
Пример #6
0
 public bool UpdateByID(M_LiteUser model)
 {
     return(DBCenter.UpdateByID(model, model.userId));
 }