Exemplo n.º 1
0
        public static List <M_Users> GetUsersRelationList(int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string userid, int type = -1, int status = -1, string keyWords = "", string colmonasc = "a.AutoID", bool isasc = false,
                                                          string rebatemin = "", string rebatemax = "", string accountmin = "", string accountmax = "", bool myselft = false)
        {
            string whereSql = " where a.layers>0 and a.Status<>9  ";

            if (!string.IsNullOrEmpty(rebatemax))
            {
                whereSql += " and a.Rebate<='" + rebatemax + "' ";
            }
            if (!string.IsNullOrEmpty(rebatemin))
            {
                whereSql += " and a.Rebate>'" + rebatemin + "' ";
            }
            if (type > -1)
            {
                whereSql += " and a.type=" + type + " ";
            }
            if (!string.IsNullOrEmpty(accountmax))
            {
                whereSql += " and b.AccountFee<='" + accountmax + "' ";
            }
            if (!string.IsNullOrEmpty(accountmin))
            {
                whereSql += " and b.AccountFee>'" + accountmin + "' ";
            }
            if (status > -1)
            {
                whereSql += " and a.Status=" + status;
            }
            if (!string.IsNullOrEmpty(keyWords))
            {
                whereSql += " and (a.UserName like '%" + keyWords + "%' or a.LoginName like'%" + keyWords + "%') ";
            }
            string orswhere = "";

            if (!string.IsNullOrEmpty(userid))
            {
                orswhere = " and ( c.ParentID='" + userid + "' " + (myselft ? " or a.userid='" + userid + "'" : "") + " ) ";;
            }

            string         clumstr = " select  a.*,b.AccountFee  from M_Users a join UserAccount b on a.UserID=b.Userid join UserRelation c on a.UserID=c.UserID  " + orswhere + " " + whereSql;
            DataTable      dt      = M_UsersDAL.GetDataTable(clumstr);
            List <M_Users> list    = new List <M_Users>();
            M_Users        model;

            foreach (DataRow item in dt.Rows)
            {
                model = new M_Users();
                model.FillData(item);
                list.Add(model);
            }

            return(list);
        }
Exemplo n.º 2
0
        public static Product GetProductDetail(int id)
        {
            DataTable dt = M_UsersDAL.GetDataTable("select  *  from products where autoid=" + id);
            Product   pt = new Product();

            foreach (DataRow row in dt.Rows)
            {
                pt.FillData(row);
            }
            return(pt);
        }
Exemplo n.º 3
0
        public static UserAccount GetUserAccount(string id)
        {
            string      clumstr = " select a.*  from UserAccount a where  a.UserID='" + id + "'";
            DataTable   dt      = M_UsersDAL.GetDataTable(clumstr);
            UserAccount model   = new UserAccount();

            foreach (DataRow item in dt.Rows)
            {
                model.FillData(item);
            }
            return(model);
        }
Exemplo n.º 4
0
        public static M_UserRelation GetParentByChildID(string childID)
        {
            string    clumstr = " select  c.*,a.UserName  from M_Users a join UserRelation c on a.UserID=c.UserID and  c.UserID='" + childID + "' where a.Status<>9";
            DataTable dt      = M_UsersDAL.GetDataTable(clumstr);

            M_UserRelation model = new M_UserRelation();

            foreach (DataRow item in dt.Rows)
            {
                model.FillData(item);
            }

            return(model);
        }
Exemplo n.º 5
0
        public static M_Users GetUserDetailByLoginName(string loginName)
        {
            DataTable dt = M_UsersDAL.GetDataTable("select *  from M_Users where Status<>9 and LoginName='" + loginName + "'");

            M_Users model = null;

            if (dt.Rows.Count == 1)
            {
                model = new M_Users();
                model.FillData(dt.Rows[0]);
            }

            return(model);
        }
Exemplo n.º 6
0
        public static List <M_UserRelation> GetUsersListByParent(string parentid)
        {
            string                clumstr = " select  c.*,a.UserName  from M_Users a join UserRelation c on a.UserID=c.UserID and  c.ParentID='" + parentid + "' where a.layers>0 and a.Status<>9";
            DataTable             dt      = M_UsersDAL.GetDataTable(clumstr);
            List <M_UserRelation> list    = new List <M_UserRelation>();
            M_UserRelation        model;

            foreach (DataRow item in dt.Rows)
            {
                model = new M_UserRelation();
                model.FillData(item);
                list.Add(model);
            }

            return(list);
        }
Exemplo n.º 7
0
        public static List <M_Users> GetUsersRelationList(string userid, bool myselft = false)
        {
            string         whereSql = myselft ? " or a.userid='" + userid + "'" : "";
            string         clumstr  = " select  a.*  from M_Users a join UserRelation c on a.UserID=c.UserID and ( c.ParentID='" + userid + "' " + whereSql + "  ) where a.layers>0 and a.Status<>9";
            DataTable      dt       = M_UsersDAL.GetDataTable(clumstr);
            List <M_Users> list     = new List <M_Users>();
            M_Users        model;

            foreach (DataRow item in dt.Rows)
            {
                model = new M_Users();
                model.FillData(item);
                list.Add(model);
            }

            return(list);
        }