private void ctrlBReportAddPattern_Click(object sender, EventArgs e)
        {
            var dlg = new Dlg_RecordPatternSelectSource();

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                if (dlg.p_SelectedTemplate != null)
                {
                    try
                    {
                        Cl_RecordPattern pattern = new Cl_RecordPattern();
                        pattern.p_ClinicName = Cl_SessionFacade.f_GetInstance().p_Doctor.p_ClinicName;
                        pattern.f_SetDoctor(Cl_SessionFacade.f_GetInstance().p_Doctor);
                        pattern.f_SetTemplate(dlg.p_SelectedTemplate);
                        var dlgPattern = new Dlg_RecordPattern();
                        dlgPattern.p_RecordPattern = pattern;
                        dlgPattern.ShowDialog(this);
                    }
                    catch (Exception er)
                    {
                        MonitoringStub.Error("Error_Editor", "Не удалось добавить патерн", er, null, null);
                    }
                }
            }
        }
 private void f_FormatPattern(Cl_Record a_Record)
 {
     if (a_Record != null && !a_Record.p_IsAutomatic && a_Record.p_Template != null)
     {
         //Cl_TemplatesFacade.f_GetInstance().f_LoadTemplatesElements(a_Record.p_Template);
         //Cl_RecordPattern pattern = Cl_RecordsFacade.f_GetInstance().f_GetNewRecordPattern(a_Record);
         //pattern.p_ClinicName = Cl_SessionFacade.f_GetInstance().p_Doctor.p_ClinicName;
         //pattern.f_SetDoctor(Cl_SessionFacade.f_GetInstance().p_Doctor);
         var dlgPattern = new Dlg_RecordPattern();
         //dlgPattern.p_RecordPattern = pattern;
         dlgPattern.FormatPaternFromRecord(a_Record);
         dlgPattern.ShowDialog(this);
     }
 }