public override void SetMasters(Movement obj, Peremeshchenie dobj, List <string> attrs, IDataService defDS,
                                        IDataService syncDS, Source source, ref List <DataObject> arrToUpd,
                                        ref Dictionary <string, List <DataObject> > arrConformity)
        {
            var status = dobj.GetStatus();

            if (obj.DepatureAddress != null &&
                (status == ObjectStatus.Created || attrs != null && attrs.Contains(Movement.ConstDepatureAddress)))
            {
                var address = Helper.GetProzhivanie(obj.DepatureAddress, defDS, syncDS, source, ref arrToUpd,
                                                    ref arrConformity);
                var adr = new Prozhivanie();
                adr.SetExistObjectPrimaryKey(address.__PrimaryKey);
                adr.SetStatus(ObjectStatus.UnAltered);
                dobj.AdresUbytiia = adr;
            }

            if (obj.MovementCause != null &&
                (status == ObjectStatus.Created || attrs != null && attrs.Contains(Movement.ConstMovementCause)))
            {
                var val = new PrichinaPeremeshcheniia();
                val.SetExistObjectPrimaryKey(obj.MovementCause.Guid);
                defDS.LoadObject(val);
                dobj.PrichinaPeremeshcheniia = val;
            }

            if (status == ObjectStatus.Created || attrs != null && attrs.Contains(Movement.ConstBeneficiary))
            {
                var leechnost = (Leechnost)MapperHelper.GetMaster(typeof(Leechnost), obj.Beneficiary.Guid,
                                                                  defDS.Query <Leechnost>(Leechnost.Views.LeechnostE), syncDS, source, ref arrToUpd,
                                                                  ref arrConformity);
                dobj.Leechnost = leechnost;
            }
        }
Пример #2
0
        public override void SetMasters(Beneficiary beneficiary, Leechnost dest, List <string> attrs, IDataService defDS,
                                        IDataService syncDS, Source source, ref List <DataObject> arrToUpd,
                                        ref Dictionary <string, List <DataObject> > arrConformity)
        {
            var status = dest.GetStatus();

            if (beneficiary.Location != null &&
                (status == ObjectStatus.Created || attrs != null && attrs.Contains(Beneficiary.ConstLocation)))
            {
                var prozivanie = Helper.GetProzhivanie(beneficiary.Location, defDS, syncDS, source, ref arrToUpd,
                                                       ref arrConformity);
                var address = new Prozhivanie();
                address.SetExistObjectPrimaryKey(prozivanie.__PrimaryKey);
                address.SetStatus(ObjectStatus.UnAltered);
                dest.Prozhivanie = address;
            }

            if (beneficiary.Registration != null &&
                (status == ObjectStatus.Created || attrs != null && attrs.Contains(Beneficiary.ConstRegistration)))
            {
                var propiska = Helper.GetProzhivanie(beneficiary.Registration, defDS, syncDS, source,
                                                     ref arrToUpd, ref arrConformity);
                var address = new Prozhivanie();
                address.SetExistObjectPrimaryKey(propiska.__PrimaryKey);
                address.SetStatus(ObjectStatus.UnAltered);
                dest.Propiska = address;
            }

            if (beneficiary.Citizenship != null &&
                (status == ObjectStatus.Created || attrs != null && attrs.Contains(Beneficiary.ConstCitizenship)))
            {
                var val = new Strana();
                val.SetExistObjectPrimaryKey(beneficiary.Citizenship.Guid);
                defDS.LoadObject(val);
                dest.Grazhdanstvo = val;
            }
        }