Example #1
0
        /// <summary>
        /// 清空会员的手机验证码
        /// </summary>
        /// <param name="icode"></param>
        /// <param name="time"></param>
        public static void ClearIdentifyingCode(long memberID)
        {
            tb_Mem_Member member = BizMember.GetMemberByID(memberID);

            member.RegIdentifyingCode = null;
            DataContext.SaveChanges();
        }
Example #2
0
        /// <summary>
        /// 根据会员ID验证支付密码
        /// </summary>
        /// <param name="payPW">支付密码</param>
        /// <returns></returns>
        public static bool ValidatePayPW(long memberID, string payPW)
        {
            tb_Mem_Member member = BizMember.GetMemberByID(memberID);
            string        code   = Hash(payPW, member.MemberID);

            return((code == member.PayPas) ? true : false);
        }
Example #3
0
        /// <summary>
        /// 获得该会员可以访问的所有页面
        /// </summary>
        /// <param name="memberID"></param>
        /// <returns></returns>
        public static List <tb_Pages> GetMemberPages(long memberID)
        {
            var             permissions = BizMember.GetMemberByID(memberID).tb_Permissions;
            List <tb_Pages> pages       = new List <tb_Pages>();

            foreach (tb_Permissions per in permissions)
            {
                pages.Add(per.tb_Pages);
            }
            return(pages);
        }
Example #4
0
        /// <summary>
        /// 获取该员工的所有角色
        /// </summary>
        /// <param name="memberID"></param>
        /// <returns></returns>
        public static List <tb_Roles> GetMemberRoles(long memberID)
        {
            var             roles     = BizMember.GetMemberByID(memberID).tb_MemberInRoles;
            List <tb_Roles> bindroles = new List <tb_Roles>();

            foreach (tb_MemberInRoles r in roles)
            {
                bindroles.Add(r.tb_Roles);
            }
            return(bindroles);
        }
Example #5
0
 /// <summary>
 /// 上传会员头像
 /// </summary>
 /// <param name="buffer"></param>
 /// <param name="memberID"></param>
 public static void UploadPhoto(byte[] buffer, long memberID)
 {
     try
     {
         tb_Mem_Member member = BizMember.GetMemberByID(memberID);
         member.Image = buffer;
         DataContext.SaveChanges();
     }
     catch (Exception ex)
     {
         LogHelper.g_Logger.ErrorFormat("上传头像失败!错误信息:{0}", ex.Message);
         throw ex;
     }
 }
Example #6
0
 /// <summary>
 /// 管理员修改个人人会员状态
 /// </summary>
 /// <param name="status"></param>
 public static void UpdateByAdmin(long memberID, short status)
 {
     try
     {
         tb_Mem_Member member = BizMember.GetMemberByID(memberID);
         member.Status = status;
         DataContext.SaveChanges();
     }
     catch (Exception ex)
     {
         LogHelper.g_Logger.ErrorFormat("修改会员状态失败!错误信息:{0}", ex.Message);
         throw ex;
     }
 }
Example #7
0
 /// <summary>
 /// 修改支付密码
 /// </summary>
 /// <param name="NewPayPW">新的支付密码</param>
 public static void ChangePayPW(long memberID, string newPayPW)
 {
     try
     {
         tb_Mem_Member member = BizMember.GetMemberByID(memberID);
         member.PayPas = Hash(newPayPW, member.MemberID);
         DataContext.SaveChanges();
     }
     catch (Exception ex)
     {
         LogHelper.g_Logger.ErrorFormat("修改支付密码失败!错误信息:{0}", ex.Message);
         throw ex;
     }
 }
Example #8
0
 /// <summary>
 /// 生成手机验证码,并设置该验证码的有效期限
 /// </summary>
 /// <param name="icode"></param>
 /// <param name="time"></param>
 public static void AddRegIdentifyingCode(string icode, long memberID)
 {
     try
     {
         tb_Mem_Member member = BizMember.GetMemberByID(memberID);
         member.ValidTime          = DateTime.Now.AddMinutes(30);
         member.RegIdentifyingCode = icode;
         DataContext.SaveChanges();
     }
     catch (Exception ex)
     {
         LogHelper.g_Logger.ErrorFormat("获取手机验证码失败!错误信息:{0}", ex.Message);
         throw ex;
     }
 }
Example #9
0
 /// <summary>
 /// 为个人会员分配系统默认的个人会员角色
 /// </summary>
 /// <param name="memberID">会员ID</param>
 public static void AddMemberToDefaultRole(long memberID)
 {
     try
     {
         tb_Mem_Member    member     = BizMember.GetMemberByID(memberID);
         tb_MemberInRoles memberRole = new tb_MemberInRoles();
         memberRole.RoleID = (long)RoleType.PersonalMember;
         member.tb_MemberInRoles.Add(memberRole);
         DataContext.SaveChanges();
     }
     catch (Exception ex)
     {
         LogHelper.g_Logger.ErrorFormat("授予会员角色失败!错误信息:{0}", ex.Message);
         throw ex;
     }
 }
Example #10
0
 /// <summary>
 /// 授予会员访问一个或多个页面的权限
 /// </summary>
 /// <param name="memberID"></param>
 /// <param name="pageIDList"></param>
 public static void AddMemberPages(long memberID, List <long> pageIDList)
 {
     try
     {
         tb_Mem_Member member = BizMember.GetMemberByID(memberID);
         foreach (long id in pageIDList)
         {
             tb_Permissions p = new tb_Permissions();
             p.PageID = id;
             member.tb_Permissions.Add(p);
         }
         DataContext.SaveChanges();
     }
     catch (Exception ex)
     {
         LogHelper.g_Logger.ErrorFormat("授予会员权限失败!错误信息:{0}", ex.Message);
         throw ex;
     }
 }
Example #11
0
 /// <summary>
 /// 解除会员访问某些页面的权限
 /// </summary>
 /// <param name="memberID"></param>
 /// <param name="pageIDList"></param>
 public static void RemoveMemberPages(long memberID, List <long> pageIDList)
 {
     try
     {
         tb_Mem_Member member = BizMember.GetMemberByID(memberID);
         foreach (long id in pageIDList)
         {
             tb_Permissions p = member.tb_Permissions.Where(t => t.PageID == id).First();
             member.tb_Permissions.Remove(p);
             DataContext.tb_Permissions.DeleteObject(p);
         }
         DataContext.SaveChanges();
     }
     catch (Exception ex)
     {
         LogHelper.g_Logger.ErrorFormat("解除会员权限失败!错误信息:{0}", ex.Message);
         throw ex;
     }
 }
Example #12
0
 /// <summary>
 /// 同时解除个人会员的多个角色
 /// </summary>
 /// <param name="memberID">会员ID</param>
 /// <param name="roleIDList">角色ID数组</param>
 public static void RemoveMemberFromRoles(long memberID, List <long> roleIDList)
 {
     try
     {
         tb_Mem_Member member = BizMember.GetMemberByID(memberID);
         foreach (long id in roleIDList)
         {
             tb_MemberInRoles memberRole = member.tb_MemberInRoles.Where(t => t.RoleID == id).First();
             member.tb_MemberInRoles.Remove(memberRole);
             DataContext.tb_MemberInRoles.DeleteObject(memberRole);
         }
         DataContext.SaveChanges();
     }
     catch (Exception ex)
     {
         LogHelper.g_Logger.ErrorFormat("解除会员角色失败!错误信息:{0}", ex.Message);
         throw ex;
     }
 }
Example #13
0
 /// <summary>
 /// 同时为个人会员分配多个角色
 /// </summary>
 /// <param name="memberID">会员ID</param>
 /// <param name="roleIDList">角色ID数组</param>
 public static void AddMemberToRoles(long memberID, List <long> roleIDList)
 {
     try
     {
         tb_Mem_Member member = BizMember.GetMemberByID(memberID);
         foreach (long id in roleIDList)
         {
             tb_MemberInRoles memberRole = new tb_MemberInRoles();
             memberRole.RoleID = id;
             member.tb_MemberInRoles.Add(memberRole);
             BizRole.GetRoleByID(id).tb_MemberInRoles.Add(memberRole);
         }
         DataContext.SaveChanges();
     }
     catch (Exception ex)
     {
         LogHelper.g_Logger.ErrorFormat("授予会员角色失败!错误信息:{0}", ex.Message);
         throw ex;
     }
 }
Example #14
0
 /// <summary>
 /// 获取会员头像文件
 /// </summary>
 /// <param name="memberID"></param>
 /// <returns></returns>
 public static byte[] GetMemberPhoto(long memberID)
 {
     return(BizMember.GetMemberByID(memberID).Image);
 }
Example #15
0
 public static short GetMemberType(long memberID)
 {
     return((short)BizMember.GetMemberByID(memberID).MemberType);
 }