Example #1
0
 /// <summary>
 ///     Конструктор
 /// </summary>
 public PersonJuridical()
 {
     GovermentCompany = false;
     CompanyName      = new Attribute();
     CompanyNameInParentNominative = new Attribute();
 }
Example #2
0
 /// <summary>
 ///     Конструктор
 /// </summary>
 /// <param name="id">ID лица</param>
 public PersonJuridical(string id) : base(id)
 {
     CompanyName = new Attribute();
     CompanyNameInParentNominative = new Attribute();
     GovermentCompany = false;
 }
 /// <summary>
 ///     Конструктор
 /// </summary>
 /// <param name="id">ID лица</param>
 public PersonNatural(string id)
     : base(id)
 {
     NameReg = new Attribute();
     NameLat = new Attribute();
 }
 /// <summary>
 ///     Конструктор
 /// </summary>
 public PersonNatural()
 {
     NameReg = new Attribute();
     NameLat = new Attribute();
 }
Example #5
0
        /// <summary>
        /// </summary>
        /// <param name="sectionID"></param>
        /// <param name="showOldValues"></param>
        public void LoadPeronInfoFromDoisser(int sectionID, bool showOldValues)
        {
            var contextList = new List <DossierContext>();
            var sqlParams   = new Dictionary <string, object>
            {
                { "@КодЛица", Id.ToInt() }, { "@DateOld", showOldValues ? 1 : 0 }
            };

            if (sectionID != 0)
            {
                sqlParams.Add("@КодВкладки", sectionID);
            }
            using (var dbReader = new DBReader(SQLQueries.SP_Лица_Досье_Context_NEW, CommandType.StoredProcedure, CN,
                                               sqlParams))
            {
                if (dbReader.HasRows)
                {
                    //Unavailable = true;
                    //return;

                    Unavailable = false;
                    //Досье
                    while (dbReader.Read())
                    {
                        if (!dbReader.HasRows)
                        {
                            continue;
                        }
                        if (!dbReader.IsDBNull(dbReader.GetOrdinal("Надпись")) &&
                            dbReader.GetString(dbReader.GetOrdinal("Надпись")) == "ТипЛица")
                        {
                            IsNaturalPerson = dbReader.GetString(dbReader.GetOrdinal("Поле")) == "2";
                        }
                        else
                        {
                            var tempContext = new DossierContext();
                            tempContext.LoadFromDbReader(dbReader);
                            contextList.Add(tempContext);
                        }
                    }
                }


                //Атрибуты
                if ((sectionID == 0 || sectionID == 41) && dbReader.NextResult())
                {
                    PersonAttributes = new List <Attribute>();
                    while (dbReader.Read())
                    {
                        if (dbReader.HasRows)
                        {
                            var tempAttribute = new Attribute();
                            tempAttribute.FillDataFromDataRow(dbReader, true);
                            PersonAttributes.Add(tempAttribute);
                        }
                    }
                }

                //Темы и типы
                if ((sectionID == 0 || sectionID == 42) && dbReader.NextResult())
                {
                    PersonTypes = new List <PersonType>();
                    while (dbReader.Read())
                    {
                        if (dbReader.HasRows)
                        {
                            var tempType = new PersonType();
                            tempType.FillDataFromDataReader(dbReader, true);
                            PersonTypes.Add(tempType);
                        }
                    }
                }

                if (PersonTypes.Count == 0 && PersonAttributes.Count == 0 && contextList.Count == 0)
                {
                    Unavailable = true;
                    return;
                }
            }


            if (sectionID == 0)
            {
                PersonInfo          = contextList.Where(t => t.КодВкладки == (IsNaturalPerson ? 2 : 1)).Select(t => t).ToList();
                PersonContacts      = contextList.Where(t => t.КодВкладки == 7 || t.КодВкладки == 8).Select(t => t).ToList();
                ResponsibleEmployes =
                    contextList.Where(t => t.КодВкладки == 3 || t.КодВкладки == 4).Select(t => t).ToList();
                PersonLinks =
                    contextList.Where(
                        t =>
                        t.КодВкладки == 11 || t.КодВкладки == 12 || t.КодВкладки == 13 || t.КодВкладки == 14 ||
                        t.КодВкладки == 15 || t.КодВкладки == 16 || t.КодВкладки == 17 || t.КодВкладки == 18)
                    .Select(
                        t => t).ToList();

                PersonStores =
                    contextList.Where(
                        t =>
                        t.КодВкладки == 19 || t.КодВкладки == 20 || t.КодВкладки == 21 || t.КодВкладки == 23 ||
                        t.КодВкладки == 40 || t.КодВкладки == 24 || t.КодВкладки == 22 || t.КодВкладки == 25)
                    .Select(
                        t => t).ToList();
            }
            else
            {
                if (sectionID == 7 || sectionID == 8)
                {
                    PersonContacts.RemoveAll(r => r.КодВкладки == sectionID);
                    PersonContacts.AddRange(contextList.Where(t => t.КодВкладки == sectionID).Select(t => t));
                }
                else if (sectionID == 3 || sectionID == 4)
                {
                    ResponsibleEmployes.RemoveAll(r => r.КодВкладки == sectionID);
                    ResponsibleEmployes.AddRange(contextList.Where(t => t.КодВкладки == sectionID).Select(t => t));
                }
                else if (sectionID == 11 || sectionID == 12 || sectionID == 13 || sectionID == 14 || sectionID == 15 ||
                         sectionID == 16 || sectionID == 17 || sectionID == 18)
                {
                    PersonLinks.RemoveAll(r => r.КодВкладки == sectionID);
                    PersonLinks.AddRange(contextList.Where(t => t.КодВкладки == sectionID).Select(t => t));
                }
                else if (sectionID == 19 || sectionID == 20 || sectionID == 21 || sectionID == 22 || sectionID == 23 ||
                         sectionID == 24 || sectionID == 25 || sectionID == 40)
                {
                    PersonStores.RemoveAll(r => r.КодВкладки == sectionID);
                    PersonStores.AddRange(contextList.Where(t => t.КодВкладки == sectionID).Select(t => t));
                }
                else if (sectionID == 1 || sectionID == 2)
                {
                    PersonInfo.RemoveAll(r => r.КодВкладки == (IsNaturalPerson ? 2 : 1));
                    PersonInfo.AddRange(
                        contextList.Where(t => t.КодВкладки == (IsNaturalPerson ? 2 : 1)).Select(t => t));
                }
                else
                {
                    PersonInfo.RemoveAll(r => r.КодВкладки == sectionID);
                    PersonInfo.AddRange(contextList.Where(t => t.КодВкладки == sectionID).Select(t => t));
                }
            }
        }