protected void btnSave_Click(object sender, EventArgs e)
    {
        health_office objHo = new health_office();
        if (txtHealthOfficeCode.ReadOnly)
        {
            // update case
            objHo.LoadByPrimaryKey(int.Parse(txtHealthOfficeCode.Text));
            objHo.HEALTHDESCR = txtHealthOfficeName.Text;
            objHo.CIVILCD = int.Parse(drpCivilOffice.SelectedValue);
            objHo.CIVILDESCR = drpCivilOffice.SelectedItem.Text;
            objHo.POLICECD = int.Parse(drpPoliceStation.SelectedValue);
            objHo.AREACD = int.Parse(dropArea.SelectedValue);
            objHo.IsTown = chkIsTown.Checked;

            objHo.Save();
            txtHealthOfficeCode.ReadOnly = false;
            Filter();
            //txtFilter.Text = "";
            txtHealthOfficeCode.Text = "";
            txtHealthOfficeName.Text = "";
            drpGove.Enabled = true;
            drpCivilOffice.Enabled = true;
            chkIsTown.Checked = false;
            drpPoliceStation.SelectedIndex = 0;
            dropArea.SelectedIndex = 0;
            btnSave.Text = "اضافة";
        }
        else
        {
            try
            {
                //Insert case
                objHo.AddNew();
                objHo.HEALTHCD = int.Parse(txtHealthOfficeCode.Text);
                objHo.HEALTHDESCR = txtHealthOfficeName.Text;
                objHo.CIVILCD = int.Parse(drpCivilOffice.SelectedValue);
                objHo.CIVILDESCR = drpCivilOffice.SelectedItem.Text;
                objHo.POLICECD = int.Parse(drpPoliceStation.SelectedValue);
                objHo.AREACD = int.Parse(dropArea.SelectedValue);
                objHo.IsTown = chkIsTown.Checked;

                objHo.Save();
                Filter();
                //txtFilter.Text = "";
                txtHealthOfficeCode.Text = "";
                txtHealthOfficeName.Text = "";
                drpGove.Enabled = true;
                chkIsTown.Checked = false;
                drpCivilOffice.Enabled = true;
                drpPoliceStation.SelectedIndex = 0;
                dropArea.SelectedIndex = 0;
            }
            catch
            {
                MHOCommon.ShowMessage("لقد حاولت ادخال كود موجود اوهناك خطأ فى البيانات", this.Page);
            }
        }
    }
 /// <summary>
 /// Link Gove code click handler
 /// to allow edit this gov
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void lnkDelete_Click(object sender, EventArgs e)
 {
     LinkButton lnk = (LinkButton)sender;
     health_office delarea = new health_office();
     delarea.LoadByPrimaryKey(int.Parse(lnk.CommandArgument));
     delarea.MarkAsDeleted();
     delarea.Save();
     Filter();
 }