public FormEditForm(int formId)
 {
     form = GetForm(formId);
     InitializeComponent();
     InitializeData();
     PrepareFormData(form);
 }
 private void PrepareFormData(Form form)
 {
     txtLp.Text                = form.Lp.ToString();
     txtInfo.Text              = form.Info;
     dtRegistDate.Value        = form.RegistrationDate;
     dtRepairDate.Value        = form.RepairDate;
     comboStatus.SelectedValue = form.FormStatus.FormStatusId;
     comboSenior.SelectedValue = form.SeniorId;
     comboWorker.SelectedValue = form.WorkerId;
 }
        protected override void Save()
        {
            Form newForm = GoldenHandContext.Instance.Forms.Where(x => x.FormId == form.FormId).FirstOrDefault();

            newForm.Lp               = Int32.Parse(txtLp.Text);
            newForm.Info             = txtInfo.Text;
            newForm.FormStatusId     = Int32.Parse(comboStatus.SelectedValue.ToString());
            newForm.SeniorId         = Int32.Parse(comboSenior.SelectedValue.ToString());
            newForm.WorkerId         = Int32.Parse(comboWorker.SelectedValue.ToString());
            newForm.RegistrationDate = new DateTime(dtRegistDate.Value.Year, dtRegistDate.Value.Month, dtRegistDate.Value.Day);
            newForm.RepairDate       = new DateTime(dtRepairDate.Value.Year, dtRepairDate.Value.Month, dtRepairDate.Value.Day);

            GoldenHandContext.Instance.SaveChanges();
            MessageBox.Show("Zapisano zmiany.");

            ReloadForms?.Invoke(btnSave, new FormEventArgs(newForm));
            Close();
        }