Exemple #1
0
        public JsonResult GetDistricts(int id)
        {
            //return Json(EstateManager.GetTownList(id));
            var towns = EstateManager.GetDistrictList(id);

            return(Json(new SelectList(towns, "Id", "Name"), JsonRequestBehavior.AllowGet));
        }
        public MainWindow()
        {
            InitializeComponent();

            //    object mydata =  Data.read();
            EstateManager.getInstance().loadEstates();
        }
        public Form1()
        {
            AddressManager am = new AddressManager();
            EstateManager  em = new EstateManager();

            _fileController    = new FileController(am, em);
            _estateController  = new EstateController(em);
            _addressController = new AddressController(am);

            InitializeComponent();
            comboBoxCountries.DataSource              = Enum.GetValues(typeof(Countries));
            comboBoxCountry.DataSource                = Enum.GetValues(typeof(Countries));
            comboBoxCountryChange.DataSource          = Enum.GetValues(typeof(Countries));
            comboBoxLegalForm.DataSource              = Enum.GetValues(typeof(LegalForm));
            comboBoxChangeLegalForm.DataSource        = Enum.GetValues(typeof(LegalForm));
            comboBoxAddLegalForm.DataSource           = Enum.GetValues(typeof(LegalForm));
            comboBoxType.DataSource                   = _estateController.GetEstateTypes();
            comboBoxAddType.DataSource                = _estateController.GetEstateTypes();
            comboBoxChangeType.DataSource             = _estateController.GetEstateTypes();
            comboBoxCategory.DataSource               = _estateController.GetEstateCategories();
            comboBoxEstateObject.DataSource           = _estateController.GetAllEstates();
            comboBoxChangeEstateId.DataSource         = _estateController.GetAllEstates().Select(e => e.EstateId).ToList();
            comboBoxAddAddressToEstate.DataSource     = _addressController.GetAllAddresses();
            comboBoxChangeAddressForEstate.DataSource = _addressController.GetAllAddresses();
            comboBoxChangeAddress.DataSource          = _addressController.GetAllAddresses();
        }
Exemple #4
0
        public JsonResult DeleteEstate(int id)
        {
            bool isdelete = EstateManager.Delete(id);

            //if (isdelete)
            return(Json(isdelete));
            //  else return false;
        }
Exemple #5
0
        //
        // GET: /Admin/State/

        public ActionResult Index()
        {
            string lang    = FillLanguagesList();
            var    estates = EstateManager.GetEstateList(lang);


            return(View(estates));
        }
Exemple #6
0
        private EstateManager estateMngr = null; //ref variable declared

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Default constructor - a good place for initializations
        /// </summary>
        public MainForm()
        {
            //Visual Studio initializations
            InitializeComponent();

            //My initializations
            InitializeGUI();

            //Create the manager
            estateMngr = new EstateManager();
        }
 private void InitializeFields()
 {
     estateManager        = new EstateManager();
     landSizeTBox.Enabled = false;
     floorTBox.Enabled    = false;
     rentalRBtn.Checked   = true;
     id          = 1;
     currentFile = null;
     typeOfEstateCBox.DropDownStyle = ComboBoxStyle.DropDownList;
     searchEstateCBox.DropDownStyle = ComboBoxStyle.DropDownList;
 }
Exemple #8
0
        public ActionResult Add()
        {
            var languages = LanguageManager.GetLanguages();
            var countries = EstateManager.GetCountryList();
            var list      = new SelectList(languages, "Culture", "Language");

            ViewBag.LanguageList = list;

            var countrylist = new SelectList(countries, "Id", "Name");

            ViewBag.Country = countrylist;
            //ImageHelperNew.DestroyImageCashAndSession(577, 296);
            ImageHelperNew.DestroyImageCashAndSession(750, 483);
            return(View());
        }
Exemple #9
0
        /// <summary>
        /// method to initialize the GUI:s interface.
        /// </summary>
        private void InitializeComponents()
        {
            file                   = null;
            id                     = 1;
            estateManager          = new EstateManager();
            btnDelete.Enabled      = false;
            btnChange.Enabled      = false;
            btnInfo.Enabled        = false;
            cdCountry.DataSource   = Enum.GetValues(typeof(Countries));
            cdLegalForm.DataSource = Enum.GetValues(typeof(LegalForm));

            cbType.DropDownStyle      = ComboBoxStyle.DropDownList;
            cdCountry.DropDownStyle   = ComboBoxStyle.DropDownList;
            cdLegalForm.DropDownStyle = ComboBoxStyle.DropDownList;
        }
Exemple #10
0
        /// <summary>
        /// method to initialize the GUI:s interface.
        /// </summary>
        private void InitializeComponents()
        {
            cn   = new SqlConnection(global::HomesForSale.Properties.Settings.Default.HomesDBConnectionString);
            file = null;
            id   = 1;
            dbID = 100;

            estateManager          = new EstateManager();
            btnDelete.Enabled      = false;
            btnChange.Enabled      = false;
            btnInfo.Enabled        = false;
            cdCountry.DataSource   = Enum.GetValues(typeof(Countries));
            cdLegalForm.DataSource = Enum.GetValues(typeof(LegalForm));

            cbType.DropDownStyle      = ComboBoxStyle.DropDownList;
            cdCountry.DropDownStyle   = ComboBoxStyle.DropDownList;
            cdLegalForm.DropDownStyle = ComboBoxStyle.DropDownList;
        }
        private void addEstateButton(object sender, RoutedEventArgs e)
        {
            getDataFromFields();

            List <BookingTime> BTL = new List <BookingTime>();

            Estate estate = new Estate()
            {
                EstateName   = this.name.Text,
                Bedrooms     = zimmeranzahl,
                Region       = ort,
                Persons      = personen,
                BookingTimes = BTL,
                Price        = preismax
            };

            EstateManager.getInstance().addEstate(estate);
        }
        public ActionResult Detail()
        {
            if (RouteData.Values["id"] != null)
            {
                int    estateId = Convert.ToInt32(RouteData.Values["id"]);
                Estate model    = EstateManager.GetEstateById(estateId);

                var photos           = PhotoManager.GetList((int)web.Areas.Admin.Helpers.PhotoType.Estate, estateId);
                EstateWrapperModel m = new EstateWrapperModel(photos, model);

                ViewBag.Lang = lang;
                return(View(m));
            }
            else
            {
                return(View());
            }
        }
Exemple #13
0
        public ActionResult Edit()
        {
            ImageHelperNew.DestroyImageCashAndSession(750, 483, 250, 161);
            var languages = LanguageManager.GetLanguages();
            var list      = new SelectList(languages, "Culture", "Language");

            ViewBag.LanguageList = list;

            var countries = EstateManager.GetCountryList();

            if (RouteData.Values["id"] != null)
            {
                int  nid      = 0;
                bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid);
                if (isnumber)
                {
                    Estate record = EstateManager.GetEstateById(nid);

                    var countrylist = new SelectList(countries, "Id", "Name", record.CountryId);
                    ViewBag.Country = countrylist;

                    var towns    = EstateManager.GetTownList(record.CountryId);
                    var townList = new SelectList(towns, "Id", "Name", record.TownId);
                    ViewBag.Town = townList;

                    var districts     = EstateManager.GetDistrictList(record.TownId);
                    var districtsList = new SelectList(districts, "Id", "Name", record.DistrictId);
                    ViewBag.District = districtsList;

                    return(View(record));
                }
                else
                {
                    return(View());
                }
            }
            else
            {
                return(View());
            }
        }
Exemple #14
0
        private void suche_Click(object sender, RoutedEventArgs e)
        {
            getDataFromFields();

            List <BookingTime> BTL = new List <BookingTime>();

            BTL.Add(new BookingTime(ankunft, abfahrt));

            Estate seachEstate = new Estate()
            {
                Bedrooms     = zimmeranzahl,
                CustomerID   = "",
                Persons      = personen,
                Price        = preismax,
                BookingTimes = BTL,
            };

            List <Estate> foundEstates = EstateManager.getInstance().checkAvailability(seachEstate);

            listFoundEstates(foundEstates);
        }
Exemple #15
0
        private void bookEstate(object sender, RoutedEventArgs e)
        {
            ((Button)sender).Content = "Gebucht!";
            string        estateName = ((Button)sender).Tag.ToString();
            List <Estate> estates    = EstateManager.getInstance().estates;

            Estate bookEstate = null;

            // meins auch .-.
            foreach (Estate estate in estates)
            {
                if (estate.EstateName == estateName)
                {
                    bookEstate = estate;
                    break;
                }
            }

            List <BookingTime> BTL = bookEstate.BookingTimes;

            BTL.Add(new BookingTime(ankunft, abfahrt));
        }
Exemple #16
0
        /// <summary>
        /// Constructor to the components
        /// </summary>
        public GUI()
        {
            InitializeComponent();

            btnSaveChanges.Enabled       = false;
            estateManager                = new EstateManager(listBox1);
            comboBoxCountry.DataSource   = Countries.GetValues(typeof(Countries));
            comboBoxLegalForm.DataSource = LegalForms.GetValues(typeof(LegalForms));
            comboBoxCategory.DataSource  = Category.GetValues(typeof(Category));
            comboBoxLegalForm.DataSource = LegalForms.GetValues(typeof(LegalForms));

            lblDynamicTxt1.Text          = "---------";
            btnChangeEstate.BackColor    = Color.FromArgb(140, 135, 222);
            btnCreateEstate.BackColor    = Color.FromArgb(140, 135, 222);
            btnChooseImage.BackColor     = Color.FromArgb(140, 135, 222);
            btnSaveChanges.BackColor     = Color.FromArgb(168, 165, 209);
            btnDeleteAll.BackColor       = Color.FromArgb(140, 135, 222);
            btnDelete.BackColor          = Color.FromArgb(140, 135, 222);
            btnChangeEstate.BackColor    = Color.FromArgb(140, 135, 222);
            btnGenerateEstates.BackColor = Color.FromArgb(140, 135, 222);
            btnSearch.BackColor          = Color.FromArgb(140, 135, 222);
            btnShowAll.BackColor         = Color.FromArgb(140, 135, 222);
        }
Exemple #17
0
 public EstateController(EstateManager em)
 {
     _estateManager = em;
 }
Exemple #18
0
        public ActionResult Edit(IEnumerable <HttpPostedFileBase> attachments, Estate record, HttpPostedFileBase uploadfile, HttpPostedFileBase fileDosya)
        {
            var    languages = LanguageManager.GetLanguages();
            string lang      = "";

            if (RouteData.Values["lang"] == null)
            {
                lang = "tr";
            }
            else
            {
                lang = RouteData.Values["lang"].ToString();
            }
            var list = new SelectList(languages, "Culture", "Language");

            ViewBag.LanguageList = list;
            if (ModelState.IsValid)
            {
                //if (uploadfile != null && uploadfile.ContentLength > 0)
                //{
                //    Random random = new Random();
                //    int rand = random.Next(1000, 99999999);
                //    new ImageHelper(280, 240).SaveThumbnail(uploadfile, "/Content/images/Photos/", Utility.SetPagePlug(record.Header) + "_" + rand + Path.GetExtension(uploadfile.FileName));
                //    record.Photo = "/Content/images/Photos/" + Utility.SetPagePlug(record.Header) + "_" + rand + Path.GetExtension(uploadfile.FileName);
                //}

                if (Session["ModifiedImageId"] != null)
                {
                    record.Photo = "/Content/images/userfiles/" + Session["ModifiedImageId"].ToString() + Session["WorkingImageExtension"].ToString();
                    ImageHelperNew.DestroyImageCashAndSession(0, 0);
                }

                if (RouteData.Values["id"] != null)
                {
                    int  nid      = 0;
                    bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid);
                    if (isnumber)
                    {
                        if (fileDosya != null)
                        {
                            fileDosya.SaveAs(Server.MapPath("/Content/images/estates/") + fileDosya.FileName);
                            record.EmlakDosyasi = "/Content/images/estates/" + fileDosya.FileName;
                        }


                        record.Id = nid;
                        ViewBag.ProcessMessage = EstateManager.EditEstate(record);
                        //return View(record);
                        foreach (var item in attachments)
                        {
                            if (item != null && item.ContentLength > 0)
                            {
                                Random random = new Random();
                                int    rand   = random.Next(1000, 99999999);
                                new ImageHelper(1024, 768).SaveThumbnail(item, "/Content/images/userfiles/", Utility.SetPagePlug(record.Header) + "_" + rand + Path.GetExtension(item.FileName));
                                Photo p = new Photo();
                                p.CategoryId  = (int)PhotoType.Estate;
                                p.ItemId      = record.Id;
                                p.Path        = "/Content/images/userfiles/" + Utility.SetPagePlug(record.Header) + "_" + rand + Path.GetExtension(item.FileName);
                                p.Thumbnail   = "/Content/images/userfiles/" + Utility.SetPagePlug(record.Header) + "_" + rand + Path.GetExtension(item.FileName);
                                p.Online      = true;
                                p.SortOrder   = 9999;
                                p.Language    = lang;
                                p.TimeCreated = DateTime.Now;
                                p.Title       = "Emlak";
                                PhotoManager.Save(p);
                            }
                        }

                        return(RedirectToAction("Index", "Estate"));
                    }
                    else
                    {
                        ViewBag.ProcessMessage = false;
                        return(View(record));
                    }
                }
                else
                {
                    return(View());
                }
            }
            else
            {
                return(View());
            }
        }
Exemple #19
0
        public ActionResult Add(Estate record, HttpPostedFileBase uploadfile, IEnumerable <HttpPostedFileBase> attachments, HttpPostedFileBase fileDosya)
        {
            var languages = LanguageManager.GetLanguages();
            //string lang = "";
            //if (RouteData.Values["lang"] == null)
            //    lang = "tr";
            //else lang = RouteData.Values["lang"].ToString();
            //lang =
            var countries = EstateManager.GetCountryList();
            var list      = new SelectList(languages, "Culture", "Language");

            ViewBag.LanguageList = list;
            var countrylist = new SelectList(countries, "Id", "Name");

            ViewBag.Country = countrylist;
            if (ModelState.IsValid)
            {
                if (Session["ModifiedImageId"] != null)
                {
                    record.Photo = "/Content/images/userfiles/" + Session["ModifiedImageId"].ToString() + Session["WorkingImageExtension"].ToString();
                    ImageHelperNew.DestroyImageCashAndSession(0, 0);
                }
                else
                {
                    record.Photo = "/Content/images/front/noimage.jpeg";
                }

                if (fileDosya != null)
                {
                    fileDosya.SaveAs(Server.MapPath("/Content/images/estates/") + fileDosya.FileName);
                    record.EmlakDosyasi = "/Content/images/estates/" + fileDosya.FileName;
                }

                ViewBag.ProcessMessage = EstateManager.AddEstate(record);
                Session.Remove("UploadType");
                foreach (var item in attachments)
                {
                    if (item != null && item.ContentLength > 0)
                    {
                        Random random = new Random();
                        int    rand   = random.Next(1000, 99999999);
                        new ImageHelper(1024, 768).SaveThumbnail(item, "/Content/images/userfiles/", Utility.SetPagePlug(record.Header) + "_" + rand + Path.GetExtension(item.FileName));
                        Photo p = new Photo();
                        p.CategoryId = (int)PhotoType.Estate;
                        p.ItemId     = record.Id;
                        p.Path       = "/Content/images/userfiles/" + Utility.SetPagePlug(record.Header) + "_" + rand + Path.GetExtension(item.FileName);
                        p.Thumbnail  = "/Content/images/userfiles/" + Utility.SetPagePlug(record.Header) + "_" + rand + Path.GetExtension(item.FileName);
                        p.Online     = true;
                        p.SortOrder  = 9999;

                        p.Language    = record.Language;
                        p.TimeCreated = DateTime.Now;
                        p.Title       = record.Header;
                        PhotoManager.Save(p);
                    }
                }

                ModelState.Clear();
                return(View());
            }
            else
            {
                return(View());
            }
        }
 public FileController(AddressManager am, EstateManager em)
 {
     _addressManager = am;
     _estateManager  = em;
 }
Exemple #21
0
 public Controller(Form2 UI)
 {
     this.ui = UI;
     estates = new EstateManager();
 }