/// <summary>
        /// Загрузить список карт обследования
        /// </summary>
        private void Load()
        {
            _brachialPlexusCardList = new List <CBrachialPlexusCard>();
            string allDataStr = CDatabaseEngine.UnpackText(_brachialPlexusCardPath);

            // Получаем набор объектов
            string[] objectsStr = allDataStr.Split(new[] { ObjSplitStr }, StringSplitOptions.RemoveEmptyEntries);

            var errorStr = new StringBuilder();

            try
            {
                // Проходим по всем объектам
                foreach (string objectStr in objectsStr)
                {
                    // Для каждого объекта получаем список значений
                    string[] datasStr = objectStr.Split(new[] { DataSplitStr }, StringSplitOptions.RemoveEmptyEntries);

                    var brachialPlexusCardInfo = new CBrachialPlexusCard();
                    foreach (string dataStr in datasStr)
                    {
                        string[] keyValue = dataStr.Split(new[] { '=' }, 2);
                        switch (keyValue[0])
                        {
                        case "HospitalizationId":
                            brachialPlexusCardInfo.HospitalizationId = Convert.ToInt32(keyValue[1]);
                            break;

                        case "VisitId":
                            brachialPlexusCardInfo.VisitId = Convert.ToInt32(keyValue[1]);
                            break;

                        case "Diaphragm":
                            brachialPlexusCardInfo.Diaphragm = keyValue[1];
                            break;

                        case "EMNG":
                            brachialPlexusCardInfo.EMNG = keyValue[1];
                            break;

                        case "EMNGDate":
                            brachialPlexusCardInfo.EMNGDate = CConvertEngine.StringToDateTime(keyValue[1]);
                            break;

                        case "HornersSyndrome":
                            brachialPlexusCardInfo.HornersSyndrome = keyValue[1];
                            break;

                        case "IsEMNGEnabled":
                            brachialPlexusCardInfo.IsEMNGEnabled = Convert.ToBoolean(keyValue[1]);
                            break;

                        case "IsMyelographyEnabled":
                            brachialPlexusCardInfo.IsMyelographyEnabled = Convert.ToBoolean(keyValue[1]);
                            break;

                        case "Myelography":
                            brachialPlexusCardInfo.Myelography = keyValue[1];
                            break;

                        case "MyelographyDate":
                            brachialPlexusCardInfo.MyelographyDate = CConvertEngine.StringToDateTime(keyValue[1]);
                            break;

                        case "MyelographyType":
                            brachialPlexusCardInfo.MyelographyType = keyValue[1];
                            break;

                        case "TinelsSymptom":
                            brachialPlexusCardInfo.TinelsSymptom = keyValue[1];
                            break;

                        case "VascularStatus":
                            brachialPlexusCardInfo.VascularStatus = keyValue[1];
                            break;

                        case "CardSide":
                            brachialPlexusCardInfo.SideOfCard = CConvertEngine.StringToCardSide(keyValue[1]);
                            break;
                        }
                    }

                    string picturePath = GetPicturePath(brachialPlexusCardInfo.GetPictureFileName());
                    if (!File.Exists(picturePath))
                    {
                        PutDefaultPictureFile(picturePath);
                    }

                    brachialPlexusCardInfo.Picture = CDatabaseEngine.GetBitmapFromFile(picturePath);

                    _brachialPlexusCardList.Add(brachialPlexusCardInfo);
                }
            }
            catch (Exception ex)
            {
                errorStr.Append(ex.Message + "\r\n");
            }

            if (errorStr.Length != 0)
            {
                MessageBox.ShowDialog(errorStr.ToString());
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Загрузить список карт обследования
        /// </summary>
        private void Load()
        {
            _cardList = new List <CCard>();
            string allDataStr = CDatabaseEngine.UnpackText(_cardPath);

            // Получаем набор объектов
            string[] objectsStr = allDataStr.Split(new[] { ObjSplitStr }, StringSplitOptions.RemoveEmptyEntries);

            var errorStr = new StringBuilder();

            try
            {
                // Проходим по всем объектам
                foreach (string objectStr in objectsStr)
                {
                    // Для каждого объекта получаем список значений
                    string[] datasStr = objectStr.Split(new[] { DataSplitStr }, StringSplitOptions.RemoveEmptyEntries);

                    var cardInfo = new CCard();
                    foreach (string dataStr in datasStr)
                    {
                        string[] keyValue = dataStr.Split(new[] { '=' }, 2);
                        switch (keyValue[0])
                        {
                        case "HospitalizationId":
                            cardInfo.HospitalizationId = Convert.ToInt32(keyValue[1]);
                            break;

                        case "VisitId":
                            cardInfo.VisitId = Convert.ToInt32(keyValue[1]);
                            break;

                        case "CardSide":
                            cardInfo.CurrentSideOfCard = CConvertEngine.StringToCardSide(keyValue[1]);
                            break;

                        case "CurrentCardType":
                            cardInfo.CurrentCardType = CConvertEngine.StringToCardType(keyValue[1]);
                            break;
                        }
                    }

                    string picturePath = GetPicturePath(cardInfo.GetPictureFileName());
                    if (!File.Exists(picturePath))
                    {
                        PutDefaultPictureFile(cardInfo.CurrentCardType, picturePath);
                    }

                    cardInfo.Picture = CDatabaseEngine.GetBitmapFromFile(picturePath);

                    _cardList.Add(cardInfo);
                }
            }
            catch (Exception ex)
            {
                errorStr.Append(ex.Message + "\r\n");
            }

            if (errorStr.Length != 0)
            {
                MessageBox.ShowDialog(errorStr.ToString());
            }
        }