public override void FillSelectedRecordInContent(object RecordToFill) { DAL.tblCity EditingRecord = DALObject.FindSaveModelByPrimeKey(((Model.City.CityEditListModel)RecordToFill).CityID); txtCityName.Text = EditingRecord.CityName; //lookupCityType.EditValue = EditingRecord.CityType; //lookupTehsil.EditValue = EditingRecord.TehsilID; //lookupDistrict.EditValue = EditingRecord.DistrictID; lookupState.EditValue = EditingRecord.StateID; //txtPIN.Text = EditingRecord.PIN; //txtSTDCode.Text = EditingRecord.STDCode; }
public override void SaveRecord(Model.SavingParemeter Paras) { DAL.tblCity SaveModel = null; if (Paras.SavingInterface == SavingParemeter.eSavingInterface.AddNew || EditRecordDataSource == null) { SaveModel = new DAL.tblCity(); } else { SaveModel = DALObject.FindSaveModelByPrimeKey(((Model.City.CityEditListModel)EditRecordDataSource).CityID); if (SaveModel == null) { Paras.SavingResult = new SavingResult(); Paras.SavingResult.ExecutionResult = eExecutionResult.ValidationError; Paras.SavingResult.ValidationError = "Can not edit. Selected record not found, it may be deleted by another user."; return; } } SaveModel.CityName = txtCityName.Text; //eCityType CityType = (eCityType)lookupCityType.EditValue; //SaveModel.CityType = (int)lookupCityType.EditValue; //SaveModel.TehsilID = (CityType == eCityType.Town ? (int?)lookupTehsil.EditValue : null); //SaveModel.DistrictID = (CityType == eCityType.Town || CityType == eCityType.Tehsil ? (int?)lookupDistrict.EditValue : null); if (lookupState.EditValue != null) { SaveModel.StateID = (int)lookupState.EditValue; } else { SaveModel.StateID = null; } //SaveModel.PIN = txtPIN.Text; //SaveModel.STDCode = txtSTDCode.Text; Paras.SavingResult = DALObject.SaveNewRecord(SaveModel); base.SaveRecord(Paras); }