public override Act Map(StatiaAkta source, Act dest)
        {
            if (!PKHelper.GetGuidByObject(source).HasValue)
            {
                throw new ArgumentNullException(nameof(source));
            }

            dest.Guid     = PKHelper.GetGuidByObject(source).Value;
            dest.Id       = source.Oldid;
            dest.Number   = source.Nomer;
            dest.Comments = source.Kommentarii;
            dest.Benefit  = source.Lgota;
            dest.Code     = source.Kod;

            if (source.Akt != null)
            {
                dest.LegalAct = new SyncXMLDataObject()
                {
                    Guid = PKHelper.GetGuidByObject(source.Akt).Value
                };
            }

            dest.CreateTime = source.CreateTime;
            dest.Creator    = source.Creator;
            dest.EditTime   = source.EditTime;
            dest.Editor     = source.Editor;

            return(dest);
        }
Beispiel #2
0
        public override KindDocument Map(VidUdostDok source, KindDocument dest)
        {
            if (!PKHelper.GetGuidByObject(source).HasValue)
            {
                throw new ArgumentNullException(nameof(source));
            }

            dest.Guid             = PKHelper.GetGuidByObject(source).Value;
            dest.Id               = source.Oldid;
            dest.Name             = source.Naimenovanie;
            dest.ShortName        = source.KratkoeNaimenovanie;
            dest.CodePF           = source.KodPF;
            dest.Priority         = (int)source.Prioritet;
            dest.CodeKindDocument = source.KodVidaDokumenta;
            dest.PriorityFNS      = (int)source.PrioritetDliaFNS;

            if (source.TipUdostDok != null)
            {
                dest.TypeDocument = new SyncXMLDataObject()
                {
                    Guid = PKHelper.GetGuidByObject(source.TipUdostDok).Value
                };
            }

            dest.CreateTime = source.CreateTime;
            dest.Creator    = source.Creator;
            dest.EditTime   = source.EditTime;
            dest.Editor     = source.Editor;

            return(dest);
        }
Beispiel #3
0
        public override FamilyRelation Map(RodstvOtn source, FamilyRelation dest)
        {
            if (!PKHelper.GetGuidByObject(source).HasValue)
            {
                throw new ArgumentNullException(nameof(source));
            }

            dest.Guid = PKHelper.GetGuidByObject(source).Value;
            dest.Id   = source.Oldid;
            dest.Name = source.Naimenovanie;

            switch (source.Pol)
            {
            case tPol.Muzhskoi:
                dest.Gender = tGender.Muzhskoi;
                break;

            case tPol.Zhenskii:
                dest.Gender = tGender.Zhenskii;
                break;
            }

            dest.CreateTime = source.CreateTime;
            dest.Creator    = source.Creator;
            dest.EditTime   = source.EditTime;
            dest.Editor     = source.Editor;

            return(dest);
        }
        public override AuthorityIssuedDocument Map(OrganVydDok source, AuthorityIssuedDocument dest)
        {
            if (!PKHelper.GetGuidByObject(source).HasValue)
            {
                throw new ArgumentNullException(nameof(source));
            }

            dest.Guid        = PKHelper.GetGuidByObject(source).Value;
            dest.Id          = source.Oldid;
            dest.Name        = source.Naimenovanie;
            dest.Address     = source.Adres;
            dest.PhoneNumber = source.Telefon;

            if (source.OrganSZ != null)
            {
                dest.SocialProtectionAuthority = new SyncXMLDataObject()
                {
                    Guid = PKHelper.GetGuidByObject(source.OrganSZ).Value
                };
            }

            dest.CreateTime = source.CreateTime;
            dest.Creator    = source.Creator;
            dest.EditTime   = source.EditTime;
            dest.Editor     = source.Editor;

            return(dest);
        }
Beispiel #5
0
        public override DeregestrationReason Map(PrichinaSnyatiya source, DeregestrationReason dest)
        {
            if (!PKHelper.GetGuidByObject(source).HasValue)
            {
                throw new ArgumentNullException(nameof(source));
            }

            dest.Guid = PKHelper.GetGuidByObject(source).Value;
            dest.Id   = source.Oldid;
            dest.Name = source.Naimenovanie;

            switch (source.PrekraschVyiplatyi)
            {
            case tLogicheskii.Net:
                dest.Discontinuation = tBool.Нет;
                break;

            case tLogicheskii.Da:
                dest.Discontinuation = tBool.Да;
                break;
            }

            dest.CreateTime = source.CreateTime;
            dest.Creator    = source.Creator;
            dest.EditTime   = source.EditTime;
            dest.Editor     = source.Editor;

            return(dest);
        }
        public void GetGuidByObjectСравнениеGuid()
        {
            var obj = PKHelper.CreateDataObject <DataObjectForTest>(g1);

            Assert.True(
                PKHelper.EQPK(g1, PKHelper.GetGuidByObject(obj)),
                "Возвращенный Guid не равен исходному.");
        }
Beispiel #7
0
        public override B Map(A source, B dest)
        {
            dest.Guid = PKHelper.GetGuidByObject(source).Value;
            dest.x    = source.x;
            dest.y    = source.y + 4;

            return(dest);
        }
        public void GetKeysStringСписокИзОдногоЭлемента()
        {
            var list = new List <DataObjectForTest> {
                doft1
            };
            string res = string.Join(",", list.Select(o => $"'{PKHelper.GetGuidByObject(o)}'"));

            Assert.Equal(res, PKHelper.GetKeysString(list));
        }
        public void GetKeysStringParamsDataObject()
        {
            var list = new List <DataObjectForTest> {
                doft1, doft2
            };
            string res = string.Join(",", list.Select(o => $"'{PKHelper.GetGuidByObject(o)}'"));

            Assert.Equal(res, PKHelper.GetKeysString(doft1, doft2));
        }
        public void GetKeysStringParamsKeyGuid()
        {
            var list = new List <KeyGuid> {
                kg1, kg2
            };
            string res = string.Join(",", list.Select(o => $"'{PKHelper.GetGuidByObject(o)}'"));

            Assert.Equal(res, PKHelper.GetKeysString(kg1, kg2));
        }
        public void GetKeysStringParamsString()
        {
            var list = new List <string> {
                str1, str2
            };
            string res = string.Join(",", list.Select(o => $"'{PKHelper.GetGuidByObject(o)}'"));

            Assert.Equal(res, PKHelper.GetKeysString(str1, str2));
        }
        public void GetKeysStringParamsFull()
        {
            var list = new List <object> {
                g1, kg2, doft1, str1
            };
            string res = string.Join(",", list.Select(o => $"'{PKHelper.GetGuidByObject(o)}'"));

            Assert.Equal(res, PKHelper.GetKeysString(g1, kg2, doft1, str1));
        }
Beispiel #13
0
        public override Territory Map(Territoriia source, Territory dest)
        {
            if (!PKHelper.GetGuidByObject(source).HasValue)
            {
                throw new ArgumentNullException(nameof(source));
            }

            dest.Guid       = PKHelper.GetGuidByObject(source).Value;
            dest.Id         = source.Oldid;
            dest.FIAS       = source.KodFIAS;
            dest.ObjectType = source.VidObekta;
            dest.Name       = source.Naimenovanie;
            dest.PostIndex  = source.PochtIndeks;

            if (source.Ierarhiia != null)
            {
                dest.Parent = new SyncXMLDataObject()
                {
                    Guid = PKHelper.GetGuidByObject(source.Ierarhiia).Value
                };
            }

            if (source.OrganSZ != null)
            {
                dest.SocialProtectionAuthority = new SyncXMLDataObject()
                {
                    Guid = PKHelper.GetGuidByObject(source.OrganSZ).Value
                };
            }

            dest.CodeSPA   = source.KodSZ;
            dest.CodeKLADR = source.KodCLADR;
            dest.CodeOKATO = source.KodOKATO;

            switch (source.GorRaion)
            {
            case tLogicheskii.Net:
                dest.UrbanArea = tBool.Нет;
                break;

            case tLogicheskii.Da:
                dest.UrbanArea = tBool.Да;
                break;
            }

            dest.RegionCodePF = source.KodRegionaPF;
            dest.CodeOKTMO    = source.KodOKTMO;
            dest.CodeOPFR     = source.KodOPFR;

            dest.CreateTime = source.CreateTime;
            dest.Creator    = source.Creator;
            dest.EditTime   = source.EditTime;
            dest.Editor     = source.Editor;

            return(dest);
        }
 public override KindDocument Map(VidUdostDok source, KindDocument dest)
 {
     dest.Guid = PKHelper.GetGuidByObject(source).Value;
     if (source.Naimenovanie?.Length > 80)
     {
         throw new ArgumentOutOfRangeException($"{nameof(source.Naimenovanie)} more than 80 symbols!");
     }
     dest.KindDocName = source.Naimenovanie;
     return(dest);
 }
        public void GetKeysStringIEnumerableGuid()
        {
            var list = new List <Guid>
            {
                g1,
                g2
            };
            string res = string.Join(",", list.Select(o => $"'{PKHelper.GetGuidByObject(o)}'"));

            Assert.Equal(res, PKHelper.GetKeysString(list));
        }
        public void GetKeysStringIEnumerableFull()
        {
            var list = new List <object>
            {
                g1,
                kg1,
                doft0,
                str1
            };
            string res = string.Join(",", list.Select(o => $"'{PKHelper.GetGuidByObject(o)}'"));

            Assert.Equal(res, PKHelper.GetKeysString(list));
        }
Beispiel #17
0
        public override Territory Map(Territoriia source, Territory dest)
        {
            dest.Guid       = PKHelper.GetGuidByObject(source).Value;
            dest.FIAS       = source.KodFIAS;
            dest.ObjectType = source.VidObekta;
            if (source.Naimenovanie?.Length > 255)
            {
                throw new ArgumentOutOfRangeException($"{nameof(source.Naimenovanie)} more than 255 symbols!");
            }
            dest.Name      = source.Naimenovanie;
            dest.PostIndex = source.PochtIndeks;

            return(dest);
        }
Beispiel #18
0
        public override Benefit Map(Lgota source, Benefit dest)
        {
            if (!PKHelper.GetGuidByObject(source).HasValue)
            {
                throw new ArgumentNullException(nameof(source));
            }

            dest.Guid = PKHelper.GetGuidByObject(source).Value;
            dest.Id   = source.Oldid;
            dest.Name = source.Naimenovanie;

            switch (source.VclVSotcPaket)
            {
            case tLogicheskii.Net:
                dest.InSocialPackage = tBool.Нет;
                break;

            case tLogicheskii.Da:
                dest.InSocialPackage = tBool.Да;
                break;
            }

            dest.CodeIncome = source.KodDohoda;
            dest.TaxedNDFL  = source.OblagNDFL == tLogicheskii.Da ? tBool.Да : tBool.Нет;
            dest.TaxedESN   = source.OblagESN == tLogicheskii.Da ? tBool.Да : tBool.Нет;

            if (source.Ierarhiia != null)
            {
                dest.Parent = new SyncXMLDataObject()
                {
                    Guid = PKHelper.GetGuidByObject(source.Ierarhiia).Value
                };
            }

            if (source.Tip != null)
            {
                dest.TypeBenefit = new SyncXMLDataObject()
                {
                    Guid = PKHelper.GetGuidByObject(source.Tip).Value
                };
            }

            dest.CreateTime = source.CreateTime;
            dest.Creator    = source.Creator;
            dest.EditTime   = source.EditTime;
            dest.Editor     = source.Editor;

            return(dest);
        }
Beispiel #19
0
        public override GovernmentLevel Map(UrovenVlasti source, GovernmentLevel dest)
        {
            if (!PKHelper.GetGuidByObject(source).HasValue)
            {
                throw new ArgumentNullException(nameof(source));
            }

            dest.Guid = PKHelper.GetGuidByObject(source).Value;
            dest.Id   = source.Oldid;
            dest.Name = source.Naimenovanie;

            dest.CreateTime = source.CreateTime;
            dest.Creator    = source.Creator;
            dest.EditTime   = source.EditTime;
            dest.Editor     = source.Editor;

            return(dest);
        }
        public override TypeBenefit Map(TipLgoty source, TypeBenefit dest)
        {
            if (!PKHelper.GetGuidByObject(source).HasValue)
            {
                throw new ArgumentNullException(nameof(source));
            }

            dest.Guid = PKHelper.GetGuidByObject(source).Value;
            dest.Id   = source.Oldid;
            dest.Name = source.Naimenovanie;

            dest.CreateTime = source.CreateTime;
            dest.Creator    = source.Creator;
            dest.EditTime   = source.EditTime;
            dest.Editor     = source.Editor;

            return(dest);
        }
        public override DisplacementReason Map(PrichinaPeremeshcheniia source, DisplacementReason dest)
        {
            if (!PKHelper.GetGuidByObject(source).HasValue)
            {
                throw new ArgumentNullException(nameof(source));
            }

            dest.Guid = PKHelper.GetGuidByObject(source).Value;
            dest.Id   = source.Oldid;
            dest.Name = source.Naimenovanie;

            dest.CreateTime = source.CreateTime;
            dest.Creator    = source.Creator;
            dest.EditTime   = source.EditTime;
            dest.Editor     = source.Editor;

            return(dest);
        }
Beispiel #22
0
        public override FundingSource Map(IstochnikFin source, FundingSource dest)
        {
            if (!PKHelper.GetGuidByObject(source).HasValue)
            {
                throw new ArgumentNullException(nameof(source));
            }

            dest.Guid = PKHelper.GetGuidByObject(source).Value;
            dest.Id   = source.Oldid;
            dest.Name = source.Naimenovanie;

            dest.CreateTime = source.CreateTime;
            dest.Creator    = source.Creator;
            dest.EditTime   = source.EditTime;
            dest.Editor     = source.Editor;

            return(dest);
        }
Beispiel #23
0
        private static string GetErrorText(SyncDOEntity syncEntity)
        {
            var text = $"Ошибка: обнаружена запись SyncDOEntity({PKHelper.GetGuidByObject(syncEntity)})";

            if (syncEntity.ObjectPrimaryKey == null)
            {
                text = $"{text} с пустым ключом на изменившийся объкт.";
            }
            else if (!syncEntity.Date.HasValue)
            {
                text = $"{text} с пустой датой изменения.";
            }
            else if (!syncEntity.AuditChangePK.HasValue)
            {
                text = $"{text} с пустым ключом на соответствующую запись изменения аудита.";
            }

            return(text);
        }
Beispiel #24
0
        public override LegalAct Map(NormAkt source, LegalAct dest)
        {
            if (!PKHelper.GetGuidByObject(source).HasValue)
            {
                throw new ArgumentNullException(nameof(source));
            }

            dest.Guid   = PKHelper.GetGuidByObject(source).Value;
            dest.Id     = source.Oldid;
            dest.Name   = source.Naimenovanie;
            dest.Number = source.Nomer;

            if (source.DataPodpisaniia.HasValue)
            {
                dest.SignatureDate = source.DataPodpisaniia.Value;
            }

            dest.CodeReportFK = source.KodOtchFedKaznach;

            if (source.Tip != null)
            {
                dest.TypeLegalAct = new SyncXMLDataObject()
                {
                    Guid = PKHelper.GetGuidByObject(source.Tip).Value
                };
            }

            if (source.Izdatel != null)
            {
                dest.NamePublisher = new SyncXMLDataObject()
                {
                    Guid = PKHelper.GetGuidByObject(source.Izdatel).Value
                };
            }

            dest.CreateTime = source.CreateTime;
            dest.Creator    = source.Creator;
            dest.EditTime   = source.EditTime;
            dest.Editor     = source.Editor;

            return(dest);
        }
        public override ServiceBus.ObjectDataModel.ToTU.Specialist Map(Specialist source, ServiceBus.ObjectDataModel.ToTU.Specialist dest)
        {
            if (!PKHelper.GetGuidByObject(source).HasValue)
            {
                throw new ArgumentNullException(nameof(source));
            }

            dest.Guid       = PKHelper.GetGuidByObject(source).Value;
            dest.Id         = source.Oldid;
            dest.FamilyName = source.Familiya;
            dest.FirstName  = source.Imya;
            dest.Patronymic = source.Otchestvo;

            switch (source.RukOrganaCZ)
            {
            case tLogicheskii.Net:
                dest.ChiefSPA = tBool.Нет;
                break;

            case tLogicheskii.Da:
                dest.ChiefSPA = tBool.Да;
                break;
            }

            if (source.OrganSZ != null)
            {
                dest.SocialProtectionAuthority = new SyncXMLDataObject()
                {
                    Guid = PKHelper.GetGuidByObject(source.OrganSZ).Value
                };
            }

            dest.Login = source.Agent.Login;

            dest.CreateTime = source.CreateTime;
            dest.Creator    = source.Creator;
            dest.EditTime   = source.EditTime;
            dest.Editor     = source.Editor;

            return(dest);
        }
Beispiel #26
0
        public override Street Map(Ulitca source, Street dest)
        {
            dest.Guid       = PKHelper.GetGuidByObject(source).Value;
            dest.FIAS       = source.KodFIAS;
            dest.ObjectType = source.VidObekta;
            if (source.Naimenovanie?.Length > 255)
            {
                throw new ArgumentOutOfRangeException($"{nameof(source.Naimenovanie)} more than 80 symbols!");
            }
            dest.Name      = source.Naimenovanie;
            dest.PostIndex = source.PochtIndeks;
            if (source.Territoriia != null)
            {
                dest.Territory = new Territory()
                {
                    Guid = PKHelper.GetGuidByObject(source.Territoriia).Value
                };
            }

            return(dest);
        }
Beispiel #27
0
        public override Street Map(Ulitca source, Street dest)
        {
            if (!PKHelper.GetGuidByObject(source).HasValue)
            {
                throw new ArgumentNullException(nameof(source));
            }

            dest.Guid       = PKHelper.GetGuidByObject(source).Value;
            dest.Id         = source.Oldid;
            dest.PostIndex  = source.PochtIndeks;
            dest.CodeCLADR  = source.KodCLADR;
            dest.Name       = source.Naimenovanie;
            dest.CodeGR     = (int)source.KodGR;
            dest.ObjectType = source.VidObekta;
            dest.CodeFIAS   = source.KodFIAS;

            if (source.NovoeNazv != null)
            {
                dest.NewName = new SyncXMLDataObject()
                {
                    Guid = PKHelper.GetGuidByObject(source.NovoeNazv).Value
                };
            }

            if (source.Territoriia != null)
            {
                dest.Territory = new SyncXMLDataObject()
                {
                    Guid = PKHelper.GetGuidByObject(source.Territoriia).Value
                };
            }

            dest.CreateTime = source.CreateTime;
            dest.Creator    = source.Creator;
            dest.EditTime   = source.EditTime;
            dest.Editor     = source.Editor;

            return(dest);
        }
        public override Country Map(Strana source, Country dest)
        {
            if (!PKHelper.GetGuidByObject(source).HasValue)
            {
                throw new ArgumentNullException(nameof(source));
            }

            dest.Guid        = PKHelper.GetGuidByObject(source).Value;
            dest.Id          = source.Oldid;
            dest.FullName    = source.PolnoeNaimenovanie;
            dest.ShortName   = source.KratkoeNaimenovanie;
            dest.NumericCode = (int)source.TcifrKod;
            dest.CodeAlpha2  = source.BukvKodAlfa2;
            dest.CodeAlpha3  = source.BukvKodAlfa3;

            dest.CreateTime = source.CreateTime;
            dest.Creator    = source.Creator;
            dest.EditTime   = source.EditTime;
            dest.Editor     = source.Editor;

            return(dest);
        }
        public override Location Map(Prozhivanie source, Location dest)
        {
            dest.Guid = PKHelper.GetGuidByObject(source).Value;
            if (source.NomerDoma == null)
            {
                throw new ArgumentNullException(nameof(Prozhivanie.NomerDoma));
            }
            dest.Number      = source.NomerDoma.Value;
            dest.HouseNumber = source.NomerStroeniia;
            dest.Index       = source.PochtIndeks;
            dest.Appartment  = source.Kvartira;
            dest.Phone       = source.Telefon;
            if (source.Territoriia != null)
            {
                dest.Territory = new Territory()
                {
                    Guid = PKHelper.GetGuidByObject(source.Territoriia).Value
                };
            }


            return(dest);
        }
Beispiel #30
0
        public override PreferentialCategory Map(LgotKat source, PreferentialCategory dest)
        {
            if (!PKHelper.GetGuidByObject(source).HasValue)
            {
                throw new ArgumentNullException(nameof(source));
            }

            dest.Guid = PKHelper.GetGuidByObject(source).Value;
            dest.Id   = source.Oldid;
            dest.Name = source.Naimenovanie;

            switch (source.Invalidnost)
            {
            case tLogicheskii.Net:
                dest.Disability = tBool.Нет;
                break;

            case tLogicheskii.Da:
                dest.Disability = tBool.Да;
                break;
            }

            if (source.Ierarhiia != null)
            {
                dest.Parent = new SyncXMLDataObject()
                {
                    Guid = PKHelper.GetGuidByObject(source.Ierarhiia).Value
                };
            }

            dest.CreateTime = source.CreateTime;
            dest.Creator    = source.Creator;
            dest.EditTime   = source.EditTime;
            dest.Editor     = source.Editor;

            return(dest);
        }