protected void ViewMember()
        {
            MemberBSO memberBSO = new MemberBSO();
            DataTable table = memberBSO.GetAllMember();

            commonBSO commonBSO = new commonBSO();
            commonBSO.FillToGridView(grvMember, table);
        }
 protected void grvMember_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     string aId = e.CommandArgument.ToString();
     string aName = e.CommandName.ToLower();
     switch (aName)
     {
         case "view":
             Response.Redirect("~/Admin/listorder/" + aId + "/Default.aspx");
             break;
         case "edit":
             Response.Redirect("~/Admin/editmember/" + aId + "/Default.aspx");
             break;
         case "delete":
             MemberBSO memberBSO = new MemberBSO();
             memberBSO.DeleteMember(aId);
             ViewMember();
             break;
     }
 }
        protected void initControl(string userName)
        {
            if (userName != "")
            {
                hddUsername.Value = userName;
                btn_add.Visible = false;
                btn_edit.Visible = true;
                try
                {
                    MemberBSO memberBSO = new MemberBSO();
                    Member member = memberBSO.GetMemberById(userName);

                    hddMemberID.Value = Convert.ToString(member.MemberID);
                    txtUserName.Text = member.UserName;
                    txtUserName.ReadOnly = true;
                    txtEmail.Text = member.Email;
                    txtPassword.Text = member.Password;
                    txtFullName.Text = member.FullName;
                    txtAddress.Text = member.Address;
                    txtBirth.SelectedDate = member.Birth;
                    rdbSex.SelectedValue = member.Sex.ToString();
                    txtNickYahoo.Text = member.NickYahoo;
                    txtNickSkype.Text = member.NickSkype;
                    txtPhone.Text = member.Phone;

                    hddImageThumb.Value = member.Avatar;


                    rdbList.SelectedValue = member.Actived.ToString();
                }
                catch (Exception ex)
                {
                    error.Text = ex.Message.ToString();
                }
            }
            else if (userName == "")
            {
                hddUsername.Value = "";
                btn_add.Visible = true;
                btn_edit.Visible = false;
            }
        }
 protected void btn_edit_Click(object sender, EventArgs e)
 {
     Member member = ReceiveHtml();
     try
     {
         MemberBSO memberBSO = new MemberBSO();
         memberBSO.UpdateMember(member);
         error.Text = String.Format(Resources.StringAdmin.UpdateSuccessful, "quản trị", member.UserName);
     }
     catch (Exception ex)
     {
         error.Text = ex.Message.ToString();
     }
 }
 protected void btn_add_Click(object sender, EventArgs e)
 {
     Member member = ReceiveHtml();
     try
     {
         MemberBSO memberBSO = new MemberBSO();
         if (memberBSO.CheckExist(member.UserName))
         {
             error.Text = String.Format(Resources.StringAdmin.CheckExist, member.UserName);
         }
         else
         {
             memberBSO.CreateMember(member);
             error.Text = String.Format(Resources.StringAdmin.AddNewsSuccessful);
         }
     }
     catch (Exception ex)
     {
         error.Text = ex.Message.ToString();
     }
 }