示例#1
0
        public void Create()
        {
            try
            {
                rt.srz.model.srz.Document entity = CreateNew();

                object result = manager.Save(entity);

                Assert.IsNotNull(result);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
示例#2
0
        public void Read()
        {
            try
            {
                rt.srz.model.srz.Document entityA = CreateNew();
                manager.Save(entityA);

                rt.srz.model.srz.Document entityB = manager.GetById(entityA.Id);

                Assert.AreEqual(entityA, entityB);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
示例#3
0
        public static Document CreateNew(int depth = 0)
        {
            rt.srz.model.srz.Document entity = new rt.srz.model.srz.Document();

            // You may need to maually enter this key if there is a constraint violation.
            entity.Id = System.Guid.NewGuid();

            entity.Series           = "Test Test Te";
            entity.Number           = "Test T";
            entity.IssuingAuthority = "Test Test ";
            entity.DateIssue        = System.DateTime.Now;
            entity.DateExp          = System.DateTime.Now;
            entity.IsBad            = true;

            using (rt.srz.business.manager.IConceptManager conceptManager = ObjectFactory.GetInstance <IConceptManager>())
            {
                entity.DocumentType = null;
            }

            return(entity);
        }
示例#4
0
        public void Delete()
        {
            try
            {
                rt.srz.model.srz.Document entityC = CreateNew();
                manager.Save(entityC);
                manager.Session.GetISession().Flush();
                manager.Session.GetISession().Clear();

                rt.srz.model.srz.Document entity = GetFirstDocument();

                manager.Delete(entity);

                entity = manager.GetById(entity.Id);
                Assert.IsNull(entity);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
示例#5
0
        public void Update()
        {
            try
            {
                rt.srz.model.srz.Document entityC = CreateNew();
                manager.Save(entityC);
                manager.Session.GetISession().Flush();
                manager.Session.GetISession().Clear();

                rt.srz.model.srz.Document entityA = GetFirstDocument();

                entityA.Series = "Test Tes";

                manager.Update(entityA);

                rt.srz.model.srz.Document entityB = manager.GetById(entityA.Id);

                Assert.AreEqual(entityA.Series, entityB.Series);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
示例#6
0
        /// <summary>
        /// Расчитывает и сохраняет пользовательские ключи для заявления
        /// </summary>
        /// <param name="keyTypeList">
        /// The key Type List.
        /// </param>
        /// <param name="pd">
        /// The pd.
        /// </param>
        /// <param name="doc">
        /// The doc.
        /// </param>
        /// <param name="addr1">
        /// The addr 1.
        /// </param>
        /// <param name="addr2">
        /// The addr 2.
        /// </param>
        /// <param name="medicalInsurances">
        /// The medical Insurances.
        /// </param>
        /// <param name="okato">
        /// The okato.
        /// </param>
        /// <returns>
        /// The <see cref="IList{SearchKey}"/>.
        /// </returns>
        public IList <SearchKey> CalculateUserKeys(
            IList <SearchKeyType> keyTypeList,
            InsuredPersonDatum pd,
            Document doc,
            address addr1,
            address addr2,
            IList <MedicalInsurance> medicalInsurances,
            string okato)
        {
            var result = new List <SearchKey>();

            foreach (var kt in keyTypeList)
            {
                // Перекодирование типа ключа
                var keyType = new database.business.model.SearchKeyType
                {
                    RowId                = kt.Id,
                    FirstName            = kt.FirstName,
                    LastName             = kt.LastName,
                    MiddleName           = kt.MiddleName,
                    Birthday             = kt.Birthday,
                    Birthplace           = kt.Birthplace,
                    Snils                = kt.Snils,
                    DocumentType         = kt.DocumentType,
                    DocumentSeries       = kt.DocumentSeries,
                    DocumentNumber       = kt.DocumentNumber,
                    Okato                = kt.Okato,
                    PolisType            = kt.PolisType,
                    PolisSeria           = kt.PolisSeria,
                    PolisNumber          = kt.PolisNumber,
                    FirstNameLength      = kt.FirstNameLength,
                    LastNameLength       = kt.LastNameLength,
                    MiddleNameLength     = kt.MiddleNameLength,
                    BirthdayLength       = kt.BirthdayLength,
                    AddressStreet        = kt.AddressStreet,
                    AddressStreetLength  = kt.AddressStreetLength,
                    AddressHouse         = kt.AddressHouse,
                    AddressRoom          = kt.AddressRoom,
                    AddressStreet2       = kt.AddressStreet2,
                    AddressStreetLength2 = kt.AddressStreetLength2,
                    AddressHouse2        = kt.AddressHouse2,
                    AddressRoom2         = kt.AddressRoom2,
                    IdenticalLetters     = kt.IdenticalLetters
                };

                // Перекодировка персональных данных
                var personData = new database.business.model.InsuredPersonDatum
                {
                    RowId      = pd.Id,
                    LastName   = pd.LastName,
                    FirstName  = pd.FirstName,
                    MiddleName = pd.MiddleName,
                    Birthday   = pd.Birthday,
                    Birthplace = pd.Birthplace,
                    Snils      = pd.Snils,
                };

                // Перекодировка документа
                database.business.model.Document document = null;
                if (doc != null && doc.DocumentType != null)
                {
                    document = new database.business.model.Document
                    {
                        RowId          = doc.Id,
                        DocumentTypeId = doc.DocumentType.Id,
                        Series         = doc.Series,
                        Number         = doc.Number,
                    };
                }

                // Перекодировка адреса регистрации
                var address1 = new database.business.model.address
                {
                    RowId  = addr1.Id,
                    Street = addr1.Street,
                    House  = addr1.House,
                    Room   = addr1.Room,
                    Okato  = addr1.Okato,
                };

                // Перекодировка адреса проживания
                database.business.model.address address2 = null;
                if (addr2 != null)
                {
                    address2 = new database.business.model.address
                    {
                        RowId  = addr2.Id,
                        Street = addr2.Street,
                        House  = addr2.House,
                        Room   = addr2.Room,
                        Okato  = addr2.Okato,
                    };
                }

                // Перекодировка страховок
                foreach (var medicalInsurance in medicalInsurances)
                {
                    var insurance = new database.business.model.MedicalInsurance
                    {
                        RowId       = medicalInsurance.Id,
                        PolisTypeId = medicalInsurance.PolisType.Id,
                        PolisSeria  = medicalInsurance.PolisSeria,
                        PolisNumber = medicalInsurance.PolisNumber,
                    };

                    // Расчет ключа
                    var keyValue = database.business.ObjectFactory.GetPseudonymizationManager()
                                   .CalculateUserSearchKey(
                        keyType,
                        personData,
                        document,
                        address1,
                        address2,
                        insurance,
                        okato);

                    var conceptCacheManager = ObjectFactory.GetInstance <IConceptCacheManager>();
                    var searchKey           = new SearchKey
                    {
                        KeyValue        = keyValue,
                        KeyType         = kt,
                        DocumentUdlType =
                            doc != null && doc.DocumentType != null
                                ? conceptCacheManager.GetById(doc.DocumentType.Id)
                                : null
                    };

                    result.Add(searchKey);
                }
            }

            return(result);
        }