Beispiel #1
0
        public void MeterReading_INS_True()
        {
            //Arrange
            TMF.Reports.Model.MeterReading meterReading = new TMF.Reports.Model.MeterReading()
            {
                Id                = Guid.NewGuid().ToString("N"),
                SerialNumber      = "0B85EE6C",
                ReadingDate       = DateTime.Now,
                ReadingValue      = "2A5C36571122368CCEA",
                LowBatteryAlr     = 1,
                LeakAlr           = 0,
                MagneticTamperAlr = 1,
                MeterErrorAlr     = 1,
                BackFlowAlr       = 0,
                BrokenPipeAlr     = 0,
                EmptyPipeAlr      = 0,
                SpecificErr       = 0,
                CreatedBy         = "646f18f9-6425-4769-aa79-16ecdb7cf816",
                DocDate           = DateTime.Now,
                Show              = 1,
                LockCount         = 0
            };

            //Act
            var  createMeterReading = _meterReading.Create(new SmartDB(), ref meterReading);
            bool flag = createMeterReading.Code == ErrorEnum.NoError;

            //Assert
            Assert.IsTrue(flag);
        }
Beispiel #2
0
        private void SaveMeterReading()
        {
            if (!string.IsNullOrWhiteSpace(TextBoxSerialNumber.Text))
            {
                TMF.Reports.Model.MeterReading meterReading = new TMF.Reports.Model.MeterReading()
                {
                    SerialNumber      = TextBoxSerialNumber.Text,
                    ReadingDate       = Convert.ToDateTime(TextBoxReadingDate.Text),
                    ReadingValue      = TextBoxReadingValue.Text,
                    LowBatteryAlr     = Convert.ToInt32(TextBoxLowBattAlr.Text),
                    LeakAlr           = Convert.ToInt32(TextBoxLeakAlr.Text),
                    MagneticTamperAlr = Convert.ToInt32(TextBoxMagneticTmprAlr.Text),
                    MeterErrorAlr     = Convert.ToInt32(TextBoxErrorAlr.Text),
                    BackFlowAlr       = Convert.ToInt32(TextBoxBackflowAlr.Text),
                    BrokenPipeAlr     = Convert.ToInt32(TextBoxBrokenPipeAlr.Text),
                    EmptyPipeAlr      = Convert.ToInt32(TextBoxEmptyPipeAlr.Text),
                    SpecificErr       = Convert.ToInt32(TextBoxSpecificErr.Text),
                    CreatedBy         = _currentUser.Id,
                    DocDate           = DateTime.Now,
                    Show      = 1,
                    LockCount = 0
                };

                var createMeterReading = _meterReading.Create(new SmartDB(), ref meterReading);

                bool flag = createMeterReading.Code == ErrorEnum.NoError;
                if (flag)
                {
                    MessageBox.Show("Meter Reading Created");
                    ResetControls();
                }
                else
                {
                    MessageBox.Show(createMeterReading.Code.ToString());
                }
            }
            else
            {
                MessageBox.Show("No meter reading to save or Contact Admin.");
            }
        }