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."); } }
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."); } }
private void DataGridViewMeterSize_SelectionChanged(object sender, EventArgs e) { LabelShow.Text = $"Showing {DataGridViewMeterSize.CurrentRow.Index + 1} index of {DataGridViewMeterSize.RowCount} records"; var meterSizeId = (int)DataGridViewMeterSize.CurrentRow.Cells[0].Value; ReturnInfo getMeterSize = _meterSize.GetMeterSizeById(new SmartDB(), meterSizeId); bool flag = getMeterSize.Code == ErrorEnum.NoError; TMF.Reports.Model.MeterSize meterSize = (TMF.Reports.Model.MeterSize)getMeterSize.BizObject; try { if (meterSize.Id == 0 ? false : true) { TextBoxDescription.Text = meterSize.Description; _meterSizeId = meterSize.Id; ButtonEdit.Enabled = true; ButtonDelete.Enabled = true; } } catch (Exception exception) { return; } }
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); }
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); }