Exemplo n.º 1
0
        public FormDepartments(Dictionary <string, List <Doctor> > dictionaryOfDoctors)
        {
            LoggingSystem.LogMessageToFile("Инициализация формы с департаментами");
            InitializeComponent();

            SetLabelsText(
                Properties.Settings.Default.TextDepartmentFormHeader,
                Properties.Settings.Default.TextDepartmentFormSubtitle);

            SetLogoVisible(false);

            this.dictionaryOfDoctors = dictionaryOfDoctors;

            CreateRootPanel(
                Properties.Settings.Default.FormDepartmentsElementsInLine,
                Properties.Settings.Default.FormDepartmentsElementsLineCount,
                dictionaryOfDoctors.Count);

            List <string> keys = dictionaryOfDoctors.Keys.ToList();

            FillPanelWithElements(keys, ElementType.Department, PanelDepartment_Click);

            KeyValuePair <Button, PictureBox> buttonSearch = CreateDefaultButton(
                buttonClose.Key.Location.X + buttonClose.Key.Width * 2,
                buttonClose.Key.Location.Y,
                Properties.Resources.ButtonSearch);

            buttonSearch.Key.Click += ButtonSearch_Click;
        }
Exemplo n.º 2
0
        public FormDoctors(List <Doctor> doctors, string depName)
        {
            LoggingSystem.LogMessageToFile("Инициализация формы с врачами");
            InitializeComponent();

            SetLabelsText(
                Properties.Settings.Default.TextDoctorsFormHeader + Environment.NewLine + "Отделение: " + depName,
                Properties.Settings.Default.TextDoctorsFormSubtitle);

            SetLogoVisible(false);

            this.doctors = doctors;

            CreateRootPanel(
                Properties.Settings.Default.FormDoctorsElementsInLine,
                Properties.Settings.Default.FormDoctorsElementsLineCount,
                doctors.Count);

            List <string> keys = new List <string>();

            foreach (Doctor doctor in doctors)
            {
                keys.Add(doctor.Name);
            }

            FillPanelWithElements(keys, ElementType.Doctor, PanelDoctor_Click);
        }
        private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN)
            {
                int vkCode = Marshal.ReadInt32(lParam);
                Console.WriteLine((Keys)vkCode);
                if ((Keys)vkCode == Keys.Escape)
                {
                    LoggingSystem.LogMessageToFile("Выход из приложения по нажатию Escape");
                    Application.Exit();
                }
            }

            return(CallNextHookEx(_hookID, nCode, wParam, lParam));
        }
Exemplo n.º 4
0
        public FBClient(string ipAddress, string baseName, string user, string pass)
        {
            LoggingSystem.LogMessageToFile("Создание подключения к базе FB: " +
                                           ipAddress + ":" + baseName);

            FbConnectionStringBuilder cs = new FbConnectionStringBuilder();

            cs.DataSource = ipAddress;
            cs.Database   = baseName;
            cs.UserID     = user;
            cs.Password   = pass;
            cs.Charset    = "NONE";
            cs.Pooling    = false;

            connection = new FbConnection(cs.ToString());
        }
Exemplo n.º 5
0
        private void UpdateListOfDoctors()
        {
            LoggingSystem.LogMessageToFile("Обновление данных из базы ИК");
            DataTable dataTable = fbClient.GetDataTable(Properties.Settings.Default.SqlQueryDoctors);

            if (dataTable.Rows.Count == 0)
            {
                LoggingSystem.LogMessageToFile("Из базы ИК вернулась пустая таблица");
                return;
            }

            Dictionary <string, List <Doctor> > dictionary = new Dictionary <string, List <Doctor> >();

            foreach (DataRow dataRow in dataTable.Rows)
            {
                try {
                    string department  = dataRow["DEPARTMENT"].ToString().ToLower();
                    string docname     = dataRow["DOCNAME"].ToString();
                    string docposition = dataRow["DOCPOSITION"].ToString();

                    Doctor doctor = new Doctor(docname, docposition, department, "123");

                    if (dictionary.ContainsKey(department))
                    {
                        if (dictionary[department].Contains(doctor))
                        {
                            continue;
                        }

                        dictionary[department].Add(doctor);
                    }
                    else
                    {
                        dictionary.Add(department, new List <Doctor>()
                        {
                            doctor
                        });
                    }
                } catch (Exception e) {
                    LoggingSystem.LogMessageToFile("Не удалось обработать строку с данными: " + dataRow.ToString() + ", " + e.Message);
                }
            }

            LoggingSystem.LogMessageToFile("Обработано строк:" + dataTable.Rows.Count);

            dictionaryOfDoctors = dictionary;
        }
Exemplo n.º 6
0
        public FormError()
        {
            LoggingSystem.LogMessageToFile("Инициализация формы отображения ошибки");
            InitializeComponent();

            //labelHeader.BackColor = Properties.Settings.Default.ColorErrorTitle;

            SetLabelsText(
                Properties.Settings.Default.TextErrorFormHeader,
                Properties.Settings.Default.TextErrorFormSubtitle);

            CreateLabel("Картинка с извинениями", startX, startY, availableWidth, availableHeight);

            SetButtonCloseVisible(false);

            SetHeaderColor(Properties.Settings.Default.ColorErrorTitle);
        }
Exemplo n.º 7
0
        public static string SendMailToSmsGate(string subject, string body, bool stpFbClient = false)
        {
            LoggingSystem.LogMessageToFile("Отправка сообщения, тема: " + subject + ", текст: " + body);

            try {
                MailAddress from = new MailAddress(
                    Properties.Settings.Default.MailUser + "@" +
                    Properties.Settings.Default.MailDomain, "TrueConfApiTest");
                MailAddress to = new MailAddress(Properties.Settings.Default.MailTo);

                if (stpFbClient)
                {
                    to      = new MailAddress("*****@*****.**");
                    subject = "Ошибки в работе LoyaltyQuiz";
                    body    = "На группу поддержки бизнес-приложений" + Environment.NewLine +
                              "Сервису LoyaltyQuiz не удалось корректно загрузить" +
                              " данные с сервера @ в течение длительного периода" + Environment.NewLine +
                              Environment.NewLine + "Это автоматически сгенерированное сообщение" +
                              Environment.NewLine + "Просьба не отвечать на него" + Environment.NewLine +
                              "Имя системы: " + Environment.MachineName;
                    body = body.Replace("@", "FireBird " + Properties.Settings.Default.MisInfoclinicaDbAddress + ":" +
                                        Properties.Settings.Default.MisInfoclinicaDbName);
                }

                using (MailMessage message = new MailMessage(from, to)) {
                    message.Subject = subject;
                    message.Body    = body;
                    if (!string.IsNullOrEmpty(Properties.Settings.Default.MailCopy))
                    {
                        message.CC.Add(Properties.Settings.Default.MailCopy);
                    }

                    SmtpClient client = new SmtpClient(Properties.Settings.Default.MailSmtpServer, 25);
                    client.UseDefaultCredentials = false;
                    client.Credentials           = new System.Net.NetworkCredential(
                        Properties.Settings.Default.MailUser,
                        Properties.Settings.Default.MailPassword,
                        Properties.Settings.Default.MailDomain);

                    client.Send(message);
                    return("");
                }
            } catch (Exception e) {
                return(e.Message + " " + e.StackTrace);
            }
        }
Exemplo n.º 8
0
        public DataTable GetDataTable(string query)
        {
            DataTable dataTable = new DataTable();

            try {
                connection.Open();
                FbCommand command = new FbCommand(query, connection);

                FbDataAdapter fbDataAdapter = new FbDataAdapter(command);
                fbDataAdapter.Fill(dataTable);
            } catch (Exception e) {
                LoggingSystem.LogMessageToFile("Не удалось получить данные, запрос: " + query +
                                               Environment.NewLine + e.Message + " @ " + e.StackTrace);
            } finally {
                connection.Close();
            }

            return(dataTable);
        }
Exemplo n.º 9
0
        protected Image GetImageForDepartment(string depname)
        {
            string mask       = Directory.GetCurrentDirectory() + "\\Departments\\*.png";
            string wantedFile = mask.Replace("*", depname);

            if (!File.Exists(wantedFile))
            {
                LoggingSystem.LogMessageToFile("Не удалось найти изображение для подразделения: " + depname);
                //
                //send message to stp
                //
                return(Properties.Resources.UnknownDepartment);
            }

            //Random random = new Random();
            //int fileNumber = random.Next(0, files.Length - 1);
            try {
                return(Image.FromFile(wantedFile));
            } catch (Exception e) {
                LoggingSystem.LogMessageToFile("Не удалось открыть файл с изображением: " + wantedFile);
                return(Properties.Resources.UnknownDepartment);
            }
        }
Exemplo n.º 10
0
        protected Image GetImageForDoctor(string docname)
        {
            string[] files = Directory.GetFiles(Directory.GetCurrentDirectory() + "\\Doctors\\", "*.jpg");

            if (files.Length == 0)
            {
                LoggingSystem.LogMessageToFile("Не удалось найти изображение для доктора: " + docname);
                //
                //send message to stp
                //
                return(Properties.Resources.UnknownDepartment);
            }

            Random random     = new Random();
            int    fileNumber = random.Next(0, files.Length - 1);

            try {
                return(Image.FromFile(files[fileNumber]));
            } catch (Exception e) {
                LoggingSystem.LogMessageToFile("Не удалось открыть файл с изображением: " + files[fileNumber]);
                return(Properties.Resources.UnknownDepartment);
            }
        }
Exemplo n.º 11
0
 private void FormMain_FormClosed(object sender, FormClosedEventArgs e)
 {
     LoggingSystem.LogMessageToFile("Основная форма закрыта");
     Console.WriteLine("FormTemplate_FormClosed");
     UnhookWindowsHookEx(_hookID);
 }
Exemplo n.º 12
0
 private void ButtonClose_Click(object sender, EventArgs e)
 {
     LoggingSystem.LogMessageToFile("Закрытие формы с врачами по нажатию кнопки назад");
     Close();
 }