70 lines
2.0 KiB
C#
70 lines
2.0 KiB
C#
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();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|