protected void btnSave_Click(object sender, EventArgs e) { if (btnSave.Text == "تعديل") { // Update case Organization org = new Organization(); org.LoadByPrimaryKey(CurrentOrgID); org.GoveID = short.Parse(drpState.SelectedValue); org.PoliceID = int.Parse(dropSection.SelectedValue); org.AreaID = int.Parse(drpSubSection.SelectedValue); if (drpMainOrg.SelectedValue != "0") org.OrgParentID = new Guid(drpMainOrg.SelectedValue); else org.OrgParentID = Guid.Empty; org.OrgDescription = txtOfficeName.Text; org.OrgType = chkISOfficeInTown.Checked; org.Save(); txtOfficeName.Text = ""; drpMainOrg.SelectedIndex = 0; btnSave.Text = "اضافة"; Filter(); } else { //insert case Organization org = new Organization(); org.AddNew(); org.GoveID = short.Parse(drpState.SelectedValue); org.PoliceID = int.Parse(dropSection.SelectedValue); org.AreaID = int.Parse(drpSubSection.SelectedValue); if (drpMainOrg.SelectedValue != "0") org.OrgParentID = new Guid(drpMainOrg.SelectedValue); else org.OrgParentID = Guid.Empty; org.OrgDescription = txtOfficeName.Text; org.OrgType = chkISOfficeInTown.Checked; org.Save(); txtOfficeName.Text = ""; drpMainOrg.SelectedIndex = 0; Filter(); } loadMainOffices(); }