New function add / change accountrecord

This commit is contained in:
2023-09-14 23:41:30 +02:00
parent d7774c70ee
commit 0c0533f9d5
8 changed files with 510 additions and 2 deletions

View File

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WinFormDiApp.BL.Helpers;
using WinFormDiApp.BLI;
namespace WinFormDiApp
{
public partial class frmEditPayment : Form
{
private readonly IAccountRecordRepository _recordRepository;
public frmEditPayment(IAccountRecordRepository recordRepository)
{
InitializeComponent();
_recordRepository = recordRepository;
}
private void rbNew_CheckedChanged(object sender, EventArgs e)
{
if (rbNew.Checked)
{
txtId.Enabled = false;
btnSearch.Enabled = false;
btnSearch.Visible = false;
}
}
private void rbEdit_CheckedChanged(object sender, EventArgs e)
{
if (rbEdit.Checked)
{
txtId.Enabled = true;
btnSearch.Enabled = true;
btnSearch.Visible = true;
}
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnSearch_Click(object sender, EventArgs e)
{
if (txtId.Text.IsNumeric())
{
var editRecord = _recordRepository.GetAccount(int.Parse(txtId.Text));
if (editRecord != null)
{
txtAccount.Text = editRecord.Konto.ToString();
txtAmount.Text = editRecord.Belopp.ToString();
txtPayInfo.Text = editRecord.Avisering.ToString();
txtReceiver.Text = editRecord.Mottagare.ToString();
dtpPayDate.Value = editRecord.BetalDatum;
txtSaved.Text = editRecord.Stored.ToLongDateString();
}
}
}
}
}