public int Delete(VibrationCableList entityToInsert) { using (Conn) { return(Conn.Delete(entityToInsert)); } }
public Guid Insert(VibrationCableList entityToInsert) { using (Conn) { return(Conn.Insert <Guid>(entityToInsert)); } }
private void ToolStripMenuItem_add_Click(object sender, EventArgs e) { VibrationCableList tmpData = null; Add_Modify_VibrationCable tmpAdd_Modify_VibrationCable = new Add_Modify_VibrationCable(tmpData); tmpAdd_Modify_VibrationCable.ShowDialog(); if (tmpAdd_Modify_VibrationCable.result == DialogResult.OK) { GetVibrationCableList(); } }
public Add_Modify_VibrationCable(VibrationCableList _tmpData) { InitializeComponent(); if (_tmpData == null) { TypeNameDataBinding(); } else if (_tmpData != null) { tmpStation = _tmpData; TypeNameDataBinding(); VibrationCableData(tmpStation); } }
public void VibrationCableData(VibrationCableList _tmpData) { txtname.Text = _tmpData.Name; txtlon.Text = _tmpData.Lon.ToString(); txtlat.Text = _tmpData.Lat.ToString(); txtalt.Text = _tmpData.Alt.ToString(); comboBoxProtocolType.SelectedValue = _tmpData.ProtocolType; if (_tmpData.StationID != null) { comboBox1.SelectedValue = _tmpData.StationID; } comboBoxCommunicationInternet.SelectedValue = _tmpData.CommunicationType; if (_tmpData.CommunicationID != null) { comboBox3.SelectedValue = _tmpData.CommunicationID; } txtdescription.Text = _tmpData.Description; }
private void ToolStripMenuItem_edittype_Click(object sender, EventArgs e) { VibrationCableList tmpData = new VibrationCableList(); for (int i = 0; i < tmpListVibrationCable.Count; i++) { if (tmpListVibrationCable[i].DeviceID == _VibrationCableList.DeviceID) { tmpData = tmpListVibrationCable[i]; break; } } Add_Modify_VibrationCable tmpAdd_Modify_VibrationCable = new Add_Modify_VibrationCable(tmpData); tmpAdd_Modify_VibrationCable.ShowDialog(); if (tmpAdd_Modify_VibrationCable.result == DialogResult.OK) { GetVibrationCableList(); } }
private void btnsure_Click(object sender, EventArgs e) { double lon = 0.0, lat = 0.0, alt = 0.0; List <VibrationCableList> tmpVibrationCableList = new List <VibrationCableList>(); VibrationCableList _VibrationCableList = new VibrationCableList(); VibrationCable_Command tmpVibrationCable_Command = new VibrationCable_Command(); if (txtname.Text.Trim() == "") { MessageBox.Show("请填写设备名字"); return; } if (txtlon.Text.Trim() == "") { MessageBox.Show("请填写经度"); } else { if (!double.TryParse(txtlon.Text.Trim(), out lon)) { MessageBox.Show("经度为数值类型"); return; } } if (txtlat.Text.Trim() == "") { MessageBox.Show("请填写纬度"); return; } else { if (!double.TryParse(txtlat.Text.Trim(), out lat)) { MessageBox.Show("纬度为数值类型"); return; } } if (txtalt.Text.Trim() == "") { MessageBox.Show("请填写海拔"); return; } else { if (!double.TryParse(txtalt.Text.Trim(), out alt)) { MessageBox.Show("海拔为数值类型"); return; } } if (tmpStation != null) { _VibrationCableList.DeviceID = tmpStation.DeviceID; } _VibrationCableList.Name = txtname.Text.Trim(); if (comboBox1.SelectedValue.ToString() != "") { _VibrationCableList.StationID = new Guid(comboBox1.SelectedValue.ToString()); } else { _VibrationCableList.StationID = null; } _VibrationCableList.TypeID = Convert.ToInt32(DeviceParamType.VibrationCableDevice); _VibrationCableList.Lon = Convert.ToDouble(txtlon.Text.Trim()); _VibrationCableList.Lat = Convert.ToDouble(txtlat.Text.Trim()); _VibrationCableList.Alt = Convert.ToDouble(txtalt.Text.Trim()); if (comboBoxProtocolType.SelectedValue.ToString() != "") { _VibrationCableList.ProtocolType = Convert.ToInt32(comboBoxProtocolType.SelectedValue); } else { _VibrationCableList.ProtocolType = 0; } if (comboBoxCommunicationInternet.SelectedValue.ToString() != "") { _VibrationCableList.CommunicationType = Convert.ToInt32(comboBoxCommunicationInternet.SelectedValue); } else { _VibrationCableList.CommunicationType = 0; } if (comboBox3.SelectedValue.ToString() == "") { _VibrationCableList.CommunicationID = null; } else { _VibrationCableList.CommunicationID = new Guid(comboBox3.SelectedValue.ToString()); } _VibrationCableList.Description = txtdescription.Text.Trim(); tmpVibrationCableList.Add(_VibrationCableList); if (tmpStation == null) { tmpVibrationCable_Command._AddData(tmpVibrationCableList); result = MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK); } else if (tmpStation != null) { tmpVibrationCable_Command._ReviseData(tmpVibrationCableList); result = MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK); } this.Close(); }