/// <summary> /// /// </summary> private void ShowNotConnect() { MsgBox.Show("尚未与该站点建立连接!"); }
/// <summary> /// /// </summary> private void ShowNoStationSelected() { MsgBox.Show("请先选择巡更站点!"); }
private void m() { MsgBox.Show("室外温度或二次供水温度必须依次增大或减小"); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, System.EventArgs e) { int ot, twogp; try { ot = Convert.ToInt32(txtOutsideTemp.Text); } catch { MsgBox.Show("室外温度输入错误"); return; } try { twogp = Convert.ToInt32(txtTwoGiveTemp.Text); } catch { MsgBox.Show("二次供温输入错误"); return; } // if (!( ot >= -50 && ot <= 10 )) if (!TemperatureLinePoint.IsValidOutsideTemperature(ot)) { string s = string.Format("室外温度必须介于 {0} 到 {1} 之间", TemperatureLinePoint.MIN_OUTSIDE_TEMPERATURE, TemperatureLinePoint.MAX_OUTSIDE_TEMPERATURE); MsgBox.Show(s); return; } // if (!( twogp >= 40 && twogp <= 90 ) ) if (!TemperatureLinePoint.IsValidTwoGiveTemperature(twogp)) { string s = string.Format("二次供温必须介于 {0} 到 {1} 之间", TemperatureLinePoint.MIN_TWOGIVE_TEMPERATURE, TemperatureLinePoint.MAX_TWOGIVE_TEMPERATURE); MsgBox.Show(s); return; } int row = dataGrid1.CurrentRowIndex; if (row == -1) { return; } int otP, otN, twogpP, twogpN; getNear(row, out otP, out otN, out twogpP, out twogpN); if (otP != INV && ot < otP) { m(); return; } if (otN != INV && ot > otN) { m(); return; } if (twogpP != INV && twogp > twogpP) { m(); return; } if (twogpN != INV && twogp < twogpN) { m(); return; } dataGrid1 [row, 1] = ot; dataGrid1 [row, 2] = twogp; refreshGP(); }
private void btnOK_Click(object sender, System.EventArgs e) { int grAddr, xgAddr; float area; //, cpn; // check gprs staion name // if (StationName == string.Empty) { MsgBox.Show("站名不能为空!"); return; } // check gr address // try { grAddr = GrAddress; } catch { MsgBox.Show("供热控制器地址错误!"); return; } // check xg address // try { xgAddr = XgAddress; } catch { MsgBox.Show("巡更控制器地址错误!"); return; } //// check commport // // try // { // cpn = CommPort; // } // catch // { // MsgBox.Show("串口号错误!"); // return ; // } // check ip address // try { if (IpAddress.Length == 0) { MsgBox.Show("IP地址不能为空!"); return; } System.Net.IPAddress.Parse(IpAddress); } catch { MsgBox.Show("IP地址错误"); return; } try { if (ServerIpAddress.Length == 0) { MsgBox.Show("服务器IP地址不能为空!"); return; } System.Net.IPAddress.Parse(ServerIpAddress); } catch { MsgBox.Show("服务器IP地址错误"); return; } try { area = this.Area; } catch { MsgBox.Show("供热面积错误"); return; } // check station name not use // bool nameExist = XGDB.CheckGprsStationNameExist(StationName.Trim(), EditId, XGConfig.Default.ClientAorB); if (nameExist) { MsgBox.Show("站名已经存在!"); return; } // check commport not use // // bool cpExist = XGDB.CheckGprsStationCommPortExist( CommPort, EditId, XGConfig.Default.ClientAorB ); // if ( cpExist ) // { // MsgBox.Show( "串口号已经存在!" ); // return ; // } this.DialogResult = DialogResult.OK; Close(); }
// /// <summary> // /// 解析巡更任务 // /// </summary> // /// <param name="stationIds"></param> // /// <param name="cardIds"></param> // /// <returns></returns> // static public ObjectIdAssociateCollection ResolveXGTask( ObjectIdAssociateCollection stationIds, // ObjectIdAssociateCollection cardIds ) // { // ArgumentChecker.CheckNotNull( stationIds ); // ArgumentChecker.CheckNotNull( cardIds ); // // ObjectIdAssociateCollection taskIdAssoc = new ObjectIdAssociateCollection("tbl_xgtask"); // string s = "select xgtask_id, card_id, xgstation_id, time_begin, time_end from tbl_xgtask"; // DataSet ds = DbClient.Execute( s ); // DataTable tbl = ds.Tables[0]; // foreach ( DataRow r in tbl.Rows ) // { // int id = int.Parse( r[0].ToString() ); // int cardId = int.Parse ( r[1].ToString() ); // int stationId = int.Parse ( r[2].ToString() ); // string begin = r[3].ToString(); // string end = r[4].ToString(); // // XGTime time = new XGTime( DateTime.Parse( begin ), // DateTime.Parse( end ) ); // // Card card = (Card) cardIds.GetObject( cardId ); // XGStation st = (XGStation) stationIds.GetObject( stationId ); // // Debug.Assert( (card != null) && (st != null) ); // if ( card != null && st != null ) // { // XGTask task = new XGTask( st, card, time); // taskIdAssoc.Add( task, id ); // } // } // // return taskIdAssoc; // } // static public XGTasksCollection GetTasks( ObjectIdAssociateCollection oias ) // { // XGTasksCollection tasks = new XGTasksCollection(); // // for ( int i=0; i<oias.Count; i++ ) // { // tasks.Add( (XGTask)oias.GetObjectByIndex( i ) ); // } // // return tasks; // } #endregion //Resolve static private void ExceptionHandler(Exception ex) { MsgBox.Show(ex.ToString(), ex.GetType().Name, System.Windows.Forms.MessageBoxIcon.Error); }