Ejemplo n.º 1
0
        public void UpdatePropertyAgents(PropertyListingAgentsView model, int PropertyListingId)
        {
            try
            {
                using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
                {
                    var agents = db.PropertyListingAgents.FirstOrDefault(x => x.AgentId == model.AgentId);
                    agents.PropertyListingId = PropertyListingId;
                    agents.IsActive          = model.IsActive;
                    agents.AgentId           = model.AgentId;

                    db.SaveChanges();
                }
            }
            catch (Exception e)
            {
                JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
            }
        }
Ejemplo n.º 2
0
 private void CaptureListingAgents(PropertyListingAgentsView model, int PropetyListingId)
 {
     try
     {
         using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
         {
             DataAccess.PropertyListingAgent table = new DataAccess.PropertyListingAgent()
             {
                 PropertyListingId = PropetyListingId,
                 IsActive          = true,
                 AgentId           = model.AgentId
             };
             db.PropertyListingAgents.Add(table);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
     }
 }
Ejemplo n.º 3
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());
            }
        }