コード例 #1
0
        public F_Main(string[] args)
        {
            try
            {
                this.FormClosing += F_Main_FormClosing;
                Tag = string.Format("Мегашаблон v{0}", ConfigurationManager.AppSettings["Version"]);
                if (Cl_App.Initialize())
                {
                    if (f_InitSession(args))
                    {
                        Cl_SessionFacade sess = Cl_SessionFacade.f_GetInstance();
                        Cl_EntityLog.f_CustomMessageLog(E_EntityTypes.AppEvents, string.Format("Запуск ЭМК. Пользователь: {0}/({1}). Пациент: {2}/({3})", sess.p_Doctor.f_GetInitials(), sess.p_Doctor.p_UserID, sess.p_Patient.f_GetInitials(), sess.p_Patient.p_UserID));


                        this.Font = new System.Drawing.Font(ConfigurationManager.AppSettings["FontFamily"],
                                                            float.Parse(ConfigurationManager.AppSettings["FontSize"]),
                                                            (System.Drawing.FontStyle) int.Parse(ConfigurationManager.AppSettings["FontStyle"]),
                                                            System.Drawing.GraphicsUnit.Point, ((byte)(204)));
                        InitializeComponent();

                        string rolesVal = "";
                        var    role     = Cl_SessionFacade.f_GetInstance().p_Doctor.p_Permission.p_Role;
                        var    memInfo  = typeof(E_Roles).GetMember(typeof(E_Roles).GetEnumName(role));
                        var    descriptionAttributes = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);
                        if (descriptionAttributes.Length > 0)
                        {
                            rolesVal = ((DescriptionAttribute)descriptionAttributes[0]).Description;
                        }

                        ctrlSessionInfo.Text = string.Format("Пользователь: {0}, {1} | Расположение: {2}", Cl_SessionFacade.f_GetInstance().p_Doctor.p_FIO, rolesVal, Cl_SessionFacade.f_GetInstance().p_Doctor.p_ClinicName);

                        p_PanelManager = new UI_PanelManager(ctrl_CustomControls);
                        bool visibleEditor = false;
                        visibleEditor       |= menuMegaTemplate.Visible = Cl_SessionFacade.f_GetInstance().p_Doctor.p_Permission.p_IsEditMegaTemplates;
                        visibleEditor       |= menuTemplate.Visible = Cl_SessionFacade.f_GetInstance().p_Doctor.p_Permission.p_IsEditTemplates;
                        visibleEditor       |= menuMegaTemplateDeleted.Visible = Cl_SessionFacade.f_GetInstance().p_Doctor.p_Permission.p_IsShowDeleted;
                        visibleEditor       |= menuCatalogs.Visible = Cl_SessionFacade.f_GetInstance().p_Doctor.p_Permission.p_IsEditCatalogs;
                        visibleEditor       |= menuPatterns.Visible = Cl_SessionFacade.f_GetInstance().p_Doctor.p_Permission.p_IsEditAllRecords || Cl_SessionFacade.f_GetInstance().p_Doctor.p_Permission.p_IsEditSelfRecords;
                        ctrlMIEditor.Visible = visibleEditor;

                        ctrlMISettingsPrint.Checked = Cl_SessionFacade.f_GetInstance().p_SettingsPrintWithParams;

                        f_SetControl <UC_Records>();
                    }
                    else
                    {
                        Application.Exit();
                    }
                }
                else
                {
                    Application.Exit();
                }
            } catch (Exception er)
            {
                MonitoringStub.Error("Error_App", "В приложении возникла ошибка", er, null, null);
            }
        }
コード例 #2
0
 public F_Welcome()
 {
     InitializeComponent();
     if (Cl_App.Initialize())
     {
         f_InitValues();
     }
     else
     {
         Application.Exit();
     }
 }