protected void btnSave_Click(object sender, EventArgs e)
 {
     CIVIL_OFFICE objpolice = new CIVIL_OFFICE();
     if (txtCivilCode.ReadOnly)
     {
         try
         {
             // update case
             objpolice.LoadByPrimaryKey(short.Parse(txtCivilCode.Text));
             objpolice.DESCR = txtCivilName.Text;
             objpolice.FK_GOVCD = short.Parse(drpGove.SelectedValue);
             objpolice.Save();
             txtCivilCode.ReadOnly = false;
             Filter();
             //txtFilter.Text = "";
             txtCivilCode.Text = "";
             txtCivilName.Text = "";
             btnSave.Text = "اضافة";
         }
         catch
         {
             MHOCommon.ShowMessage("لقد حاولت ادخال اسم ادارة موجود من قبل", this.Page);
         }
     }
     else
     {
         try
         {
             //Insert case
             objpolice.AddNew();
             objpolice.CD = short.Parse(txtCivilCode.Text);
             objpolice.DESCR = txtCivilName.Text;
             objpolice.FK_GOVCD = short.Parse(drpGove.SelectedValue);
             objpolice.Save();
             Filter();
             //txtFilter.Text = "";
             txtCivilCode.Text = "";
             txtCivilName.Text = "";
         }
         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;
     CIVIL_OFFICE delpolice = new CIVIL_OFFICE();
     delpolice.LoadByPrimaryKey(short.Parse(lnk.CommandArgument));
     delpolice.MarkAsDeleted();
     delpolice.Save();
     Filter();
 }