protected override void BtnSave_Click(object sender, EventArgs e) { List <StaffClassVo> staffOldInfoList = SelectDao.SelectData <StaffClassVo>(); List <StaffClassVo> changeList = GenericUtil.GetChanges(classList, staffOldInfoList); int result = 0; if (!CheckParam(changeList)) { return; } foreach (StaffClassVo vo in changeList) { if (SelectDao.IsRepeatedClassId(vo.StaffClassID)) { //更新 result = UpdateDao.UpdateByID(vo); if (result <= 0) { XtraMessageBox.Show(vo.StaffClassID + "更新失败!"); break; } } else { vo.CompanyId = SystemConst.companyId; result = InsertDao.InsertData(vo); if (result <= 0) { XtraMessageBox.Show(vo.StaffClassID + "保存失败!"); break; } } } XtraMessageBox.Show("保存成功!"); }