示例#1
0
        public static MemberLevel GetMemberLevelByID(string levelid)
        {
            if (string.IsNullOrEmpty(levelid))
            {
                return(null);
            }
            var list = GetMemberLevel();

            if (list.Where(m => m.LevelID == levelid).Count() > 0)
            {
                return(list.Where(m => m.LevelID == levelid).FirstOrDefault());
            }
            MemberLevel model = new MemberLevel();
            DataTable   dt    = WebSetDAL.BaseProvider.GetMemberLevelByLevelID(levelid);

            if (dt.Rows.Count > 0)
            {
                model.FillData(dt.Rows[0]);
                list.Add(model);
            }
            return(model);
        }
示例#2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="type">0:会员等级 1 优惠活动</param>
 /// <returns></returns>
 public static List <MemberLevel> GetMemberLevel(int type = 0)
 {
     if (MemberLevelList.Count == 0)
     {
         List <MemberLevel> list = new List <MemberLevel>();
         DataTable          dt   = WebSetDAL.BaseProvider.GetMemberLevel();
         foreach (DataRow dr in dt.Rows)
         {
             MemberLevel model = new MemberLevel();
             model.FillData(dr);
             list.Add(model);
         }
         MemberLevelList.AddRange(list);
     }
     if (type > -1)
     {
         return(MemberLevelList.Where(x => x.Type == type).ToList());
     }
     else
     {
         return(MemberLevelList.ToList());
     }
 }