private void BindData()
        {
            BSO.PhoneBookBSO objBSO = new PhoneBookBSO();
            DataTable dtb = objBSO.GetDetial(Id);
            if (dtb != null)
            {
                if (dtb.Rows.Count > 0)
                {
                    txtFullName.Text = dtb.Rows[0]["FullName"].ToString();
                    txtHomePhone.Text = dtb.Rows[0]["HomePhone"].ToString();
                    txtofficePhone.Text = dtb.Rows[0]["officePhone"].ToString();

                    txtPhone1.Text = dtb.Rows[0]["Phone1"].ToString();
                    txtPhone2.Text = dtb.Rows[0]["Phone2"].ToString();
                    txtAddress.Text = dtb.Rows[0]["Address"].ToString();
                    txtEmail.Text = dtb.Rows[0]["Email"].ToString();
                    txtOrder.Text = dtb.Rows[0]["Orders"].ToString();
                    try
                    {
                        if (dtb.Rows[0]["ParentId"].ToString() != "0")
                        {
                            ddlDepartment.SelectedValue = dtb.Rows[0]["ParentId"].ToString();
                        }
                    }
                    catch { }

                }
            }
        }
 private void BindData()
 {
     BSO.PhoneBookBSO objBSO = new PhoneBookBSO();
     DataTable dtb = objBSO.MixPhoneBook();
     if (dtb != null)
     {
         grvPhoneBook.DataSource = dtb;
         grvPhoneBook.DataBind();
     }
 }
        protected void btn_Order_Click(object sender, ImageClickEventArgs e)
        {
            foreach (GridViewRow row in grvPhoneBook.Rows)
            {
                TextBox textOrder = (TextBox)row.FindControl("txtOrder");
                int cOrder = Convert.ToInt32(textOrder.Text);
                int ID = Convert.ToInt32(row.Cells[0].Text);

                BSO.PhoneBookBSO objBSO = new PhoneBookBSO();
                objBSO.PhoneBookUpOrder(ID, cOrder);

            }
            BindData();
        }
 protected void grvContact_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     int Id = Convert.ToInt32(e.CommandArgument.ToString());
     string cName = e.CommandName.ToLower();
     switch (cName)
     {
         case "_edit":
             Response.Redirect("~/Admin/editphonebook/" + Id + "/Default.aspx");
             break;
         case "_delete":
             BSO.PhoneBookBSO objBSO = new PhoneBookBSO();
             objBSO.Delete(Id);
             BindData();
             break;
     }
 }
        private void GetDepartMent()
        {
            BSO.PhoneBookBSO objBSO = new PhoneBookBSO();
            DataTable dtb = objBSO.GetDepartMent();
            if (dtb != null)
            {
                ddlDepartment.DataSource = dtb;
                ddlDepartment.DataTextField = "FullName";
                ddlDepartment.DataValueField = "id";
                ddlDepartment.DataBind();
                ddlDepartment.Items.Insert(0, "----- Chọn ------ ");

            }
        }
 protected void btn_edit_Click(object sender, EventArgs e)
 {
     try
     {
         PhoneBook obj = SetData();
         obj.Id = Id;
         BSO.PhoneBookBSO objBSO = new PhoneBookBSO();
         objBSO.UpdatePhoneBook(obj);
         GetDepartMent();
         clientview.Text = String.Format(Resources.StringAdmin.AddNewsSuccessful);
     }
     catch
     { }
 }