public override void Save() { if (Check() == false) { return; } _entity = new FishEntity.CallRecordsEntity(); GetCallRecordFromUI(); _entity.createman = FishEntity.Variable.User.username; _entity.modifyman = _entity.createman; _entity.createtime = DateTime.Now; _entity.modifytime = _entity.createtime; _entity.code = FishBll.Bll.SequenceUtil.GetCallRecordSequence(); while (_bll.Exists(_entity.code)) { _entity.code = FishBll.Bll.SequenceUtil.GetCallRecordSequence(); } int id = _bll.Add(_entity); if (id > 0) { _entity.id = id; txtCode.Text = _entity.code; FishBll.Bll.CompanyBll companyBll = new FishBll.Bll.CompanyBll(); //更新 往来单位 表的 最近联系时间,下次联系时间 companyBll.UpdateCompnayLinkDate(_entity.customercode, _entity.weekestimate, _entity.monthestimate, _entity.currentdate.Value, _entity.BuyDate, _entity.nextdate.Value); FishBll.Bll.CustomerBll customerBll = new FishBll.Bll.CustomerBll(); //更新 联系人 表的 当前联系时间,下次联系时间和 通话记录ID字段 customerBll.UpdateLinkDate(_entity.linkmancode, _entity.currentdate.Value, _entity.id, _entity.nextdate.Value); AddDetail(id, true); //tmiAdd.Visible = true; //tmiModify.Visible = true; //tmiDelete.Visible = true; //tmiQuery.Visible = true; //tmiPrevious.Visible = true; //tmiPrevious.Visible = true; //tmiSave.Visible = false; //tmiCancel.Visible = false; ControlButtomRoles(); MessageBox.Show("添加成功。"); //System.Diagnostics.Process.Start("FormCallRecordsTable.cs"); if (RefreshDataEvent != null) { RefreshDataEvent(this, EventArgs.Empty); } } else { MessageBox.Show("添加失败。"); } }