/// <summary> /// Save location related information /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSaveLocation_Click(object sender, EventArgs e) { if (_locationType == "Reg") { BLL.Region reg = new BLL.Region(); if (_locId != 0) reg.LoadByPrimaryKey(_locId); else reg.AddNew(); reg.RegionName = cboRegion.Text; reg.RegionCode = txtCode.Text; reg.Save(); } else if (_locationType == "Zon") { Zone zn = new Zone(); if (_locId != 0) zn.LoadByPrimaryKey(_locId); else zn.AddNew(); zn.ZoneName = cboZone.Text; zn.RegionId = Convert.ToInt32(cboRegion.SelectedValue); zn.ZoneCode = txtCode.Text; zn.Save(); } else if (_locationType == "Wrd") { Woreda wrd = new Woreda(); if (_locId != 0) wrd.LoadByPrimaryKey(_locId); else wrd.AddNew(); wrd.WoredaName = cboWoreda.Text; wrd.ZoneID = Convert.ToInt32(cboZone.SelectedValue); wrd.WoredaCode = txtCode.Text; wrd.Save(); } PopulateLocationTree(); }