Exemplo n.º 1
0
        private void SaveMeterSize()
        {
            if (!string.IsNullOrWhiteSpace(TextBoxDescription.Text))
            {
                TMF.Reports.Model.MeterSize meterType = new TMF.Reports.Model.MeterSize()
                {   //TODO User id for CreatedBy
                    Description = TextBoxDescription.Text,
                    CreatedBy   = _currentUser.Id.ToString(),
                    DocDate     = DateTime.Now,
                    Show        = 1,
                    LockCount   = 0
                };

                var createMeterSize = _meterSize.Create(new SmartDB(), ref meterType);

                bool flag = createMeterSize.Code == ErrorEnum.NoError;
                if (flag)
                {
                    MessageBox.Show("Meter Size Created");
                    ResetControls();
                    BindMeterSizeWithDataGrid();
                }
                else
                {
                    MessageBox.Show(createMeterSize.Message);
                }
            }
            else
            {
                MessageBox.Show("No meter size to save or Contact Admin.");
            }
        }
Exemplo n.º 2
0
        public void MeterSize_INS_True()
        {
            //Arrange
            TMF.Reports.Model.MeterSize meterSize = new TMF.Reports.Model.MeterSize()
            {
                Description = "10 meter",
                CreatedBy   = "646f18f9-6425-4769-aa79-16ecdb7cf816",
                DocDate     = DateTime.Now,
                Show        = 1,
                LockCount   = 0
            };

            //Act
            var  createMeterSize = _meterSize.Create(new SmartDB(), ref meterSize);
            bool flag            = createMeterSize.Code == ErrorEnum.NoError;

            //Assert
            Assert.IsTrue(flag);
        }