public void MeterReading_UPD_True() { //Arrange TMF.Reports.Model.MeterReading meterReading = new TMF.Reports.Model.MeterReading() { Id = "99ec376bd55f422085789bb89ee93664", SerialNumber = "0B85EEEE", ReadingDate = DateTime.Now, ReadingValue = "2A5C36571122368CCEA", LowBatteryAlr = 0, LeakAlr = 0, MagneticTamperAlr = 0, MeterErrorAlr = 0, BackFlowAlr = 0, BrokenPipeAlr = 0, EmptyPipeAlr = 0, SpecificErr = 0, EditedBy = "646f18f9-6425-4769-aa79-16ecdb7cf816", DocDate = DateTime.Now, Show = 1, LockCount = 0 }; //Act var updateMeterReading = _meterReading.Update(new SmartDB(), meterReading); bool flag = updateMeterReading.Code == ErrorEnum.NoError; //Assert Assert.IsTrue(flag); }
private void EditMeterReading() { if (!string.IsNullOrWhiteSpace(TextBoxSerialNumber.Text)) { //Todo EditedBy var lockcount = GetLockCount(_meterReadingId); TMF.Reports.Model.MeterReading meterReading = new TMF.Reports.Model.MeterReading() { Id = _meterReadingId, SerialNumber = TextBoxSerialNumber.Text, ReadingDate = Convert.ToDateTime(TextBoxReadingDate.Text), ReadingValue = TextBoxReadingValue.Text, LowBatteryAlr = Convert.ToInt32(TextBoxLowBattAlr.Text), LeakAlr = Convert.ToInt32(TextBoxLeakAlr.Text), MagneticTamperAlr = Convert.ToInt32(TextBoxLeakAlr.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), EditedBy = _currentUser.Id.ToString(), DocDate = DateTime.Now, Show = 1, LockCount = lockcount }; var updateMeterReading = _meterReading.Update(new SmartDB(), meterReading); bool flag = updateMeterReading.Code == ErrorEnum.NoError; if (flag) { MessageBox.Show("Meter Reading Updated"); ResetControls(); } else { MessageBox.Show(updateMeterReading.Message); } } else { MessageBox.Show("No meter reading to edit or Contact Admin."); } }