/// <summary> /// 保存 /// </summary> /// <param name="location"></param> /// <returns></returns> public bool SaveDictdoctor(DADictdoctor dictdoctor) { int nflag = 0; //新增 if (dictdoctor.Dictdoctorid == 0 || dictdoctor.Dictdoctorid == null) { try { // library.Outspecimenid = new BaseService().getSeqID("SEQ_DA_OUTSPECIMEN"); new BaseService().insert("InsertDictdoctor", dictdoctor); nflag = 1; } catch (Exception ex) { nflag = 0; throw new Exception(ex.Message); } } else { update("UpdateDictdoctor", dictdoctor); nflag = 1; } return(nflag > 0); }
public override void popupContainerEdit1_EditValueChanged(object sender, EventArgs e) { try { if (canChange) { _displayMember = popupContainerEdit1.Text; if (popupContainerEdit1.Text != null && popupContainerEdit1.Text.ToString() != "") { this.showPopup(); } else { closePopUp(); } popupContainerEdit1.Focus(); ArrayList dt = new ArrayList(); if (popupContainerEdit1.Text.Trim() == "") { dt.AddRange(this.dtSource); } else { _searchStr = popupContainerEdit1.Text.Trim(); ArrayList drs = this.setFilteredData(); dt.AddRange(drs); } if (dt.Count == 0) { pop.Close(); } else { this.getGV().DataSource = dt; } this.popupContainerEdit1.SelectionStart = this.popupContainerEdit1.Text.Length; Object dr = this.getGV().CurrentRow == null ? null : this.getGV().CurrentRow.DataBoundItem; if (dr != null) { int i = 0; //查找输入的医生名称在列表中是否存在 foreach (DataGridViewRow row in this.dataGridView1.Rows) { if (row.Cells[1].Value.ToString() == popupContainerEdit1.Text) { break; } else { i++; } } //如果未能找到医生,则把DictDoctorid设置为0 if (i == this.dataGridView1.Rows.Count) { DADictdoctor doctor = new DADictdoctor(); doctor.Dictdoctorid = 0; doctor.Doctorname = popupContainerEdit1.Text; this.selectRow = doctor; DoOnAterChange(this.selectRow); } else { DADictdoctor doctor = (DADictdoctor)dr; doctor.Doctorname = popupContainerEdit1.Text; this.selectRow = doctor; DoOnAterChange(this.selectRow); } } } } finally { canChange = false; } }