protected override void CommandBody(SqlCommand command)
        {
            command.CommandText = base.StoredProcedureName;
            command.CommandType = CommandType.StoredProcedure;
            SqlParameter serviceProviderId = command.Parameters.Add("@ServiceId", SqlDbType.BigInt);

            if (!this._serviceProvider.Id.HasValue)
            {
                serviceProviderId.Value = -1;
            }
            else
            {
                serviceProviderId.Value = this._serviceProvider.Id;
            }
            command.Parameters.Add("@ScopeServiceId", SqlDbType.BigInt).Direction = ParameterDirection.Output;
            command.Parameters.Add("@BookId", SqlDbType.Int).Value              = this._serviceProvider.Book.Id;
            command.Parameters.Add("@Name", SqlDbType.VarChar).Value            = this._serviceProvider.Name;
            command.Parameters.Add("@Description", SqlDbType.VarChar).Value     = this._serviceProvider.Description ?? string.Empty;
            command.Parameters.Add("@WebsiteURL", SqlDbType.VarChar, 200).Value = this._serviceProvider.WebsiteUrl.ValueOrDBNull <string>();
            command.Parameters.Add("@IsDisplayWebsiteURL", SqlDbType.Bit).Value = this._serviceProvider.DisplayWebsiteUrl;
            command.Parameters.Add("@IsDisplayAddress", SqlDbType.Bit).Value    = this._serviceProvider.DisplayAddress;
            command.Parameters.Add("@IsAutoProvision", SqlDbType.Bit).Value     = this._serviceProvider.CallTrackingPhones.Any <CallTrackingPhone>();
            command.Parameters.Add("@UserId", SqlDbType.UniqueIdentifier).Value = this._serviceProvider.UserId;
            command.Parameters.Add("@IsActive", SqlDbType.Bit).Value            = true;
            command.Parameters.Add("@AddressTable", SqlDbType.Structured).Value = this._serviceProvider.Address.GetAddressTable();
            command.Parameters.Add("@PhoneTable", SqlDbType.Structured).Value   = this._serviceProvider.Phones.GetPhoneTable();
            command.Parameters.Add("@emailTable", SqlDbType.Structured).Value   = this._serviceProvider.Emails.GetEmailTable();
            command.Parameters.Add("@ContactTable", SqlDbType.Structured).Value = this._serviceProvider.Contacts.GetContactTable();
            SqlParameter sqlParameter      = command.Parameters.Add("@PackageTable", SqlDbType.Structured);
            DataTable    packageTableValue = this._serviceProvider.Package.GetAdditionalInfoTable(true);

            sqlParameter.Value = packageTableValue;
            SqlParameter sqlParameter1            = command.Parameters.Add("@SeniorHousingAndCareCategoryTable", SqlDbType.Structured);
            DataTable    housingAndCareTableValue = (
                from sc in this._serviceProvider.ServiceCategories
                select sc.Key).GetSeniorHousingAdditionalInfoTable(true);

            sqlParameter1.Value = housingAndCareTableValue;
            command.Parameters.Add("@ServiceOfficeHoursTable", SqlDbType.Structured).Value = this._serviceProvider.OfficeHours.GetOfficeHoursTable();
            SqlParameter sqlParameter2     = command.Parameters.Add("@PaymentTable", SqlDbType.Structured);
            DataTable    paymentTableValue = this._serviceProvider.PaymentTypeIds.GetPaymentAdditionalInfoTable(true);

            sqlParameter2.Value = paymentTableValue;
            SqlParameter sqlParameter3    = command.Parameters.Add("@CouponTable", SqlDbType.Structured);
            DataTable    couponTableValue = this._serviceProvider.Coupon.GetAdditionalInfoTable(this._couponTypeId);

            sqlParameter3.Value = couponTableValue;
            SqlParameter sqlParameter4     = command.Parameters.Add("@FeatureTable", SqlDbType.Structured);
            DataTable    featureTableValue = TableParamsExtensions.GetDateTable(this._serviceProvider.FeatureStartDate, this._serviceProvider.FeatureEndDate, new AdditionalInfoClass?(AdditionalInfoClass.Feature), this._featureTypeId);

            sqlParameter4.Value = featureTableValue;
            SqlParameter sqlParameter5     = command.Parameters.Add("@PublishTable", SqlDbType.Structured);
            DataTable    publishTableValue = TableParamsExtensions.GetDateTable(this._serviceProvider.PublishStartDate, this._serviceProvider.PublishEndDate, new AdditionalInfoClass?(AdditionalInfoClass.Publish), this._publishTypeId);

            sqlParameter5.Value = publishTableValue;
            command.Parameters.Add("@ImageTable", SqlDbType.Structured).Value = this._serviceProvider.Images.GetImageTable();
            command.Parameters.Add("@ServiceCountiesServedTable", SqlDbType.Structured).Value = this._serviceProvider.CountiesServed.GetServiceCountiesServedTable();
            command.ExecuteNonQuery();
        }
Esempio n. 2
0
        protected override void CommandBody(SqlCommand command)
        {
            command.CommandText = base.StoredProcedureName;
            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add("@UserId", SqlDbType.UniqueIdentifier).Value          = ConfigurationManager.Instance.CurrentUserId;
            command.Parameters.Add("@DateTimeStamp", SqlDbType.DateTime).Value           = DateTime.Now;
            command.Parameters.Add("@CommunityId", SqlDbType.BigInt).Value               = this._communityId;
            command.Parameters.Add("@CommunityUnitId", SqlDbType.BigInt).Value           = DBNull.Value;
            command.Parameters.Add("@ServiceId", SqlDbType.BigInt).Value                 = DBNull.Value;
            command.Parameters.Add("@AdditionalInformationClassId", SqlDbType.Int).Value = 7;
            SqlParameter sqlParameter             = command.Parameters.Add("@AdditionalInformationTable", SqlDbType.Structured);
            DataTable    additionalInfoTableValue = TableParamsExtensions.GetDateTable(this._startDate, this._endDate, new AdditionalInfoClass?(AdditionalInfoClass.Showcase), this._showcaseTypeId);

            sqlParameter.Value = additionalInfoTableValue;
            command.ExecuteNonQuery();
        }
Esempio n. 3
0
        protected override void CommandBody(SqlCommand command)
        {
            object valueOrDefault;
            object value;

            command.CommandText = base.StoredProcedureName;
            command.CommandType = CommandType.StoredProcedure;
            SqlParameter communityId = command.Parameters.Add("@CommunityId", SqlDbType.BigInt);
            long?        id          = this._community.Id;

            if (!id.HasValue)
            {
                communityId.Value = -1;
            }
            else
            {
                communityId.Value = this._community.Id;
            }
            command.Parameters.Add("@BookId", SqlDbType.Int).Value                         = this._community.Book.Id;
            command.Parameters.Add("@HasAdultHomes", SqlDbType.Bit).Value                  = this.HasListingType(this._community.ListingTypes, ListingType.ActiveAdultHomes);
            command.Parameters.Add("@HasAdultApartments", SqlDbType.Bit).Value             = this.HasListingType(this._community.ListingTypes, ListingType.ActiveAdultCommunities);
            command.Parameters.Add("@HasSeniorHousing", SqlDbType.Bit).Value               = this.HasListingType(this._community.ListingTypes, ListingType.SeniorHousingAndCare);
            command.Parameters.Add("@IsAllAges", SqlDbType.Bit).Value                      = this._community.AgeRestrictions.Contains(AgeRestriction.AllAges);
            command.Parameters.Add("@IsAgeTargeted", SqlDbType.Bit).Value                  = this._community.AgeRestrictions.Contains(AgeRestriction.AgeTargeted);
            command.Parameters.Add("@IsAgeQualified", SqlDbType.Bit).Value                 = this._community.AgeRestrictions.Contains(AgeRestriction.AgeQualified);
            command.Parameters.Add("@Name", SqlDbType.VarChar, 50).Value                   = this._community.Name ?? string.Empty;
            command.Parameters.Add("@Description", SqlDbType.VarChar).Value                = this._community.Description ?? string.Empty;
            command.Parameters.Add("@WebsiteURL", SqlDbType.VarChar, 200).Value            = this._community.WebsiteUrl ?? string.Empty;
            command.Parameters.Add("@IsDisplayWebsiteURL", SqlDbType.Bit).Value            = this._community.DisplayWebsiteUrl;
            command.Parameters.Add("@IsDisplayAddress", SqlDbType.Bit).Value               = this._community.DisplayAddress;
            command.Parameters.Add("@PricedFrom", SqlDbType.Money).Value                   = this._community.PriceRange.Min.ValueOrDBNull <decimal?>();
            command.Parameters.Add("@PricedTo", SqlDbType.Money).Value                     = this._community.PriceRange.Max.ValueOrDBNull <decimal?>();
            command.Parameters.Add("@PriceCurrencyTypeId", SqlDbType.Int).Value            = (int)this._community.PriceRange.Measure;
            command.Parameters.Add("@DepositFrom", SqlDbType.Money).Value                  = this._community.Deposit.Min.ValueOrDBNull <decimal?>();
            command.Parameters.Add("@DepositTo", SqlDbType.Money).Value                    = this._community.Deposit.Max.ValueOrDBNull <decimal?>();
            command.Parameters.Add("@DepositCurrencyTypeId", SqlDbType.Int).Value          = (int)this._community.Deposit.Measure;
            command.Parameters.Add("@ApplicationFeeFrom", SqlDbType.Money).Value           = this._community.ApplicationFee.Min.ValueOrDBNull <decimal?>();
            command.Parameters.Add("@ApplicationFeeTo", SqlDbType.Money).Value             = this._community.ApplicationFee.Max.ValueOrDBNull <decimal?>();
            command.Parameters.Add("@ApplicationFeeCurrencyTypeId", SqlDbType.Int).Value   = (int)this._community.ApplicationFee.Measure;
            command.Parameters.Add("@PetDepositFrom", SqlDbType.Money).Value               = this._community.PetDeposit.Min.ValueOrDBNull <decimal?>();
            command.Parameters.Add("@PetDepositTo", SqlDbType.Money).Value                 = this._community.PetDeposit.Max.ValueOrDBNull <decimal?>();
            command.Parameters.Add("@PetDepositCurrencyTypeId", SqlDbType.Int).Value       = (int)this._community.PetDeposit.Measure;
            command.Parameters.Add("@LivingSpaceFrom", SqlDbType.Int).Value                = this._community.LivingSpace.Min.ValueOrDBNull <int?>();
            command.Parameters.Add("@LivingSpaceTo", SqlDbType.Int).Value                  = this._community.LivingSpace.Max.ValueOrDBNull <int?>();
            command.Parameters.Add("@BathroomFromId", SqlDbType.Int).Value                 = this._community.BathroomFromId.ValueOrDBNull <long?>();
            command.Parameters.Add("@LivingSpaceUnitOfMeasureTypeId", SqlDbType.Int).Value = (int)this._community.LivingSpace.Measure;
            command.Parameters.Add("@BathroomToId", SqlDbType.Int).Value                   = this._community.BathroomToId.ValueOrDBNull <long?>();
            command.Parameters.Add("@BedroomFromId", SqlDbType.Int).Value                  = this._community.BedroomFromId.ValueOrDBNull <long?>();
            command.Parameters.Add("@BedroomToId", SqlDbType.Int).Value                    = this._community.BedroomToId.ValueOrDBNull <long?>();
            command.Parameters.Add("@UnitCount", SqlDbType.Int).Value                      = this._community.UnitCount.ValueOrDBNull <int?>();
            SqlParameter sqlParameter = command.Parameters.Add("@PMCId", SqlDbType.BigInt);

            if (this._community.PropertyManager != null)
            {
                id = this._community.PropertyManager.Id;
                if (id.HasValue)
                {
                    valueOrDefault = id.GetValueOrDefault();
                }
                else
                {
                    valueOrDefault = DBNull.Value;
                }
            }
            else
            {
                valueOrDefault = DBNull.Value;
            }
            sqlParameter.Value = valueOrDefault;
            SqlParameter sqlParameter1 = command.Parameters.Add("@BuilderId", SqlDbType.BigInt);

            if (this._community.Builder != null)
            {
                id = this._community.Builder.Id;
                if (id.HasValue)
                {
                    value = id.GetValueOrDefault();
                }
                else
                {
                    value = DBNull.Value;
                }
            }
            else
            {
                value = DBNull.Value;
            }
            sqlParameter1.Value = value;
            command.Parameters.Add("@IsAutoProvision", SqlDbType.Bit).Value         = this._community.CallTrackingPhones.Any <CallTrackingPhone>();
            command.Parameters.Add("@IsActive", SqlDbType.Bit).Value                = true;
            command.Parameters.Add("@UserId", SqlDbType.UniqueIdentifier).Value     = this._community.UserId;
            command.Parameters.Add("@iTourURL", SqlDbType.VarChar, 200).Value       = this._community.VirtualTour.ValueOrDBNull <string>();
            command.Parameters.Add("@ScopeCommunityId", SqlDbType.BigInt).Direction = ParameterDirection.Output;
            command.Parameters.Add("@AddressTable", SqlDbType.Structured).Value     = this._community.Address.GetAddressTable();
            command.Parameters.Add("@CommonPhoneTable", SqlDbType.Structured).Value = this._community.Phones.GetPhoneTable();
            command.Parameters.Add("@emailTable", SqlDbType.Structured).Value       = this._community.Emails.GetEmailTable();
            command.Parameters.Add("@ContactTable", SqlDbType.Structured).Value     = this._community.Contacts.GetContactTable();
            SqlParameter sqlParameter2     = command.Parameters.Add("@PackageTable", SqlDbType.Structured);
            DataTable    packageTableValue = this._community.Package.GetAdditionalInfoTable(false);

            sqlParameter2.Value = packageTableValue;
            SqlParameter sqlParameter3            = command.Parameters.Add("@SeniorHousingAndCareCategoryTable", SqlDbType.Structured);
            DataTable    housingAndCareTableValue = this._community.SeniorHousingAndCareCategoryIds.GetSeniorHousingAdditionalInfoTable(false);

            sqlParameter3.Value = housingAndCareTableValue;
            command.Parameters.Add("@CommunityOfficeHoursTable", SqlDbType.Structured).Value = this._community.OfficeHours.GetOfficeHoursTable();
            SqlParameter sqlParameter4     = command.Parameters.Add("@PaymentTable", SqlDbType.Structured);
            DataTable    paymentTableValue = this._community.PaymentTypeIds.GetPaymentAdditionalInfoTable(false);

            sqlParameter4.Value = paymentTableValue;
            command.Parameters.Add("@AmenityTable", SqlDbType.Structured).Value = this._community.Amenities.GetAmenityTable();
            SqlParameter sqlParameter5     = command.Parameters.Add("@ServiceTable", SqlDbType.Structured);
            DataTable    serviceTableValue = this._community.CommunityServices.GetAdditionalInfoTable(this._customCommunityServiceTypeId);

            sqlParameter5.Value = serviceTableValue;
            SqlParameter imageTable = command.Parameters.Add("@ImageTable", SqlDbType.Structured);
            List <Image> images     = new List <Image>(this._community.Images);

            images.AddRange(this._community.LogoImages);
            imageTable.Value = images.GetImageTable();
            SqlParameter sqlParameter6    = command.Parameters.Add("@CouponTable", SqlDbType.Structured);
            DataTable    couponTableValue = this._community.Coupon.GetAdditionalInfoTable(this._couponTypeId);

            sqlParameter6.Value = couponTableValue;
            SqlParameter sqlParameter7           = command.Parameters.Add("@CommunityUnitTable", SqlDbType.Structured);
            DataTable    communityUnitTableValue = TableParamsExtensions.GetCommunityUnitTable(this._community.FloorPlans, this._community.SpecHomes, this._community.Houses);

            sqlParameter7.Value = communityUnitTableValue;
            SqlParameter sqlParameter8    = command.Parameters.Add("@PublishTable", SqlDbType.Structured);
            DataTable    publishDateValue = TableParamsExtensions.GetDateTable(this._community.Publishing.StartDate, this._community.Publishing.EndDate, new AdditionalInfoClass?(AdditionalInfoClass.Publish), this._publishTypeId);

            sqlParameter8.Value = publishDateValue;
            SqlParameter sqlParameter9     = command.Parameters.Add("@ShowcaseTable", SqlDbType.Structured);
            DataTable    showcaseDateValue = TableParamsExtensions.GetDateTable(this._community.Showcase.StartDate, this._community.Showcase.EndDate, new AdditionalInfoClass?(AdditionalInfoClass.Showcase), this._showcaseTypeId);

            sqlParameter9.Value = showcaseDateValue;
            command.ExecuteNonQuery();
        }