public List <Member> GetMembersByRoleAndStatus(UserRoles role, MemberStatus status)
        {
            string strStatus = status.ToString();
            string strRole   = role.ToString();

            return(_repository.GetQuery <Member>(m => m.Status == strStatus && m.Roles.Any(r => r.Name == strRole))
                   .Include(m => m.Login)
                   .ToList());
        }
        public List <Member> GetClubMembersByStatus(MemberStatus status)
        {
            string strStatus = status.ToString();

            return(_repository.GetQuery <Member>()
                   .Where(m => m.Status == strStatus)
                   .Include(m => m.Login)
                   .ToList());
        }
Beispiel #3
0
    public static string GetColoredStatus(MemberStatus Status)
    {
        if (Status == MemberStatus.Active)
        {
            return("<span class=\"text-success\">" + Status.ToString() + "</span>");
        }

        if (Status == MemberStatus.AwaitingSMSPIN || Status == MemberStatus.VacationMode)
        {
            return("<span class=\"text-warning\">" + Status.ToString() + "</span>");
        }

        if (Status == MemberStatus.Cancelled || Status == MemberStatus.Expired || Status == MemberStatus.Inactive)
        {
            return("<span class=\"text-danger\">" + Status.ToString() + "</span>");
        }

        return("<span class=\"text-danger\">" + Status.ToString() + "</span>");
    }
Beispiel #4
0
        /// <summary>
        /// 更新用户状态
        /// </summary>
        /// <param name="id">用户id</param>
        /// <param name="status">更改后的状态</param>
        /// <returns></returns>
        static public bool UpdateMemberStatus(string id, MemberStatus status)
        {
            MySqlCommand cmd = null;
            try
            {
                string sql = String.Format("update tblMember set status=?status where id=?id");
                cmd = new MySqlCommand(sql, Conn);
                cmd.Parameters.AddWithValue("id", id);
                cmd.Parameters.AddWithValue("status", status.ToString());
                Prepare(cmd.Parameters);
                int i = cmd.ExecuteNonQuery();

                return i == 1;

            }
            catch (Exception e)
            {
                MyLogger.Logger.Error("更新状态出现错误\n", e);
                return false;
            }
            finally
            {
                if (cmd != null)
                    cmd.Dispose();

            }
        }
        public List<Member> GetMembersByRoleAndStatus(UserRoles role, MemberStatus status)
        {
            string strStatus = status.ToString();
            string strRole = role.ToString();

            return _repository.GetQuery<Member>(m => m.Status == strStatus && m.Roles.Any(r => r.Name == strRole))
                .Include(m => m.Login)
                .ToList();
        }
 public List<Member> GetClubMembersByStatus(MemberStatus status)
 {
     string strStatus = status.ToString();
     return _repository.GetQuery<Member>()
         .Where(m => m.Status == strStatus)
         .Include(m => m.Login)
         .ToList();
 }
Beispiel #7
0
        public MemberBO SaveInfo()
        {
            IMemberService memberService = new MemberService();
            MemberBO       member        = memberService.GetMember(this.MemeberId);

            if (member != null)
            {
                member.UserName     = txtUserName.Text;
                member.DepartmentId = int.Parse(ddlDepartment.SelectedValue);
                member.FullName     = txtFullName.Text;
                member.Address      = txtAdress.Text;
                member.Telephone    = txtTelephone.Text;
                member.Email        = txtEmail.Text;
                member.RoleTypeId   = int.Parse(ddlRoleType.SelectedValue);
                member.LastEditedOn = DateTime.Now;
                memberService.UpdateMember(member);
            }
            else
            {
                member = new MemberBO()
                {
                    UserName     = txtUserName.Text,
                    Password     = txtPassword.Text,
                    FullName     = txtFullName.Text,
                    Address      = txtAdress.Text,
                    Telephone    = txtTelephone.Text,
                    Email        = txtEmail.Text,
                    RoleTypeId   = int.Parse(ddlRoleType.SelectedValue),
                    CreatedOn    = DateTime.Now,
                    DepartmentId = int.Parse(ddlDepartment.SelectedValue)
                };
                MemberStatus status = MemberStatus.Success;
                member.UserId = memberService.InsertMember(member, out status);

                if (status != MemberStatus.Success)
                {
                    throw new InthudoException(string.Format("Không thể tạo user: {0}", status.ToString()));
                }
            }
            return(member);
        }