public Guid Insert(SerialCOMList entityToInsert) { using (Conn) { return(Conn.Insert <Guid>(entityToInsert)); } }
public int Delete(SerialCOMList entityToInsert) { using (Conn) { return(Conn.Delete(entityToInsert)); } }
private void SerialCOMData(SerialCOMList _tmpData) { txtname.Text = _tmpData.Name; comboBoxCOMNo.SelectedValue = _tmpData.COMNo; comboBoxBaud.Text = _tmpData.Baud.ToString(); comboBoxCheckBit.SelectedValue = _tmpData.CheckBit; comboBoxDataBit.SelectedValue = _tmpData.DataBit; comboBoxStopBit.SelectedValue = _tmpData.StopBit; txtdescription.Text = _tmpData.Description; }
private void ToolStripMenuItem_add_Click(object sender, EventArgs e) { SerialCOMList _tmpData = null; Add_Modify_SerialCOM tmpAdd_Modify_SerialCOM = new Add_Modify_SerialCOM(_tmpData); tmpAdd_Modify_SerialCOM.ShowDialog(); if (tmpAdd_Modify_SerialCOM.result == DialogResult.OK) { GetSerialCOMaList(); } }
//SerialCOMList _tmpSerialCOMList = new SerialCOMList(); //SerialCOM_Command tmpSerialCOM_Command = new SerialCOM_Command(); public Add_Modify_SerialCOM(SerialCOMList tmpData) { InitializeComponent(); if (tmpData == null) { tmpSerialCOM = tmpData; TypeNameDataBinding(); } else { tmpSerialCOM = tmpData; TypeNameDataBinding(); SerialCOMData(tmpSerialCOM); } }
private void ToolStripMenuItem_edittype_Click(object sender, EventArgs e) { SerialCOMList _tmpData = new SerialCOMList(); for (int i = 0; i < tmpListSerialCOM.Count; i++) { if (_tmpSerialCOMList.DeviceID == tmpListSerialCOM[i].DeviceID) { _tmpData = tmpListSerialCOM[i]; } } Add_Modify_SerialCOM tmpAdd_Modify_SerialCOM = new Add_Modify_SerialCOM(_tmpData); tmpAdd_Modify_SerialCOM.ShowDialog(); if (tmpAdd_Modify_SerialCOM.result == DialogResult.OK) { GetSerialCOMaList(); } }
public void AddSerialCOMList(SerialCOMList m_SerialCOMList) { SerialCOMList tmp_SerialCOMList = new SerialCOMList(); tmp_SerialCOMList.Name = ""; tmp_SerialCOMList.COMNo = ""; tmp_SerialCOMList.Baud = 1; int i = 0; switch (i) { case 0: break; } tmp_SerialCOMList.CheckBit = 1; tmp_SerialCOMList.DataBit = 1; tmp_SerialCOMList.StopBit = 1; tmp_SerialCOMList.Description = ""; tmp_SerialCOMList.Mark = ""; new SerialCOMListRepository().Update(tmp_SerialCOMList); }
private void btnsure_Click(object sender, EventArgs e) { if (txtname.Text.Trim() == "") { MessageBox.Show("请填写串口名称!"); return; } SerialCOMList _SerialCOMList = new SerialCOMList(); List <SerialCOMList> tmpSerialCOMList = new List <SerialCOMList>(); SerialCOM_Command tmpSerialCOM_Command = new SerialCOM_Command(); if (tmpSerialCOM != null) { _SerialCOMList.DeviceID = tmpSerialCOM.DeviceID; } _SerialCOMList.Name = txtname.Text.Trim(); _SerialCOMList.COMNo = comboBoxCOMNo.SelectedValue.ToString(); _SerialCOMList.Baud = Convert.ToInt32(comboBoxBaud.Text); _SerialCOMList.CheckBit = Convert.ToInt32(comboBoxCheckBit.SelectedValue); _SerialCOMList.DataBit = Convert.ToInt32(comboBoxDataBit.SelectedValue); _SerialCOMList.StopBit = Convert.ToInt32(comboBoxStopBit.SelectedValue); _SerialCOMList.Description = txtdescription.Text.Trim(); tmpSerialCOMList.Add(_SerialCOMList); if (tmpSerialCOM == null) { tmpSerialCOM_Command._AddData(tmpSerialCOMList); result = MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK); } else { tmpSerialCOM_Command._ReviseData(tmpSerialCOMList); result = MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK); } this.Close(); }