Beispiel #1
0
        public override void SetMasters(PaymentAppointment obj, NaznachenieVyplaty 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.Benefit != null &&
                (status == ObjectStatus.Created || attrs != null && attrs.Contains(PaymentAppointment.ConstBenefit)))
            {
                var val = new Lgota();
                val.SetExistObjectPrimaryKey(obj.Benefit.Guid);
                defDS.LoadObject(val);
                dobj.Lgota = val;
            }

            if (obj.Medium != null &&
                (status == ObjectStatus.Created || attrs != null && attrs.Contains(PaymentAppointment.ConstMedium)))
            {
                var leechnost = (Leechnost)MapperHelper.GetMaster(typeof(Leechnost), obj.Medium.Guid,
                                                                  defDS.Query <Leechnost>(Leechnost.Views.LeechnostE), syncDS, source, ref arrToUpd,
                                                                  ref arrConformity);
                dobj.Nositel = leechnost;
            }

            if (obj.Dependent != null &&
                (status == ObjectStatus.Created || attrs != null && attrs.Contains(PaymentAppointment.ConstDependent)))
            {
                var leechnost = (Leechnost)MapperHelper.GetMaster(typeof(Leechnost), obj.Dependent.Guid,
                                                                  defDS.Query <Leechnost>(Leechnost.Views.LeechnostE), syncDS, source, ref arrToUpd,
                                                                  ref arrConformity);
                dobj.Izhdivenetc = leechnost;
            }
        }
Beispiel #2
0
        public override IQueryable <DataObject> GetAltKey(PaymentAppointment dobj, IDataService defDS,
                                                          IDataService syncDS, Source source, ref List <DataObject> arrToUpd,
                                                          ref Dictionary <string, List <DataObject> > arrConformity)
        {
            var medium = MapperHelper.GetMaster(typeof(Leechnost), dobj.Medium.Guid,
                                                defDS.Query <Leechnost>(Leechnost.Views.LeechnostE), syncDS, source, ref arrToUpd, ref arrConformity);
            var benefit = new Lgota {
                __PrimaryKey = dobj.Benefit.Guid
            };

            var query = defDS.Query <NaznachenieVyplaty>(NaznachenieVyplaty.Views.NaznachenieVyplatyE).Where(x =>
                                                                                                             x.Lgota.__PrimaryKey.Equals(benefit.__PrimaryKey) &&
                                                                                                             x.Nositel.__PrimaryKey.Equals(medium.__PrimaryKey));

            if (dobj.Dependent != null)
            {
                var dependent = MapperHelper.GetMaster(typeof(Leechnost), dobj.Dependent.Guid,
                                                       defDS.Query <Leechnost>(Leechnost.Views.LeechnostE), syncDS, source, ref arrToUpd,
                                                       ref arrConformity);
                query = query.Where(x => x.Izhdivenetc.__PrimaryKey.Equals(dependent.__PrimaryKey));
            }
            else
            {
                query = query.Where(x => x.Izhdivenetc == null);
            }

            return(query);
        }
Beispiel #3
0
 public Humans(Lgota l, int _tarifNaOtoplenie = 20, int _tarifNaVodu = 16, int _tarifNaGaz = 15, int _tarifNaRemont = 25)
 {
     lgota            = l;
     tarifNaGaz       = _tarifNaGaz;
     tarifNaOtoplenie = _tarifNaOtoplenie;
     tarifNaVodu      = _tarifNaVodu;
     tarifNaRemont    = _tarifNaRemont;
 }
        public override void SetMasters(FactBenefits obj, FaktLgot 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.MediumBenefit != null &&
                (status == ObjectStatus.Created || attrs != null && attrs.Contains(FactBenefits.ConstMediumBenefit)))
            {
                var lgKatLeechnosti = (LgKatLeechnosti)MapperHelper.GetMaster(typeof(LgKatLeechnosti),
                                                                              obj.MediumBenefit.Guid, defDS.Query <LgKatLeechnosti>(LgKatLeechnosti.Views.LgKatLeechnostiE),
                                                                              syncDS, source, ref arrToUpd, ref arrConformity);
                dobj.NositelLgoty = lgKatLeechnosti;
            }

            if (obj.Dependent != null &&
                (status == ObjectStatus.Created || attrs != null && attrs.Contains(FactBenefits.ConstDependent)))
            {
                var leechnost = (Leechnost)MapperHelper.GetMaster(typeof(Leechnost), obj.Dependent.Guid,
                                                                  defDS.Query <Leechnost>(Leechnost.Views.LeechnostE), syncDS, source, ref arrToUpd,
                                                                  ref arrConformity);
                dobj.Izhdivenetc = leechnost;
            }

            if (obj.Recipient != null &&
                (status == ObjectStatus.Created || attrs != null && attrs.Contains(FactBenefits.ConstRecipient)))
            {
                var leechnost = (Leechnost)MapperHelper.GetMaster(typeof(Leechnost), obj.Recipient.Guid,
                                                                  defDS.Query <Leechnost>(Leechnost.Views.LeechnostE), syncDS, source, ref arrToUpd,
                                                                  ref arrConformity);
                dobj.Poluchatel = leechnost;
            }

            if (obj.Benefit != null &&
                (status == ObjectStatus.Created || attrs != null && attrs.Contains(FactBenefits.ConstBenefit)))
            {
                var val = new Lgota();
                val.SetExistObjectPrimaryKey(obj.Benefit.Guid);
                defDS.LoadObject(val);
                dobj.Lgota = val;
            }

            if (obj.SocialProtectionAuthority != null &&
                (status == ObjectStatus.Created ||
                 attrs != null && attrs.Contains(FactBenefits.ConstSocialProtectionAuthority)))
            {
                var val = new OrganSZ();
                val.SetExistObjectPrimaryKey(obj.SocialProtectionAuthority.Guid);
                defDS.LoadObject(val);
                dobj.OrganSZ = val;
            }

            if (obj.Period != null &&
                (status == ObjectStatus.Created || attrs != null && attrs.Contains(FactBenefits.ConstPeriod)))
            {
                var val = new Period();
                val.SetExistObjectPrimaryKey(obj.Period.Guid);
                defDS.LoadObject(val);
                dobj.Period = val;
            }
        }
        public override IQueryable <DataObject> GetAltKey(FactBenefits dobj, IDataService defDS, IDataService syncDS,
                                                          Source source, ref List <DataObject> arrToUpd, ref Dictionary <string, List <DataObject> > arrConformity)
        {
            var accrualDate     = (NullableDateTime)dobj.AccrualDate;
            var receiveDate     = (NullableDateTime)dobj.ReceiveDate;
            var lgKatLeechnosti = MapperHelper.GetMaster(typeof(LgKatLeechnosti), dobj.MediumBenefit.Guid,
                                                         defDS.Query <LgKatLeechnosti>(LgKatLeechnosti.Views.LgKatLeechnostiE), syncDS, source, ref arrToUpd,
                                                         ref arrConformity);
            var benefit = new Lgota {
                __PrimaryKey = dobj.Benefit.Guid
            };
            var organSZ = new OrganSZ {
                __PrimaryKey = dobj.SocialProtectionAuthority.Guid
            };

            var query = defDS.Query <FaktLgot>(FaktLgot.Views.FaktLgotE).Where(x =>
                                                                               x.DataNachisleniia == accrualDate &&
                                                                               x.DataPolucheniia == receiveDate &&
                                                                               x.NositelLgoty.__PrimaryKey.Equals(lgKatLeechnosti.__PrimaryKey) &&
                                                                               x.Lgota.__PrimaryKey.Equals(benefit.__PrimaryKey) &&
                                                                               x.OrganSZ.__PrimaryKey.Equals(organSZ.__PrimaryKey));

            if (dobj.Dependent != null)
            {
                var dependent = MapperHelper.GetMaster(typeof(Leechnost), dobj.Dependent.Guid,
                                                       defDS.Query <Leechnost>(Leechnost.Views.LeechnostE), syncDS, source, ref arrToUpd,
                                                       ref arrConformity);
                query = query.Where(x => x.Izhdivenetc.__PrimaryKey.Equals(dependent.__PrimaryKey));
            }
            else
            {
                query = query.Where(x => x.Izhdivenetc == null);
            }

            if (dobj.Recipient != null)
            {
                var poluchatel = MapperHelper.GetMaster(typeof(Leechnost), dobj.Recipient.Guid,
                                                        defDS.Query <Leechnost>(Leechnost.Views.LeechnostE), syncDS, source, ref arrToUpd,
                                                        ref arrConformity);
                query = query.Where(x => x.Poluchatel.__PrimaryKey.Equals(poluchatel.__PrimaryKey));
            }
            else
            {
                query = query.Where(x => x.Poluchatel == null);
            }


            if (dobj.Period != null)
            {
                var period = new Period {
                    __PrimaryKey = dobj.Period.Guid
                };
                query = query.Where(x => x.Period.__PrimaryKey.Equals(period.__PrimaryKey));
            }
            else
            {
                query = query.Where(x => x.Period == null);
            }

            return(query);
        }