Example #1
0
        private void EditMeterProtocol()
        {
            if (!string.IsNullOrWhiteSpace(TextBoxDescription.Text))
            {   //Todo EditedBy
                var lockcount = GetLockCount(_meterProtocolId);

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

                var updateMeterProtocol = _meterProtocol.Update(new SmartDB(), meterProtocol);

                bool flag = updateMeterProtocol.Code == ErrorEnum.NoError;
                if (flag)
                {
                    MessageBox.Show("Meter Protocol Updated");
                    ResetControls();
                }
                else
                {
                    MessageBox.Show(updateMeterProtocol.Message);
                }
            }
            else
            {
                MessageBox.Show("No meter protocol to edit or Contact Admin.");
            }
        }
        public void MeterProtocol_UPD_True()
        {
            //Arrange
            TMF.Reports.Model.MeterProtocol meterProtocol = new TMF.Reports.Model.MeterProtocol()
            {
                Id          = 2,
                Description = "Protocol C",
                EditedBy    = "646f18f9-6425-4769-aa79-16ecdb7cf816",
                DocDate     = DateTime.Now,
                Show        = 1,
                LockCount   = 0
            };

            //Act
            var  updateMeterProtocol = _meterProtocol.Update(new SmartDB(), meterProtocol);
            bool flag = updateMeterProtocol.Code == ErrorEnum.NoError;

            //Assert
            Assert.IsTrue(flag);
        }