Example #1
0
        private void EditMeterType()
        {
            if (!string.IsNullOrWhiteSpace(TextBoxDescription.Text))
            {
                var lockcount = GetLockCount(_meterTypeId);

                TMF.Reports.Model.MeterType meterType = new TMF.Reports.Model.MeterType()
                {
                    Id          = _meterTypeId,
                    Description = TextBoxDescription.Text,
                    EditedBy    = _currentUser.Id.ToString(),
                    DocDate     = DateTime.Now,
                    Show        = 1,
                    LockCount   = lockcount
                };

                var updateMeterType = _meterType.Update(new SmartDB(), meterType);

                bool flag = updateMeterType.Code == ErrorEnum.NoError;
                if (flag)
                {
                    MessageBox.Show("Meter Type Updated");
                    ResetControls();
                    BindMeterTypeWithDataGrid();
                }
                else
                {
                    MessageBox.Show(updateMeterType.Message);
                }
            }
            else
            {
                MessageBox.Show("No meter type to edit or Contact Admin.");
            }
        }
Example #2
0
        public void MeterType_UPD_True()
        {
            //Arrange
            TMF.Reports.Model.MeterType meterType = new TMF.Reports.Model.MeterType()
            {
                Id          = 1,
                Description = "B-",
                CreatedBy   = "646f18f9-6425-4769-aa79-16ecdb7cf816",
                EditedBy    = "646f18f9-6425-4769-aa79-16ecdb7cf816",
                DocDate     = DateTime.Now,
                Show        = 1,
                LockCount   = 0
            };

            //Act
            var  updateMeterType = _meterType.Update(new SmartDB(), meterType);
            bool flag            = updateMeterType.Code == ErrorEnum.NoError;

            //Assert
            Assert.IsTrue(flag);
        }