Exemplo n.º 1
0
 private void m()
 {
     MsgBox.Show("室外温度或二次供水温度必须依次增大或减小");
 }
Exemplo n.º 2
0
        /// <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();
        }