Ejemplo n.º 1
0
        private void EditMeterSize()
        {
            if (!string.IsNullOrWhiteSpace(TextBoxDescription.Text))
            {   //Todo EditedBy
                var lockcount = GetLockCount(_meterSizeId);

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

                var updateMeterSize = _meterSize.Update(new SmartDB(), meterSize);

                bool flag = updateMeterSize.Code == ErrorEnum.NoError;
                if (flag)
                {
                    MessageBox.Show("Meter Size Updated");
                    ResetControls();
                    BindMeterSizeWithDataGrid();
                }
                else
                {
                    MessageBox.Show(updateMeterSize.Message);
                }
            }
            else
            {
                MessageBox.Show("No meter size to edit or Contact Admin.");
            }
        }
Ejemplo n.º 2
0
        public void MeterSize_UPD_True()
        {
            //Arrange
            TMF.Reports.Model.MeterSize meterSize = new TMF.Reports.Model.MeterSize()
            {
                Id          = 1,
                Description = "1 m",
                EditedBy    = "646f18f9-6425-4769-aa79-16ecdb7cf816",
                DocDate     = DateTime.Now,
                Show        = 1,
                LockCount   = 0
            };

            //Act
            var  updateMeterSize = _meterSize.Update(new SmartDB(), meterSize);
            bool flag            = updateMeterSize.Code == ErrorEnum.NoError;

            //Assert
            Assert.IsTrue(flag);
        }