public int Delete(SolarEnergyList entityToInsert) { using (Conn) { return(Conn.Delete(entityToInsert)); } }
public Guid Insert(SolarEnergyList entityToInsert) { using (Conn) { return(Conn.Insert <Guid>(entityToInsert)); } }
private void ToolStripMenuItem_add_Click(object sender, EventArgs e) { SolarEnergyList _tmpData = null; Add_Modify_SolarEnergy tmpAdd_Modify_SolarEnergy = new Add_Modify_SolarEnergy(_tmpData); tmpAdd_Modify_SolarEnergy.ShowDialog(); if (tmpAdd_Modify_SolarEnergy.result == DialogResult.OK) { GetSolarEnergyList(); } }
public Add_Modify_SolarEnergy(SolarEnergyList _tmpData) { InitializeComponent(); if (_tmpData == null) { TypeNameDataBinding(); } else if (_tmpData != null) { tmpStation = _tmpData; TypeNameDataBinding(); SolarEnergyData(tmpStation); } }
private void dataGridViewX_SolarEnergyExceptionList_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex < 0 || e.RowIndex < 0) return; DataGridViewColumn column = dataGridViewX_SolarEnergyExceptionList.Columns[e.ColumnIndex]; if (column is DataGridViewButtonColumn) { string deviceID = dataGridViewX_SolarEnergyExceptionList.Rows[e.RowIndex].Cells[0].Value.ToString(); SolarEnergyList solarEnergy = OMClientManager.deviceInfo.SolarEnergyList.Find(_ => _.DeviceID == Guid.Parse(deviceID)); if (!solarEnergy.Lat.HasValue || !solarEnergy.Lon.HasValue) return; mapControl.Position = new PointLatLng(solarEnergy.Lat.Value, solarEnergy.Lon.Value); mapControl.Zoom = MapSkipLevel; } }
public void SolarEnergyData(SolarEnergyList _tmpData) { txtname.Text = _tmpData.Name; txtlon.Text = _tmpData.Lon.ToString(); txtlat.Text = _tmpData.Lat.ToString(); txtalt.Text = _tmpData.Alt.ToString(); textBox1.Text = _tmpData.ErectingHeight.ToString(); comboBoxProtocolType.SelectedValue = _tmpData.ProtocolType; txtdescription.Text = _tmpData.Description; comboBoxCommunicationInternet.SelectedValue = _tmpData.CommunicationType; if (_tmpData.CommunicationID != null) { comboBox3.SelectedValue = _tmpData.CommunicationID; } if (_tmpData.StationID != null) { comboBox1.SelectedValue = _tmpData.StationID; } }
private void ToolStripMenuItem_edittype_Click(object sender, EventArgs e) { SolarEnergyList tmpData = new SolarEnergyList(); for (int i = 0; i < tmpListSolarEnergy.Count; i++) { if (tmpListSolarEnergy[i].DeviceID == _SolarEnergyList.DeviceID) { tmpData = tmpListSolarEnergy[i]; break; } } Add_Modify_SolarEnergy tmpAdd_Modify_SolarEnergy = new Add_Modify_SolarEnergy(tmpData); tmpAdd_Modify_SolarEnergy.ShowDialog(); if (tmpAdd_Modify_SolarEnergy.result == DialogResult.OK) { GetSolarEnergyList(); } }
private void btnsure_Click(object sender, EventArgs e) { List <SolarEnergyList> tmpListSolarEnergy = new List <SolarEnergyList>(); SolarEnergyList _SolarEnergyList = new SolarEnergyList(); SolarEnergy_Command tmpSolarEnergyCommand = new SolarEnergy_Command(); double lon = 0.0, lat = 0.0, alt = 0.0, height = 0.0; 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 (textBox1.Text.Trim() == "") { MessageBox.Show("请填写架设高度"); return; } else { if (!double.TryParse(textBox1.Text.Trim(), out height)) { MessageBox.Show("架设高度为数值类型"); return; } } if (tmpStation != null) { _SolarEnergyList.DeviceID = tmpStation.DeviceID; } _SolarEnergyList.Name = txtname.Text.Trim(); _SolarEnergyList.TypeID = Convert.ToInt32(DeviceParamType.SolarEnergyDevice); _SolarEnergyList.Lon = Convert.ToDouble(txtlon.Text.Trim()); _SolarEnergyList.Lat = Convert.ToDouble(txtlat.Text.Trim()); _SolarEnergyList.Alt = Convert.ToDouble(txtalt.Text.Trim()); _SolarEnergyList.ErectingHeight = Convert.ToDouble(textBox1.Text.Trim()); _SolarEnergyList.ProtocolType = Convert.ToInt32(comboBoxProtocolType.SelectedValue); _SolarEnergyList.Description = txtdescription.Text.Trim(); _SolarEnergyList.CommunicationType = Convert.ToInt32(comboBoxCommunicationInternet.SelectedValue); _SolarEnergyList.CommunicationID = new Guid(comboBox3.SelectedValue.ToString()); if (comboBox1.SelectedValue.ToString() != null) { _SolarEnergyList.StationID = new Guid(comboBox1.SelectedValue.ToString()); } else { _SolarEnergyList.StationID = null; } tmpListSolarEnergy.Add(_SolarEnergyList); if (tmpStation == null) { tmpSolarEnergyCommand._AddData(tmpListSolarEnergy); result = MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK); } else if (tmpStation != null) { tmpSolarEnergyCommand._ReviseData(tmpListSolarEnergy); result = MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK); } this.Close(); }
public void InsertTest() { //UserPermissionList newUserPermission = new UserPermissionList(); //UserPermissionListRepository repository = new UserPermissionListRepository(); //newUserPermission.UserPermissionID = repository.GetGuid(); //wancheng Guid g = repository.Insert(newUserPermission); //SerialCOMListRepository repo = new SerialCOMListRepository(); //SerialCOMList deviceList = new SerialCOMList(); //deviceList.DeviceID = repo.GetGuid(); //deviceList.COMNo = "COM3"; //repo.Insert(deviceList); //for (int i = 0; i < 8; i++) //{ // deviceList.DeviceID = repo.GetGuid(); // deviceList.VideoIP = "192.168.10.14"; // Guid result = repo.Insert(deviceList); //} //using (FileStream fs = new FileStream("Image\\Turntable.png", FileMode.Open, FileAccess.Read)) //{ // byte[] buffer = new byte[1024]; // int count = fs.Read(buffer, 0, buffer.Length); // deviceList.Image1 = buffer; //} //RunLogRepository repo = new RunLogRepository(); //for (int i = 0; i < 105; i++) //{ // RunLog log = new RunLog(); // log.OperationTime = DateTime.Now.ToString(); // log.OperationType = 1; // log.Operator = "ly"; // log.OperationContent = "登录"; // repo.Insert(log); // Thread.Sleep(100); //} //AlarmLogRepository repo = new AlarmLogRepository(); //for (int i = 0; i < 105; i++) //{ // AlarmLog log = new AlarmLog(); // log.AlarmTime = DateTime.Now.ToString(); // log.AlarmDeviceID = new Guid(); // log.Operator = "无"; // log.AlarmID = new Guid(); // log.AlarmLevel = 1; // log.AlarmName = "测试报警" + i; // log.AlarmStatus = 1; // log.AlarmType = 1; // log.Alt = i; // log.Lat = i; // log.Lon = i; // repo.Insert(log); // Thread.Sleep(100); //} //ErrLogRepository repo = new ErrLogRepository(); //for (int i = 0; i < 105; i++) //{ // try // { // throw new Exception("TestException" + i); // } // catch(Exception ex) // { // LogServerManager.AddErrLog(LogServerManager.ErrLogType.InnerErr, ex); // } // Thread.Sleep(100); //} //StationListRepository repo = new StationListRepository(); //StationList station = new StationList(); //station.PStationID = Guid.Parse("e2061d09-111e-413b-8ab5-6b71d4c38b3d"); //station.Name = "监控站2"; //station.Lon = 104.317792; //station.Lat = 30.541620; //station.TypeID = 9; //repo.Insert(station); //for (int i = 0; i < 16; i++) //{ // TurnTableListRepository repo = new TurnTableListRepository(); // TurnTableList TurnTableList = new TurnTableList(); // TurnTableList.StationID = Guid.Parse("e2061d09-111e-413b-8ab5-6b71d4c38b3d"); // TurnTableList.Name = "转台"; // TurnTableList.TypeID = 7; // repo.Insert(TurnTableList); //} //for (int i = 0; i < 12; i++) //{ // StreamMediaListRepository repo = new StreamMediaListRepository(); // StreamMediaList streamMediaList = new StreamMediaList(); // //streamMediaList.VideoIP = "192.168.10.1" + i; // streamMediaList.Name = "监控站1-转台1-白光"; // streamMediaList.TypeID = 1; // repo.Insert(streamMediaList); //} //for (int i = 1; i <= 12; i++) //{ // CameraListRepository repo = new CameraListRepository(); // CameraList CameraList = new CameraList(); // CameraList.VideoName = "监控站-转台-白光"; // CameraList.VideoChannel = 1; // CameraList.VideoType = "101"; // CameraList.TypeID = 4; // repo.Insert(CameraList); //} //for (int i = 0; i < 3; i++) //{ // UPSListRepository repo = new UPSListRepository(); // UPSList upslist = new UPSList(); // upslist.Name = "UPS"; // upslist.TypeID = 8; // repo.Insert(upslist); //} for (int i = 0; i < 3; i++) { SolarEnergyListRepository repo = new SolarEnergyListRepository(); SolarEnergyList SolarEnergyList = new SolarEnergyList(); SolarEnergyList.Name = "太阳能"; SolarEnergyList.TypeID = 6; repo.Insert(SolarEnergyList); } }