Пример #1
0
        public IQueryable <NewListingView> GetPrimaryListingOK()
        {
            using (JazMax.DataAccess.JazMaxDBProdContext db = new DataAccess.JazMaxDBProdContext())
            {
                List <NewListingView> view = new List <NewListingView>();

                #region Joins Query
                var query = (from a in db.PropertyListings
                             join b in db.PropertyListingDetails
                             on a.PropertyListingId equals b.PropertyListingId

                             select new
                {
                    a.PropertyListingId,
                    a.FriendlyName,
                    b.RatesAndTaxes,
                    b.NumberOfBathRooms,
                    b.NumberOfBedrooms,
                    b.NumberOfGarages,
                    b.NumberOfSquareMeters,
                }).ToList().AsQueryable();
                #endregion


                foreach (var item in query)
                {
                    #region Property Listing View
                    PropertyListingView list = new PropertyListingView()
                    {
                        PropertyListingId = item.PropertyListingId,
                        FriendlyName      = item.FriendlyName,
                    };
                    #endregion
                    #region Details View
                    PropertyListingDetailView details = new PropertyListingDetailView()
                    {
                        RatesAndTaxes        = item.RatesAndTaxes,
                        NumberOfBathRooms    = item.NumberOfBathRooms,
                        NumberOfBedrooms     = item.NumberOfBedrooms,
                        NumberOfGarages      = item.NumberOfGarages,
                        NumberOfSquareMeters = item.NumberOfSquareMeters,
                    };
                    #endregion



                    #region NewList
                    NewListingView lists = new NewListingView()
                    {
                        PropertyListingView       = list,
                        PropertyListingDetailView = details,
                    };
                    #endregion


                    view.Add(lists);
                }
                return(view.AsQueryable());
            }
        }
Пример #2
0
 public void UpdateListingDetail(PropertyListingDetailView model, int PropertyListingId)
 {
     try
     {
         using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
         {
             var Details = db.PropertyListingDetails.FirstOrDefault(x => x.PropertyListingDetailId == model.PropertyListingDetailId);
             Details.RatesAndTaxes        = model.RatesAndTaxes;
             Details.NumberOfBathRooms    = model.NumberOfBathRooms;
             Details.NumberOfBedrooms     = model.NumberOfBedrooms;
             Details.NumberOfGarages      = model.NumberOfGarages;
             Details.NumberOfSquareMeters = model.NumberOfSquareMeters;
             Details.PropertyListingId    = PropertyListingId;
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
     }
 }
Пример #3
0
 private void CaptureListingDetail(PropertyListingDetailView model, int PropetyListingId)
 {
     try
     {
         using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
         {
             DataAccess.PropertyListingDetail table = new DataAccess.PropertyListingDetail()
             {
                 RatesAndTaxes        = model.RatesAndTaxes,
                 NumberOfBathRooms    = model.NumberOfBathRooms,
                 NumberOfBedrooms     = model.NumberOfBedrooms,
                 NumberOfGarages      = model.NumberOfGarages,
                 NumberOfSquareMeters = model.NumberOfSquareMeters,
                 PropertyListingId    = PropetyListingId,
             };
             db.PropertyListingDetails.Add(table);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
     }
 }
Пример #4
0
        //private static JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext();
        #region GetLists

        public IQueryable <NewListingView> GetPrimaryListing()
        {
            using (JazMax.DataAccess.JazMaxDBProdContext db = new DataAccess.JazMaxDBProdContext())
            {
                List <NewListingView> view = new List <NewListingView>();

                #region Joins Query
                var query = (from a in db.PropertyListings
                             join b in db.PropertyListingAgents
                             on a.PropertyListingId equals b.PropertyListingId
                             join c in db.PropertyListingDetails
                             on a.PropertyListingId equals c.PropertyListingId
                             join d in db.ProprtyListingYoutubeLibraries
                             on a.PropertyListingId equals d.PrfoprtyListingId
                             join e in db.ProprtyListingFeatures
                             on a.PropertyListingId equals e.PropertyListingId
                             select new
                {
                    a.PropertyListingId,
                    a.BranchId,
                    a.FriendlyName,
                    a.ProprtyDesciption,
                    a.IsListingActive,
                    a.PropertyListingPricingTypeId,
                    a.Price,
                    a.PropertyTypeId,
                    a.LastUpdate,
                    a.ListingDate,
                    a.ProvinceId,
                    b.AgentId,
                    b.IsActive,
                    c.RatesAndTaxes,
                    c.NumberOfBathRooms,
                    c.NumberOfBedrooms,
                    c.NumberOfGarages,
                    c.NumberOfSquareMeters,
                    d.YoutubeVideoLink,
                    e.PropertyFeatureId,
                }).ToList().AsQueryable();
                #endregion


                foreach (var item in query)
                {
                    #region Property Listing View
                    PropertyListingView list = new PropertyListingView()
                    {
                        PropertyListingId            = item.PropertyListingId,
                        BranchId                     = item.BranchId,
                        FriendlyName                 = item.FriendlyName,
                        IsListingActive              = item.IsListingActive,
                        PropertyListingPricingTypeId = item.PropertyListingPricingTypeId,
                        Price             = item.Price,
                        PropertyTypeId    = item.PropertyTypeId,
                        LastUpdate        = item.LastUpdate,
                        ListingDate       = item.ListingDate,
                        ProvinceId        = item.ProvinceId,
                        ProprtyDesciption = item.ProprtyDesciption
                    };
                    #endregion

                    #region Agent View
                    PropertyListingAgentsView agent = new PropertyListingAgentsView()
                    {
                        AgentId  = item.AgentId,
                        IsActive = item.IsActive,
                    };
                    #endregion

                    #region Details View
                    PropertyListingDetailView details = new PropertyListingDetailView()
                    {
                        RatesAndTaxes        = item.RatesAndTaxes,
                        NumberOfBathRooms    = item.NumberOfBathRooms,
                        NumberOfBedrooms     = item.NumberOfBedrooms,
                        NumberOfGarages      = item.NumberOfGarages,
                        NumberOfSquareMeters = item.NumberOfSquareMeters,
                    };
                    #endregion

                    #region Youtube View
                    PropertyListingYoutubeView youtube = new PropertyListingYoutubeView()
                    {
                        YoutubeVideoLink = item.YoutubeVideoLink,
                    };

                    #endregion

                    #region Features View
                    PropertyListingFeatureView feature = new PropertyListingFeatureView()
                    {
                        PropertyFeatureId = item.PropertyFeatureId,
                    };
                    #endregion

                    #region NewList
                    NewListingView lists = new NewListingView()
                    {
                        PropertyListingView        = list,
                        PropertyListingAgentsView  = agent,
                        PropertyListingDetailView  = details,
                        PropertyListingYoutubeView = youtube,
                        PropertyListingFeatureView = feature,
                    };
                    #endregion


                    view.Add(lists);
                }
                return(view.AsQueryable());
            }
        }