Пример #1
0
        public OAuthTdm FindByOpenId(IDbSession sess, OAuthKind kind, string openId)
        {
            SqlSelect ss = new SqlSelect(sess);

            ss.Sql   = SelectSQL;
            ss.Where = " m.nt_kind=@nt_kind and m.sz_open_id=@sz_open_id";
            ss.AddParam("@nt_kind", (int)kind).AddParam("@sz_open_id", openId);
            return(ss.ExecuteSingle <OAuthTdm>());
        }
Пример #2
0
        public EditionTdm FindById(IDbSession sess, long id)
        {
            SqlSelect ss = new SqlSelect(sess);

            ss.Sql   = SelectEdition;
            ss.Where = "u.ng_id=@userId";
            ss.AddParam("@userId", id);
            return(ss.ExecuteSingle <EditionTdm>());
        }
Пример #3
0
        public UserTdm FindByEmail(IDbSession sess, string email)
        {
            SqlSelect ss = new SqlSelect(sess);

            ss.Sql   = SelectUser;
            ss.Where = "u.sz_mobile=@sz_mobile";
            ss.AddParam("@sz_mobile", email);
            return(ss.ExecuteSingle <UserTdm>());
        }
Пример #4
0
        public UserTdm FindByMobile(IDbSession sess, string mobile)
        {
            SqlSelect ss = new SqlSelect(sess);

            ss.Sql   = SelectUser;
            ss.Where = "u.sz_email=@sz_email";
            ss.AddParam("@sz_email", mobile);
            return(ss.ExecuteSingle <UserTdm>());
        }
Пример #5
0
        public UserTdm FindByUserName(IDbSession sess, string username)
        {
            SqlSelect ss = new SqlSelect(sess);

            ss.Sql   = SelectUser;
            ss.Where = "u.sz_uname=@uname";
            ss.AddParam("@uname", username);
            return(ss.ExecuteSingle <UserTdm>());
        }
Пример #6
0
        public List <TextbookTdm> GetAll(IDbSession sess)
        {
            SqlSelect ss = new SqlSelect(sess);

            ss.Sql   = SelectTextBook;
            ss.Where = "nt_r_state=@nt_r_state";
            ss.AddParam("nt_r_state", 1);
            return(ss.ExecuteList <TextbookTdm>());
        }
Пример #7
0
        /// <summary>
        /// For User,Menu And API
        /// </summary>
        /// <param name="sess"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public List <ModuleTdm> GetUserModules(IDbSession sess, long userId)
        {
            string           existsSql = @"
                exists(
	                select mr.ng_mod_id from sys_role_mod_t mr where exists(
		                SELECT ru.ng_role_id from sys_user_role_t ru 
                        where mr.ng_role_id=ru.ng_role_id and ru.ng_user_id=@userId
	                ) and m.ng_id=mr.ng_mod_id
                )";
            List <ModuleTdm> r         = new List <ModuleTdm>();
            SqlSelect        ss        = new SqlSelect(sess);

            ss.Sql     = SelectModule;
            ss.Where   = "m.bn_anonym=true or m.bn_user=true or " + existsSql;
            ss.OrderBy = OrderBy;
            ss.AddParam("@userId", userId);
            return(ss.ExecuteList <ModuleTdm>());
        }