Spara ny /ändrad införd
This commit is contained in:
@ -8,6 +8,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using WinFormDiApp.BL.Helpers;
|
||||
using WinFormDiApp.BL.Models;
|
||||
using WinFormDiApp.BLI;
|
||||
|
||||
namespace WinFormDiApp
|
||||
@ -65,5 +66,35 @@ namespace WinFormDiApp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
AccountRecord saveRecord = new AccountRecord();
|
||||
if(rbEdit.Checked)
|
||||
{
|
||||
saveRecord.Id = Convert.ToInt32( txtId.Text);
|
||||
saveRecord.Stored = DateTime.Parse(txtSaved.Text);
|
||||
}
|
||||
saveRecord.Konto = txtAccount.Text;
|
||||
saveRecord.Belopp = Convert.ToDouble(txtAmount.Text);
|
||||
saveRecord.Avisering = txtPayInfo.Text;
|
||||
saveRecord.Mottagare = txtReceiver.Text;
|
||||
saveRecord.BetalDatum =dtpPayDate.Value;
|
||||
;
|
||||
|
||||
_recordRepository.SaveAcountRecord(saveRecord);
|
||||
|
||||
if (saveRecord != null)
|
||||
{
|
||||
rbEdit.Checked = true;
|
||||
txtId.Text = saveRecord.Id.ToString();
|
||||
txtAccount.Text = saveRecord.Konto.ToString();
|
||||
txtAmount.Text = saveRecord.Belopp.ToString();
|
||||
txtPayInfo.Text = saveRecord.Avisering.ToString();
|
||||
txtReceiver.Text = saveRecord.Mottagare.ToString();
|
||||
dtpPayDate.Value = saveRecord.BetalDatum;
|
||||
txtSaved.Text = saveRecord.Stored.ToLongDateString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user