Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         memVO            = new MemberVO();
         mem              = new DAL.Member();
         memVO            = mem.SelectByUserName(Session["User"].ToString());
         txtUserName.Text = memVO.Username;
         txtFullName.Text = memVO.MemberName;
         if (memVO.Gender == true)
         {
             rdoMale.Checked = true;
         }
         else
         {
             rdoFemale.Checked = true;
         }
         txtDOB.Text     = memVO.Birthday.ToString();
         txtAddress.Text = memVO.Address;
         txtCity.Text    = memVO.City;
         txtPhone.Text   = memVO.PhoneNo;
         txtEmail.Text   = memVO.Email;
     }
     if (Session["User"].ToString() == "")
     {
         Response.Redirect("Default.aspx");
     }
 }
Example #2
0
 protected void btnChange_Click(object sender, EventArgs e)
 {
     try
     {
         bool gender;
         mem = new Member();
         MemberVO memvo = new MemberVO();
         memvo.MemberID = new Member().SelectByUserName(Session["User"].ToString()).MemberID;
         memvo.RoleID   = 2;
         if (rdoMale.Checked)
         {
             memvo.Gender = true;
         }
         else
         {
             memvo.Gender = false;
         }
         memvo.Birthday = DateTime.Parse(txtDOB.Text);
         memvo.Address  = txtAddress.Text;
         memvo.City     = txtCity.Text;
         memvo.PhoneNo  = txtPhone.Text;
         memvo.Email    = txtEmail.Text;
         string status = mem.ChangeProfile(memvo);
         Utilties.Alert.Show(status);
     }
     catch (Exception ex)
     {
         Utilties.Alert.Show("Có lỗi xảy ra:" + ex.Message);
     }
 }
        public Member GetMemberDetails(int memberID)
        {
            Member member = null;

            SqlParameter[] paramaters = new SqlParameter[]
            {
                new SqlParameter("@MemberID", memberID),
            };

            using (DataTable table = DBHelper.ExecuteParamerizedSelectCommand("sp_GetMemberDetails", CommandType.StoredProcedure, paramaters))
            {
                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];

                    member = new Member();

                    member.MemberID = Convert.ToInt32(row["MemberID"]);
                    member.FirstName = row["FirstName"].ToString();
                    member.Surname = row["Surname"].ToString();
                    member.AddressLine1 = row["AddressLine1"].ToString();
                    member.AddressLine2 = row["AddressLine2"].ToString();
                    member.Suburb = row["Suburb"].ToString();
                    member.PostalCode = row["PostalCode"].ToString();
                    member.City = row["City"].ToString();
                    member.PhoneNo = row["PhoneNo"].ToString();
                    member.Email = row["Email"].ToString();
                    member.Role = Convert.ToInt32(row["Role"]);
                }
            }
            return member;
        }
Example #4
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        DAL.Member mem  = new DAL.Member();
        string     user = Utilties.Toollist.removeSpecialCharacters(txtUserName.Text);
        string     pass = Utilties.Toollist.removeSpecialCharacters(txtPassword.Text);

        if (mem.CheckLoginUser(user, pass))
        {
            Session["User"] = user;
            Response.Redirect("Default.aspx");
        }
        else
        {
            lblMessage.Text = "<br>Tài khoản hoặc mật khẩu không đúng.";
            return;
        }
    }
    protected void btnChange_Click(object sender, EventArgs e)
    {
        string old     = Toollist.removeSpecialCharacters(txtPassword.Text);
        string newpass = Toollist.removeSpecialCharacters(txtConfirmNewPassword.Text);

        if (txtNewPassword.Text.Trim() != txtConfirmNewPassword.Text.Trim())
        {
            Utilties.Alert.Show("Xác nhận mật khẩu không đúng.");
            return;
        }
        else
        {
            string email     = new Member().getEmailByUserName(txtUserName.Text);
            string strresult = new DAL.Member().ChangePassword(old, newpass, Session["User"].ToString());
            new Email().Send_Email(email, "Bạn đã đổi password thành công.", "Bạn đã đổi mật khẩu thành công");
            Utilties.Alert.Show(strresult);
        }
    }
        public bool AddNewMember(Member member)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@Email", member.Email),
                new SqlParameter("@Password", member.Password),
                new SqlParameter("@FirstName", member.FirstName),
                new SqlParameter("@Surname", member.Surname),
                new SqlParameter("@AddressLine1", member.AddressLine1),
                new SqlParameter("@AddressLine2", member.AddressLine2),
                new SqlParameter("@Suburb", member.Suburb),
                new SqlParameter("@PostalCode", member.PostalCode),
                new SqlParameter("@City", member.City),
                new SqlParameter("@PhoneNo", member.PhoneNo)
            };

            return DBHelper.ExecuteNonQuery("sp_AddNewMember", CommandType.StoredProcedure, parameters);
        }
        public List<Member> GetMemberNameList()
        {
            List<Member> listMembers = null;

            using (DataTable table = DBHelper.ExecuteSelectCommand("sp_GetMemberNameList", CommandType.StoredProcedure))
            {
                if (table.Rows.Count > 0)
                {
                    listMembers = new List<Member>();

                    foreach (DataRow row in table.Rows)
                    {
                        Member member = new Member();
                        member.MemberID = Convert.ToInt32(row["MemberID"]);
                        member.Name = row["Name"].ToString();

                        listMembers.Add(member);
                    }
                }
            }

            return listMembers;
        }
Example #8
0
 public Member()
 {
     d_Member = new DAL.Member();
 }
        public List<Member> GetMemberSearchList(string searchQuery)
        {
            List<Member> listMembers = null;

            SqlParameter[] paramaters = new SqlParameter[]
            {
                new SqlParameter("@SearchQuery", searchQuery),
            };

            using (DataTable table = DBHelper.ExecuteParamerizedSelectCommand("sp_GetMemberSearchList", CommandType.StoredProcedure, paramaters))
            {
                if (table.Rows.Count > 0)
                {
                    listMembers = new List<Member>();

                    foreach (DataRow row in table.Rows)
                    {
                        Member member = new Member();
                        member.MemberID = Convert.ToInt32(row["MemberID"]);
                        member.Name = row["Name"].ToString();

                        listMembers.Add(member);
                    }
                }
            }

            return listMembers;
        }
        public Member ValidateLogin(string email, string password)
        {
            Member member = null;

            SqlParameter[] paramaters = new SqlParameter[]
            {
                new SqlParameter("@Email", email),
                new SqlParameter("@Password", password)
            };

            using (DataTable table = DBHelper.ExecuteParamerizedSelectCommand("sp_ValidateLogin", CommandType.StoredProcedure, paramaters))
            {
                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];

                    member = new Member();

                    member.MemberID = Convert.ToInt32(row["MemberID"]);
                    member.FirstName = row["FirstName"].ToString();
                    member.Surname = row["Surname"].ToString();
                    member.Role = Convert.ToInt32(row["Role"]);
                }
            }
            return member;
        }
        public Member ValidateEmail(string email)
        {
            Member member = null;

            SqlParameter[] paramaters = new SqlParameter[]
            {
                new SqlParameter("@Email", email)
            };

            using (DataTable table = DBHelper.ExecuteParamerizedSelectCommand("sp_ValidateEmail", CommandType.StoredProcedure, paramaters))
            {
                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];

                    member = new Member();

                    member.Email = row["Email"].ToString();
                }
            }
            return member;
        }
 public bool UpdateMemberPassword(Member member)
 {
     SqlParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@Email", member.Email),
         new SqlParameter("@Password", member.Password)
     };
     return DBHelper.ExecuteNonQuery("sp_UpdateMemberPassword", CommandType.StoredProcedure, parameters);
 }