protected void btnSubmit_OnClick(object sender, EventArgs e) { int res = 0; var oArea = new TMSLibrary.Area(); oArea.CityId = Convert.ToInt32(ddlCityName.SelectedItem.Value); oArea.AreaName = txtAreaName.Text; if (_areaId == 0) { res = MasterDataMethods.AddArea(oArea); } else if (_areaId > 0) { oArea.AreaId = _areaId; res = MasterDataMethods.UpdateArea(oArea); } if (res > 0) { ClearInputs(Page.Controls); FillGrid(); _areaId = 0; ValidatePopup("Operation Successfull"); } else { ValidatePopup("Please Try Again"); } }
public static int UpdateArea(Area oArea) { return TMSDataLibrary.MasterData.UpdateArea(oArea.AreaId, oArea.CityId, oArea.AreaName); }
/// <summary> /// Get Area list /// </summary> /// <returns></returns> public static List<Area> GetAllArea() { List<Area> arealist = new List<Area>(); DataTable dt = TMSDataLibrary.MasterData.GetArea(); if (dt.Rows.Count > 0) { int count = dt.Rows.Count; Area area = new Area(); for (int i = 0; i < count; i++) { area = new Area(); area.CityId = Convert.ToInt32(dt.Rows[i][CONSTS.AreaCoiumnIndex.CityId]); area.AreaId = Convert.ToInt32(dt.Rows[i][CONSTS.AreaCoiumnIndex.AreaId]); area.AreaName = (dt.Rows[i][CONSTS.AreaCoiumnIndex.AreaName]).ToString(); area.CityName = (dt.Rows[i][CONSTS.AreaCoiumnIndex.CityName]).ToString(); arealist.Add(area); } } return arealist; }