public void update(Medicinedata u) { string sql = string.Format("UPDATE medicinedata SET MedicineName = '" + u.MName + "',Unit = '" + u.Unit + "' WHERE MedicineID = '" + u.MId + "'"); mycom.executeSQLCUD(sql); }
public MedicineRecordOperation(Medicinedata m, MainView mainView, int type) { this.mainView = mainView; this.m = m; InitializeComponent(); //不能停止注射的情况 if (type == 0) { stopInjection.Visible = false; continueInjection.Visible = true; flag = 0; addDose.Text = "添加藥物"; } //正在注射的连续形药物 else if (type == 1) { stopInjection.Visible = true; continueInjection.Visible = false; flag = 1; addDose.Text = "設定当前濃度/流速"; } //非连续型药物 else if (type == 2) { stopInjection.Visible = true; stopInjection.Enabled = false; continueInjection.Visible = false; addDose.Text = "添加劑量"; } }
public void addData(Medicinedata u) { string sql = string.Format("INSERT INTO medicinedata (`MedicineId`,`MedicineName`, `Unit`) VALUES ('" + u.MId + "','" + u.MName + "','" + u.Unit + "')"); mycom.executeSQLCUD(sql); }
//删除某条药物记录 public void deleteRecord() { Medicinedata m = medicineDataRepository.selectById(medicineList[operatingIndex].Split()[0]); AnesthesiaMedicineRecord a = new AnesthesiaMedicineRecord(); a.AnesthesiaID = StaticPatient.AnesthesiaID; a.MedicineID = medicineList[operatingIndex].Split()[0]; a.AnesthesiaType = m.Method; if (m.Method == 1) { medicineData.Rows[operatingIndex].Cells[operatingSum].Value = "1"; a.ActualAmount = medicineList[operatingIndex].Split()[1] + " " + medicineList[operatingIndex].Split()[2]; int backward = operatingSum; int forward = operatingSum + 1; while (medicineData.Rows[operatingIndex].Cells[backward].Value != null && !medicineData.Rows[operatingIndex].Cells[backward].Value.Equals(stopSign)) { medicineData.Rows[operatingIndex].Cells[backward].Value = null; //a.Time = StaticPatient.anesthesiaData.Thebeginningofsurgery.AddSeconds(25*backward); //medicineRecordRepository.deleteByTime(a); backward--; if (backward < 0) { break; } } a.StartTime = StaticPatient.anesthesiaData.Thebeginningofsurgery.AddSeconds(25 * (backward + 1)); medicineRecordRepository.deleteByTime(a); while (forward < medicineData.ColumnCount && (medicineData.Rows[operatingIndex].Cells[forward].Value != null && (medicineData.Rows[operatingIndex].Cells[forward].Value.Equals(continuousSign) || medicineData.Rows[operatingIndex].Cells[forward].Value.Equals(stopSign)))) { medicineData.Rows[operatingIndex].Cells[forward].Value = null; //a.StartTime = StaticPatient.anesthesiaData.Thebeginningofsurgery.AddSeconds(25*forward); //medicineRecordRepository.deleteByTime(a); forward++; } if (forward >= medicineData.ColumnCount) { for (int i = 0; i < medicineOnList.Count; i++) { if (medicineOnList[i].MedicineID.Equals(medicineList[operatingIndex].Split()[0])) { medicineOnList.RemoveAt(i); } } } } else { medicineData.Rows[operatingIndex].Cells[operatingSum].Value = null; a.StartTime = StaticPatient.anesthesiaData.Thebeginningofsurgery.AddSeconds(25 * operatingSum); medicineRecordRepository.deleteByTime(a); } }
public override global::System.Data.DataSet Clone() { Medicinedata cln = ((Medicinedata)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
private void button1_Click(object sender, EventArgs e) { Medicinedata u = new Medicinedata(); u.MId = textBox1.Text; u.MName = textBox2.Text; u.Unit = textBox3.Text; new MedicineDataRepository().update(u); this.Close(); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { Medicinedata ds = new Medicinedata(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
public MedicineDataAddForm_InListView(Medicinedata m, MainView mainView, int flag) { this.mainView = mainView; this.flag = flag; InitializeComponent(); LoadData(); Mname.SelectedIndex = Mname.FindStringExact(m.MName); Mname.Enabled = false; NMvalue.Text = m.Unit.Split(' ')[0]; MCvalue.Text = m.Unit.Split(' ')[0]; MRvalue.Text = m.FlowRate.Split(' ')[0]; NMunit.SelectedIndex = NMunit.FindStringExact(m.Unit.Split(' ')[1]); MCunit.SelectedIndex = NMunit.FindStringExact(m.Unit.Split(' ')[1]); MRunit.SelectedIndex = NMunit.FindStringExact(m.Unit.Split(' ')[1]); }
//要改 public void continuousMStop(Medicinedata a) { //修改资料库注射停止时间 AnesthesiaMedicineRecord m = new AnesthesiaMedicineRecord(); m.AnesthesiaID = StaticPatient.AnesthesiaID; m.MedicineID = a.MId; m.StartTime = StaticPatient.anesthesiaData.Thebeginningofsurgery.AddSeconds(25 * operatingSum); m = medicineRecordRepository.findRecordByTime(m); m.EndTime = StaticPatient.anesthesiaData.Thebeginningofsurgery.AddSeconds(25 * operatingSum); medicineRecordRepository.setEndTime(m); //修改画面 isLocked = true; DataGridViewRow row = (DataGridViewRow)medicineData.Rows[operatingIndex]; row.Cells[operatingSum].Value = stopSign; for (int i = operatingSum + 1; i < (int)((sum - 1) / 5); i++) { row.Cells[i].Value = ""; } this.medicineData.Rows.RemoveAt(operatingIndex); this.medicineData.Rows.Insert(0, row); for (int i = 0; i < medicineOnList.Count; i++) { if (medicineOnList[i].MedicineID == medicineList[operatingIndex].Split(' ')[0]) { medicineOnList.RemoveAt(i); } } //药物名称重新排序 string currentName = m.MedicineID + " " + m.ActualAmount; DataGridViewRow r = (DataGridViewRow)medicineLst.Rows[medicineList.IndexOf(currentName)]; medicineLst.Rows.RemoveAt(medicineList.IndexOf(currentName)); medicineLst.Rows.Insert(0, r); medicineList.RemoveAt(medicineList.IndexOf(currentName)); medicineList.Insert(0, currentName); medicineLst.CurrentCell = null; isLocked = false; }
public Medicinedata selectById(String MId) { mycom = new sqlBase(); Medicinedata a = new Medicinedata(); string sql = string.Format("select * from medicinedata where MedicineId = '" + MId + "'"); MySqlDataReader sdr = mycom.executeSQLR(sql); while (sdr.Read()) { a.MId = sdr[0].ToString(); a.MName = sdr[1].ToString(); a.Unit = sdr[2].ToString(); a.Method = (int)sdr[3]; a.FlowRate = sdr[4].ToString(); } mycom.closeConnect(); return(a); }
public List <Medicinedata> selectByName(String username) { mycom = new sqlBase(); List <Medicinedata> list = new List <Medicinedata>(); string sql = string.Format("select * from medicinedata where MedicineName like '%" + username + "%'"); MySqlDataReader sdr = mycom.executeSQLR(sql); while (sdr.Read()) { Medicinedata a = new Medicinedata(); a.MId = sdr[0].ToString(); a.MName = sdr[1].ToString(); a.Unit = sdr[2].ToString(); a.Method = (int)sdr[3]; a.FlowRate = sdr[4].ToString(); list.Add(a); } mycom.closeConnect(); return(list); }
private void medicineLst_DoubleClick(object sender, EventArgs e) { operatingSum = (int)((sum - 1) / 5); try { operatingIndex = medicineLst.CurrentCell.RowIndex; Medicinedata m = medicineDataRepository.selectById(medicineList[medicineLst.CurrentCell.RowIndex].Split(' ')[0]); if (m.Method == 0) { MedicineRecordOperation medicineRecordOperation = new MedicineRecordOperation(medicineDataRepository.selectById(medicineList[this.medicineLst. CurrentCell.RowIndex].Split(' ')[0]), this, 2); medicineRecordOperation.ShowDialog(); } else { if (medicineOnList.Exists(x => x.MedicineID.Equals(m.MId))) { MedicineRecordOperation medicineRecordOperation = new MedicineRecordOperation(medicineDataRepository.selectById(medicineList[this.medicineLst. CurrentCell.RowIndex].Split(' ')[0]), this, 1); medicineRecordOperation.ShowDialog(); } else { MedicineRecordOperation medicineRecordOperation = new MedicineRecordOperation(medicineDataRepository.selectById(medicineList[this.medicineLst. CurrentCell.RowIndex].Split(' ')[0]), this, 0); medicineRecordOperation.ShowDialog(); } } } catch (Exception) { MedicineDataAddForm_InListView medicineDataAddForm_InListView = new MedicineDataAddForm_InListView(this); medicineDataAddForm_InListView.ShowDialog(); } this.medicineLst.CurrentCell = null; }