private void ApplyAction()
 {
     // если установлен признак "редактирование" - обновить выбранный элемент новыми данными
     if (IsEdit)
     {
         FillItemData();
         UpdateItem(item);
     }
     // если не установлен признак "редактирование" - добавить новый элемент в базу
     else
     {
         item = new MessageCitizen();
         FillItemData();
         AddItem(item);
     }
 }
        public frmMessageDetail()
        {
            InitializeComponent();
            if (IsEdit)
            {
                this.Text = "Редагувати поточний запис";
                item      = GetSingleItem(IdEdit);

                dtpReceiveDate.Value = (DateTime)item.ReceivedDate;
                dtpControlDate.Value = (DateTime)item.ControlDate;

                txtCitizenName.Text               = item.CitizenName;
                txtCitizenAddress.Text            = item.CitizenAddress;
                txtCitizenPhone.Text              = item.CitizenPhone;
                txtCitizenEmail.Text              = item.CitizenEmail;
                txtTreatmentType.Text             = item.TreatmentType;
                txtCorrespondentType.Text         = item.CorrespondentType;
                txtCorrespondentSocialStatus.Text = item.CorrespondentSocialStatus;
                txtSummary.Text               = item.Summary;
                txtTreatmentsBefore.Text      = item.TreatmentsBefore;
                txtIndexReg.Text              = item.IndexReg;
                txtIndexDoc.Text              = item.IndexDoc;
                txtQuestion.Text              = item.Question;
                txtSubquestion.Text           = item.Subquestion;
                txtRecieveType.Text           = item.RecieveType;
                txtReceiveSign.Text           = item.RecieveSign;
                txtRecievedFrom.Text          = item.RecievedFrom;
                txtCorrespondentCategory.Text = item.CorrespondentCategory;
                txtResolution.Text            = item.Resolution;
                txtResolutionAuthor.Text      = item.ResolutionAuthor;
                txtExecuteDaysCount.Text      = item.ExecuteDaysCount;

                txtExecutor.Text     = item.Executor;
                txtWorkingNote.Text  = item.WorkingNote;
                txtControlState.Text = item.ControlState;
                txtWorkingDate.Text  = item.WorkingDate;
                txtCitizenData.Text  = item.CitizenData;
                if (item.SendingDate != null)
                {
                    dtpSendingDate.Value   = (DateTime)item.SendingDate;
                    dtpSendingDate.Checked = true;
                }
                if (item.DateWorking != null)
                {
                    dtpDateWorking.Value   = (DateTime)item.DateWorking;
                    dtpDateWorking.Checked = true;
                }
                if (item.DateChecked != null)
                {
                    dtpDateChecked.Value   = (DateTime)item.DateChecked;
                    dtpDateChecked.Checked = true;
                }
                txtWorkerChecked.Text = item.WorkerChecked;
                txtAgreed.Text        = item.Agreed;
                txtReviewResult.Text  = item.ReviewResult;
                txtController.Text    = item.Controller;
                txtCase.Text          = item.Case;
                txtVolume.Text        = item.Volume;
                txtPagesCount.Text    = item.PagesCount;
                txtPagesCount.Text    = item.PagesCount;
            }
        }