示例#1
0
        public void DataGridViewMeterReading_SelectionChanged(object sender, EventArgs e)
        {
            try
            {
                var        meterReadingId  = DataGridViewMeterReading.CurrentRow.Cells[0].Value.ToString() ?? "";
                ReturnInfo getMeterReading = _meterReading.GetMeterReadingById(new SmartDB(), meterReadingId);

                bool flag = getMeterReading.Code == ErrorEnum.NoError;

                TMF.Reports.Model.MeterReading meterReading = (TMF.Reports.Model.MeterReading)getMeterReading.BizObject;
                if (!string.IsNullOrEmpty(meterReading.Id))
                {
                    TextBoxSerialNumber.Text    = meterReading.SerialNumber;
                    TextBoxReadingDate.Text     = meterReading.ReadingDate.ToString();
                    TextBoxReadingValue.Text    = meterReading.ReadingValue;
                    TextBoxLowBattAlr.Text      = meterReading.LowBatteryAlr.ToString();
                    TextBoxLeakAlr.Text         = meterReading.LeakAlr.ToString();
                    TextBoxMagneticTmprAlr.Text = meterReading.MagneticTamperAlr.ToString();
                    TextBoxErrorAlr.Text        = meterReading.MeterErrorAlr.ToString();
                    TextBoxBackflowAlr.Text     = meterReading.BackFlowAlr.ToString();
                    TextBoxBrokenPipeAlr.Text   = meterReading.BrokenPipeAlr.ToString();
                    TextBoxEmptyPipeAlr.Text    = meterReading.EmptyPipeAlr.ToString();
                    TextBoxSpecificErr.Text     = meterReading.SpecificErr.ToString();
                    _meterReadingId             = meterReading.Id;
                    ButtonEdit.Enabled          = true;
                    ButtonDelete.Enabled        = true;
                }
            }
            catch (Exception)
            {
                ResetControls();
            }
        }
示例#2
0
        public void MeterReading_SearchById_True()
        {
            //Arrange
            //Act
            ReturnInfo getMeterReading = _meterReading.GetMeterReadingById(new SmartDB(), "0e65b6d270c14b5c9c2f88915b22421f");
            bool       flag            = getMeterReading.Code == ErrorEnum.NoError;

            //Assert
            Assert.IsTrue(flag);
        }