public override void DeleteItemData(object value) { XapDataList <EmsOrDrug> itemList = this.GetTableDataSource() as XapDataList <EmsOrDrug>; if (itemList.Count(p => !p.IsDELETED) > 0) { EmsOrDrug item = value as EmsOrDrug; itemList.Delete(item, item.IsNEW); } // 如果模型中数据列表为空,则新建一个空数据 if (GetCountWithOutDelete() == 0) { SetSelectedObject(AddNew()); this.uiEmsDTO.Emsdrugs.Fg_self = null; this.uiEmsDTO.Emsdrugs.Fg_selfpay = null; this.uiEmsDTO.Emsdrugs.Fg_treat = null; this.uiEmsDTO.Emsdrugs.Fg_propc = null; this.uiEmsDTO.Emsdrugs.Fg_mp_in = null; this.uiEmsDTO.Emsdrugs.Id_routedes = null; this.uiEmsDTO.Emsdrugs.Name_routedes = null; this.uiEmsDTO.Emsdrugs.Note_or = null; } // 当前选中对象为最后一个可显示的有效数据 else { SetSelectedObject(itemList.LastOrDefault(p => !p.IsDELETED)); } }
public virtual ExpenseModel DeleteRow(EmsOrDrug eod) { if (eod != null && tableDataSource != null) { tableDataSource.Delete(eod, eod.IsNEW); } return(this); }