public UnitModelView FirstUnitModelView()
        {
            var firstUnitModelView = new UnitModelView {

                 Unit = new Unit()
            ,
                 UnitFeature = new UnitFeature()
            ,
                 UnitCommunityAmenity = new UnitCommunityAmenity()
            ,
                 UnitAppliance = new UnitAppliance()
            ,
                 UnitInteriorAmenity = new UnitInteriorAmenity()
            ,
                 UnitExteriorAmenity = new UnitExteriorAmenity()
            ,
                 UnitLuxuryAmenity = new UnitLuxuryAmenity()
            ,
                 UnitPricing = new UnitPricing()
            ,
                 UnitGallery = new UnitGallery()
            ,
                 Currency = new Currency()

             };

            return firstUnitModelView;
        }
 public ActionResult Create(UnitModelView u)
 {
     if (!ModelState.IsValid) return View(u);
     UserHelper.UnitHelper.CreateNewUnit(u);
     ViewBag.CurrencyCode = UserHelper.UnitHelper.GetUnitCurrencyCode(u);
     return RedirectToAction("Index");
 }
        public ActionResult Partial2(UnitModelView unitModelView)
        {
            var photoHelper = new PhotoHelper();
            var role = photoHelper.Role;
            if (role == "Tenant")
            {
                ViewBag.Id = UserHelper.GetTenantId();
                ViewBag.UserName = System.Web.HttpContext.Current.User.Identity.Name;
                ViewBag.Type = "Property";
                TempData["UserID"] = UserHelper.GetTenantId();
            }

            if (role == "Owner")
            {
                ViewBag.Id = UserHelper.GetOwnerId();
                ViewBag.UserName = System.Web.HttpContext.Current.User.Identity.Name;
                ViewBag.Type = "Property";
                TempData["UserID"] = UserHelper.GetOwnerId();
            }

            if (role == "Agent")
            {
                ViewBag.Id = UserHelper.GetAgentId();
                ViewBag.UserName = System.Web.HttpContext.Current.User.Identity.Name;
                ViewBag.Type = "Property";
                TempData["UserID"] = UserHelper.GetAgentId();
            }

            if (role == "Specialist")
            {
                ViewBag.Id = UserHelper.GetSpecialistId();
                ViewBag.UserName = System.Web.HttpContext.Current.User.Identity.Name;
                ViewBag.Type = "Property";
                TempData["UserID"] = UserHelper.GetSpecialistId();
            }
            if (role == "Provider")
            {
                ViewBag.Id = UserHelper.GetProviderId();
                ViewBag.UserName = System.Web.HttpContext.Current.User.Identity.Name;
                ViewBag.Type = "Property";
                TempData["UserID"] = UserHelper.GetProviderId();
            }

            //RequestID = "5";
            //ViewBag.UserName = "******";
            //ViewBag.Id = "10";
            //ViewBag.Type = "Requests";
            //TempData["Id"] = "5";

            //  SaveProfilePhoto(unitModelView.Unit);
            //ViewBag.Sript = FancyBox.Fancy(unitModelView.Unit.UnitId);
            return PartialView("_Partial2", unitModelView.UnitGallery);
        }
        /// TODO ///
        /// NOT Complete, wrong
        public ActionResult UploadPhoto(UnitModelView unitModelView)
        {
            UserHelper.SpecialistPrivateProfileHelper.UploadPhoto();

            //RequestID = "5";
            //ViewBag.UserName = "******";
            //ViewBag.Id = "10";
            //ViewBag.Type = "Requests";
            //TempData["Id"] = "5";

            //  SaveProfilePhoto(unitModelView.Unit);
            //ViewBag.Sript = FancyBox.Fancy(unitModelView.Unit.UnitId);
            return PartialView("_UploadPhoto", unitModelView.UnitGallery);
        }
 //Theorizing
 public void ShareProperty(UnitModelView u)
 {
     throw new NotImplementedException();
 }
 public void PreviewUnit(int id, bool? shareproperty, UnitModelView unitModel)
 {
     throw new NotImplementedException();
 }
 public void EditUnitModel(UnitModelView u)
 {
     UnitofWork.UnitRepository.Edit(u.Unit);
         UnitofWork.UnitFeatureRepository.Edit(u.UnitFeature);
         UnitofWork.UnitApplianceRepository.Edit(u.UnitAppliance);
         UnitofWork.UnitCommunityAmenityRepository.Edit(u.UnitCommunityAmenity);
         UnitofWork.UnitPricingRepository.Edit(u.UnitPricing);
         UnitofWork.UnitInteriorAmenityRepository.Edit(u.UnitInteriorAmenity);
         UnitofWork.UnitExteriorAmenityRepository.Edit(u.UnitExteriorAmenity);
         UnitofWork.UnitLuxuryAmenityRepository.Edit(u.UnitLuxuryAmenity);
         UnitofWork.Save();
 }
 public ActionResult Edit(UnitModelView u)
 {
     if (!ModelState.IsValid) return View(u);
     UserHelper.UnitHelper.EditUnitModel(u);
     return RedirectToAction("Index");
 }
 public void CreateNewUnit(UnitModelView u)
 {
     throw new NotImplementedException();
 }
 public string UnitGoogleMap(UnitModelView unitModel)
 {
     throw new NotImplementedException();
 }
Esempio n. 11
0
 public string UnitGoogleMap(UnitModelView unitModel)
 {
     return string.IsNullOrEmpty(unitModel.Unit.Address) ? UserHelper.GetFormattedLocation("", "", "USA") : UserHelper.GetFormattedLocation(unitModel.Unit.Address, unitModel.Unit.City, unitModel.Unit.CountryCode);
 }
Esempio n. 12
0
        //Theorizing
        public void ShareProperty(UnitModelView u)
        {
            if (Request == null || Request.Url == null) return;
            var url = Request.Url.AbsoluteUri.ToString(CultureInfo.InvariantCulture);
            var primaryimagethumbnail = new UserIdentity(UnitofWork, MembershipService).ResolveImageUrl(u.Unit.PrimaryPhoto);
            string title;
            if (String.IsNullOrEmpty(u.Unit.Title))
            {
                title = (u.Unit.Address + " , " + u.Unit.State + " , " + u.Unit.City);
                if (title.Length >= 50)
                {
                    title = title.Substring(0, 50);
                }
            }
            else
            {
                title = u.Unit.Title;
                if (u.Unit.Title.Length >= 50)
                {
                    title = u.Unit.Title.Substring(0, 50);
                }
            }

            var summary = u.Unit.Description;
            if (!String.IsNullOrEmpty(summary))
            {
                if (summary.Length >= 140)
                {
                    summary = summary.Substring(0, 140);
                }
            }

            var unitrentprice = u.UnitPricing.Rent == null
                                    ? ""
                                    : u.UnitPricing.Rent.Value.ToString(CultureInfo.InvariantCulture) + " ";
            unitrentprice += GetCurrencyValue(u.Unit.CurrencyCode);
            var tweet = u.Unit.Title + ": " + unitrentprice + "--" + url;
            if (!String.IsNullOrEmpty(tweet))
            {
                if (tweet.Length >= 140)
                {
                    tweet = tweet.Substring(0, 140);
                }
            }

            const string sitename = "http://www.haithem-araissia.com";

            //TOD REFACTOR SO THAT INVOKING WILL BE CALLING VIEWBAG
            ViewBag.FaceBook = new SocialHelper().FacebookShare(url, primaryimagethumbnail, title, summary);
            ViewBag.Twitter = new SocialHelper().TwitterShare(tweet);
            ViewBag.GooglePlusShare = new SocialHelper().GooglePlusShare(url);
            ViewBag.LinkedIn = new SocialHelper().LinkedInShare(url, title, summary, sitename);
        }
Esempio n. 13
0
 public void PreviewUnit(int id, bool? shareproperty, UnitModelView unitModel)
 {
     UserHelper.UnitHelper.ShareProperty(unitModel);
     ViewBag.UnitGoogleMap = UserHelper.UnitHelper.UnitGoogleMap(unitModel);
     var unitposter = UserHelper.GetPoster(id, HttpContext.Request.Url) ?? UserHelper.PosterHelper.DefaultPoster;
     ViewBag.PosterFirstName = unitposter.FirstName;
     ViewBag.PosterLastName = unitposter.LastName;
     ViewBag.PosterPictureProfile = unitposter.ProfilePicturePath;
     ViewBag.PosterProfileLink = unitposter.ProfileLink;
     if (shareproperty != null && shareproperty == true)
     {
         ViewBag.EmailSharedwithFriend = true;
         ViewBag.EmailSucessSharedwithFriend = new JNotfiyScriptQueryHelper().JNotifyConfirmationSharingEmail();
     }
 }
Esempio n. 14
0
 public UnitModelView GetUnitModelViewByUnitId(int id)
 {
     var u = new UnitModelView
     {
         Unit = UnitofWork.UnitRepository.FirstOrDefault(x => x.UnitId == id),
         UnitFeature = UnitofWork.UnitFeatureRepository.FirstOrDefault(x => x.UnitId == id),
         UnitAppliance = UnitofWork.UnitApplianceRepository.FirstOrDefault(x => x.UnitId == id),
         UnitCommunityAmenity = UnitofWork.UnitCommunityAmenityRepository.FirstOrDefault(x => x.UnitId == id),
         UnitPricing = UnitofWork.UnitPricingRepository.FirstOrDefault(x => x.UnitId == id),
         UnitInteriorAmenity = UnitofWork.UnitInteriorAmenityRepository.FirstOrDefault(x => x.UnitId == id),
         UnitExteriorAmenity = UnitofWork.UnitExteriorAmenityRepository.FirstOrDefault(x => x.UnitId == id),
         UnitLuxuryAmenity = UnitofWork.UnitLuxuryAmenityRepository.FirstOrDefault(x => x.UnitId == id)
     };
     return u;
 }
Esempio n. 15
0
 public int GetUnitCurrencyCode(UnitModelView u)
 {
     return u.Unit.CurrencyCode ?? 0 ;
 }
        //[Authorize "For ALL the Functions using Unit Upload"]
        public ActionResult Partial2(UnitModelView unitModelView)
        {
            var unitUploaderAttributes = UserHelper.UnitHelper.GetUnitUploaderAttributes();
            ViewBag.Id = unitUploaderAttributes.UploaderId;
            ViewBag.UserName = unitUploaderAttributes.UploaderName;
            ViewBag.Type = unitUploaderAttributes.UploadType;
            TempData["UserID"] = unitUploaderAttributes.UploaderId;
            //RequestID = "5";
            //ViewBag.UserName = "******";
            //ViewBag.Id = "10";
            //ViewBag.Type = "Requests";
            //TempData["Id"] = "5";

            // SaveProfilePhoto(unitModelView.Unit);
            //ViewBag.Sript = FancyBox.Fancy(unitModelView.Unit.UnitId);
            return PartialView("_Partial2", unitModelView.UnitGallery);
        }
 public void EditUnitModel(UnitModelView u)
 {
     throw new NotImplementedException();
 }
 public int GetUnitCurrencyCode(UnitModelView u)
 {
     throw new NotImplementedException();
 }
 public ActionResult EditPictures(UnitModelView unitModelView)
 {
     UserHelper.UnitHelper.EditPicture(unitModelView.Unit);
     return PartialView("_EditPictures", unitModelView.UnitGallery);
 }
Esempio n. 20
0
 public void CreateNewUnit(UnitModelView u)
 {
     UnitofWork.UnitRepository.Add(u.Unit);
     UnitofWork.UnitPricingRepository.Add(u.UnitPricing);
     UnitofWork.UnitFeatureRepository.Add(u.UnitFeature);
     UnitofWork.UnitCommunityAmenityRepository.Add(u.UnitCommunityAmenity);
     UnitofWork.UnitApplianceRepository.Add(u.UnitAppliance);
     UnitofWork.UnitInteriorAmenityRepository.Add(u.UnitInteriorAmenity);
     UnitofWork.UnitExteriorAmenityRepository.Add(u.UnitExteriorAmenity);
     UnitofWork.UnitLuxuryAmenityRepository.Add(u.UnitLuxuryAmenity);
     UnitofWork.Save();
     SavePictures(u.Unit);
 }