示例#1
0
        public int UpdatePropertyListing(PropertyListingView model, int PropertyListingId)
        {
            int Lid = 0;

            try
            {
                using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
                {
                    var listing = db.PropertyListings.FirstOrDefault(x => x.PropertyListingId == PropertyListingId);
                    listing.PropertyListingId            = PropertyListingId;
                    listing.PropertyTypeId               = model.PropertyTypeId;
                    listing.BranchId                     = model.BranchId;
                    listing.ProvinceId                   = model.ProvinceId;
                    listing.FriendlyName                 = model.FriendlyName;
                    listing.Price                        = model.Price;
                    listing.PropertyListingPricingTypeId = model.PropertyListingPricingTypeId;
                    listing.ProprtyDesciption            = model.ProprtyDesciption;
                    listing.IsListingActive              = model.IsListingActive;

                    db.SaveChanges();
                    Lid = listing.PropertyListingId;
                }
            }

            catch (Exception e)
            {
                JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
            }
            return(Lid);
        }
示例#2
0
        private int CaptureListing(PropertyListingView model)
        {
            int ListingId = 0;

            try
            {
                using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
                {
                    DataAccess.PropertyListing table = new DataAccess.PropertyListing()
                    {
                        BranchId        = model.BranchId,
                        FriendlyName    = model.FriendlyName,
                        IsListingActive = true,
                        PropertyListingPricingTypeId = model.PropertyListingPricingTypeId,
                        LastUpdate        = DateTime.Now,
                        ListingDate       = DateTime.Now,
                        Price             = model.Price,
                        PropertyTypeId    = model.PropertyTypeId,
                        ProprtyDesciption = model.ProprtyDesciption,
                        ProvinceId        = model.ProvinceId
                    };
                    db.PropertyListings.Add(table);
                    db.SaveChanges();
                    ListingId = table.PropertyListingId;
                }
            }

            catch (Exception e)
            {
                JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
            }
            return(ListingId);
        }
示例#3
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());
            }
        }
示例#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());
            }
        }