Exemplo n.º 1
0
        public async Task <ResponceModel> Add([FromBody] EstateType model)
        {
            try
            {
                var estateType = await estateTypeService.Add(model);

                if (await estateTypeService.SaveChanges())
                {
                    return(new ResponceModel(200, "OK", estateType, null));
                }
                else
                {
                    return(new ResponceModel(404, "FAILD", null, new string[] { "Veri eklenirken sorun oluştu." }));
                }
            }
            catch (Exception ex)
            {
                await _logService.Add(new SystemLog()
                {
                    Content = ex.Message, CreateDate = DateTime.Now, UserId = 0, EntityName = estateTypeService.GetType().Name
                });

                return(new ResponceModel(400, "ERROR", null, new string[] { "Veri eklenirken sorun oluştu." }));
            }
        }
Exemplo n.º 2
0
        public static IEstate CreateEstate(EstateType type)
        {
            switch (type)
            {
            case EstateType.Apartment:
                return(new Apartment());

                break;

            case EstateType.House:
                return(new House());

                break;

            case EstateType.Office:
                return(new Office());

                break;

            case EstateType.Garage:
                return(new Garage());

                break;

            default:
                throw new NotImplementedException("Estate type is not valid!");
            }
        }
Exemplo n.º 3
0
 protected Estate(string name, EstateType estateType, double area, string location, bool furniture)
 {
     this.Name = name;
     this.EstateType = estateType;
     this.Area = area;
     this.Location = location;
     this.Furniture = furniture;
 }
Exemplo n.º 4
0
 public Estate(string Name,EstateType Type,double Area,string Location,bool IsFurnished)
 {
     this.Name = Name;
     this.Type = Type;
     this.Area = Area;
     this.Location = Location;
     this.IsFurnished = IsFurnished;
 }
Exemplo n.º 5
0
 public Estate(string name, double area, string location, EstateType type, bool isFurnished)
 {
     this.Name        = name;
     this.Area        = area;
     this.Location    = location;
     this.Type        = type;
     this.IsFurnished = isFurnished;
 }
Exemplo n.º 6
0
 protected Estate(string name, EstateType type, double area, string location, bool isFurnished)
 {
     this.Name = name;
     this.Type = type;
     this.Area = area;
     this.Location = location;
     this.IsFurnished = isFurnished;
 }
Exemplo n.º 7
0
 public Estate(string initName, EstateType initType, double initArea, string initLocation, bool initIsFurnished)
 {
     this.Name = initName;
     this.Type = initType;
     this.Area = initArea;
     this.Location = initLocation;
     this.IsFurnished = initIsFurnished;
 }
Exemplo n.º 8
0
 protected Estate(EstateType type)
 {
     this.Name = UnknownYet;
     this.Area = AreaLowerBorder;
     this.Location = UnknownYet;
     this.IsFurnished = false;
     this.Type = type;
 }
Exemplo n.º 9
0
 public Estate(string Name, EstateType Type, double Area, string Location, bool IsFurnished)
 {
     this.Name        = Name;
     this.Type        = Type;
     this.Area        = Area;
     this.Location    = Location;
     this.IsFurnished = IsFurnished;
 }
Exemplo n.º 10
0
        //This class checks which fields are specified in the GUI and then bases the serach on that.
        public List <Estate> SearchEstate(Countries country, string city, EstateType estateType)
        {
            List <Estate> matchList     = new List <Estate>();
            var           formattedCity = city.ToUpper();
            DictionaryManager <EstateType, Estate> dictionary = new DictionaryManager <EstateType, Estate>();

            for (int i = 0; i < em.Count; i++)
            {
                dictionary.Add(em.GetAt(i).estateType, em.GetAt(i));
            }

            if (country == Countries.All && estateType == EstateType.All)
            {
                for (int i = 0; i < em.Count; i++)
                {
                    if (em.GetAt(i).address.city.ToUpper().Contains(formattedCity))
                    {
                        matchList.Add(em.GetAt(i));
                    }
                }
            }
            else if (country == Countries.All)
            {
                List <Estate> estateTypes = new List <Estate>();
                dictionary.Get(estateType, out estateTypes);
                for (int i = 0; i < estateTypes.Count; i++)
                {
                    if (estateTypes[i].address.city.ToUpper().Contains(formattedCity))
                    {
                        matchList.Add(estateTypes[i]);
                    }
                }
            }
            else if (estateType == EstateType.All)
            {
                for (int i = 0; i < em.Count; i++)
                {
                    if (em.GetAt(i).address.country == country && em.GetAt(i).address.city.ToUpper().Contains(formattedCity))
                    {
                        matchList.Add(em.GetAt(i));
                    }
                }
            }
            else
            {
                for (int i = 0; i < em.Count; i++)
                {
                    if (em.GetAt(i).address.country == country && em.GetAt(i).address.city.ToUpper().Contains(formattedCity) && em.GetAt(i).estateType == estateType)
                    {
                        matchList.Add(em.GetAt(i));
                    }
                }
            }

            return(matchList);
        }
Exemplo n.º 11
0
 public Apartment(EstateType type,
     string name, 
     double area, 
     string location, 
     bool isFurnished, 
     int rooms, 
     bool hasElevator)
     : base(type, name, area, location, isFurnished, rooms, hasElevator)
 {
 }
Exemplo n.º 12
0
 public static IEstate CreateEstate(EstateType type)
 {
     switch (type)
     {
         case EstateType.Apartment: return new Apartment();
         case EstateType.Garage: return new Garage();
         case EstateType.House: return new House();
         case EstateType.Office: return new Office();
         default: throw new NotSupportedException("This estate type is not supported.");
     }
 }
Exemplo n.º 13
0
 public Office(
     string name = null, 
     EstateType type = EstateType.Office, 
     double area = 0, 
     string location = null, 
     bool isFurnished = false, 
     int rooms = 0, 
     bool hasElevator = false)
     : base(name, type, area, location, isFurnished, rooms, hasElevator)
 {
 }
Exemplo n.º 14
0
 public static IEstate CreateEstate(EstateType type)
 {
     switch (type)
     {
         case EstateType.Apartment: return new Appartment();
         case EstateType.Garage: return new Garage();
         case EstateType.House: return new House();
         case EstateType.Office: return new Office();
         default:
             throw new Exception();
     }
 }
Exemplo n.º 15
0
 public double GetStandard(EstateType type)
 {
     Standard s = this.Find(type);
     if (s == null)
     {
         return 0;
     }
     else
     {
         return s.Price / s.Area;
     }
 }
Exemplo n.º 16
0
        private Standard Find(EstateType type)
        {
            foreach (Standard item in this.standardList)
            {
                if (item.Type == type)
                {
                    return item;
                }
            }

            return null;
        }
Exemplo n.º 17
0
 public Apartment(
     string name = null, 
     EstateType type = EstateType.Apartment,
     double area = 0, 
     string location = null, 
     bool isFurnished = false, 
     int rooms = 0, 
     bool hasElevator = false)
     : base(name, type, area, location, isFurnished)
 {
     this.rooms = rooms;
     this.hasElevator = hasElevator;
 }
Exemplo n.º 18
0
 public static IEstate CreateEstate(EstateType type)
 {
     switch (type)
     {
         case EstateType.Apartment: return new Apartment(type);
         case EstateType.Office: return new Office(type);
         case EstateType.House: return new House(type);
         case EstateType.Garage: return new Garage(type);
         default:
             {
                 throw new NotImplementedException("Unknown estate type " + type);
             }
     }
 }
Exemplo n.º 19
0
        public static IEstate CreateEstate(EstateType type)
        {
            switch (type)
            {
            case EstateType.Apartment: return(new Appartment());

            case EstateType.Garage: return(new Garage());

            case EstateType.House: return(new House());

            case EstateType.Office: return(new Office());

            default:
                throw new Exception();
            }
        }
Exemplo n.º 20
0
 public static IEstate CreateEstate(EstateType type)
 {
     switch (type)
     {
         case EstateType.House:
             return new House();
         case EstateType.Apartment:
             return new Apartment();
         case EstateType.Garage:
             return new Garage();
         case EstateType.Office:
             return new Office();
         default:
             throw new ArgumentOutOfRangeException(type.ToString(), "EstateType not supported");
     }
 }
        public static IEstate CreateEstate(EstateType type)
        {
            IEstate estate = null;

            switch (type)
            {
            case EstateType.Apartment: estate = new Apartment(); break;

            case EstateType.Office: estate = new Office(); break;

            case EstateType.Garage: estate = new Garage(); break;

            case EstateType.House: estate = new House(); break;
            }

            return(estate);
        }
Exemplo n.º 22
0
 public void Update(EstateType type, double area, double price)
 {
     Standard s = this.Find(type);
     if (s != null)
     {
         s = new Standard();
         s.Area = area;
         s.Price = price;
         s.Type = type;
         this.standardList.Add(s);
     }
     else
     {
         s.Area = area;
         s.Price = price;
     }
 }
Exemplo n.º 23
0
        public static IEstate CreateEstate(EstateType type)
        {
            string textType = type.ToString();

            switch (textType)
            {
            case "Apartment": return(new Apartment(type));

            case "Office": return(new Office(type));

            case "House": return(new House(type));

            case "Garage": return(new Garage(type));

            default: return(new House(type));
            }
        }
Exemplo n.º 24
0
        public static IEstate CreateEstate(EstateType type)
        {
            switch (type)
            {
                case EstateType.Apartment:
                    return new Apartment();

                case EstateType.Office:
                    return new Offise();

                case EstateType.Garage:
                    return new Garage();

                case EstateType.House:
                    return new House();
                default:
                    throw new ArgumentException("This type Estate does not exist! ");
            }
        }
Exemplo n.º 25
0
        public static IEstate CreateEstate(EstateType type)
        {
            
            string textType = type.ToString();
            switch (textType)
            {
                case "Apartment": return new Apartment(type);
                   
                case "Office": return new Office(type);
                    
                case "House": return new House(type);
                    
                case "Garage": return new Garage(type);
                    
                default: return new House(type);

            }
            
        }
Exemplo n.º 26
0
 public static IEstate CreateEstate(EstateType type)
 {
     switch (type)
     {
         case EstateType.Apartment:
             return new Apartment();
             break;
         case EstateType.Office:
             return new Office();
             break;
         case EstateType.House:
             return new House();
             break;
         case EstateType.Garage:
             return new Garage();
             break;
         default:
             throw new ArgumentOutOfRangeException("type", "Invalid Estate type specified.");
     }
 }
Exemplo n.º 27
0
        public static IEstate CreateEstate(EstateType type)
        {
            switch (type)
            {
            case EstateType.Apartment:
                return(new Apartment(type));

            case EstateType.Office:
                return(new Office(type));

            case EstateType.House:
                return(new House(type));

            case EstateType.Garage:
                return(new Garage(type));

            default:
                throw new NotImplementedException(string.Format("Estate class not implemented: {0}", type));
            }
        }
Exemplo n.º 28
0
        public static IEstate CreateEstate(EstateType type)
        {
            switch (type)
            {
            case EstateType.Apartment:
                return(new Apartment());

            case EstateType.Office:
                return(new Office());

            case EstateType.House:
                return(new House());

            case EstateType.Garage:
                return(new Garage());

            default:
                throw new NotImplementedException("Estate type not supported: " + type);
            }
        }
 public static IEstate CreateEstate(EstateType type)
 {
     switch (type)
     {
         case EstateType.Apartment:
             return new Apartment();
             break;
         case EstateType.House:
             return new House();
             break;
         case EstateType.Office:
             return new Office();
             break;
         case EstateType.Garage:
             return new Garage();
             break;
         default:
             throw new NotImplementedException("Estate type is not valid!");
     }
 }
Exemplo n.º 30
0
        public static IEstate CreateEstate(EstateType type)
        {
            switch (type)
            {
            case EstateType.Apartment:
                return(new Apartment());

            case EstateType.Garage:
                return(new Garage());

            case EstateType.House:
                return(new House());

            case EstateType.Office:
                return(new Office());

            default:
                throw new ArgumentException("There is no such estate type!");
            }
        }
Exemplo n.º 31
0
 public static IEstate CreateEstate(EstateType type)
 {
     IEstate estate = null;
     switch (type)
     {
         case EstateType.Apartment:
             estate = new Apartment();
             break;
         case EstateType.Office:
             estate = new Office();
             break;
         case EstateType.House:
             estate = new House();
             break;
         case EstateType.Garage:
             estate = new Garage();
             break;
         default:
             break;
     }
     return estate;
 }
        public static IEstate CreateEstate(EstateType type)
        {
            Estate estate;
            switch (type)
            {
                   case EstateType.Apartment:
                    estate =  new Apartment();
                    break;
                    case EstateType.Garage:
                    estate = new Garage();
                    break;
                    case EstateType.House:
                    estate =  new House();
                    break;
                    case EstateType.Office:
                    estate = new Office();
                    break;
                default:
                    throw new ArgumentException("Invalid type for estste.");
            }

            return estate;
        }
Exemplo n.º 33
0
        public static IEstate CreateEstate(EstateType type)
        {
            IEstate estate = null;

            switch (type)
            {
                case EstateType.Apartment:
                    estate = new Apartment();
                    break;
                case EstateType.Garage:
                    estate = new Garage();
                    break;
                case EstateType.House:
                    estate = new House();
                    break;
                case EstateType.Office:
                    estate = new Office();
                    break;
                default:
                    throw new ArgumentException("Unsupported estate type");
            }

            return estate;
        }
Exemplo n.º 34
0
 protected BuildingEstate(string name, EstateType type, double area, string location, bool isFurnished)
     : base(name, type, area, location, isFurnished)
 {
 }
Exemplo n.º 35
0
        public void SeeNeighbor(User user)
        {
            if (user.IsLogin)
            {
                new Thread(delegate()
                {
                    if (this.Id < 0)
                    {
                        return;
                    }

                    string text = string.Empty;
                    if (UrlHelpers.GetHtml(
                        "http://civitas.soobb.com/Districts/" + this.Id,
                        ref text,
                        user.CookieContainer) == 1)
                    {
                        this.health = Convert.ToDouble(UrlHelpers.CutHead(
                            UrlHelpers.CutBetween(text, "<div class=\"Subject\">卫生</div>", "%</div>"),
                            "ive\">"));
                        this.prosperity = Convert.ToDouble(UrlHelpers.CutHead(
                            UrlHelpers.CutBetween(text, "<div class=\"Subject\">繁荣</div>", "%</div>"),
                            "ive\">"));
                        this.industry = Convert.ToDouble(UrlHelpers.CutHead(
                            UrlHelpers.CutBetween(text, "<div class=\"Subject\">产业</div>", "%</div>"),
                            "ive\">"));
                    }

                    text = string.Empty;
                    if (UrlHelpers.GetHtml(
                        "http://civitas.soobb.com/Districts/" + this.Id + "/Estates/",
                        ref text,
                        user.CookieContainer) == 1)
                    {
                        string strCount = UrlHelpers.CutBetween(text, "<span class=\"Count\">(共 ", "条)</span>");
                        int count = Convert.ToInt32(strCount);
                        int pageCount = (count / 20) + 1;
                        for (int i = 1, j = 0; i <= pageCount; i++)
                        {
                            if (UrlHelpers.GetHtml(
                                "http://civitas.soobb.com/Districts/" + this.Id + "/Estates/?Action=Search&Page=" + i,
                                ref text,
                                user.CookieContainer) == 1)
                            {
                                string temp = UrlHelpers.CutHead(text, "<div class=\"Estate StatisticsRow\">");
                                for (int k = 0; k < 20 & j < count; k++, j++)
                                {
                                    string tempt1 = UrlHelpers.CutTail(temp, "<div class=\"Text\">");
                                    string name = UrlHelpers.CutBetween(UrlHelpers.CutHead(tempt1, "<h5>"), "Details/\">", "</a>");
                                    string typestr = UrlHelpers.CutBetween(tempt1, "</a>的", "</div>");
                                    string owner = UrlHelpers.CutHead(UrlHelpers.CutBetween(tempt1, " entityid=\"", "</a>的" + typestr), ">");
                                    string ownerPath = UrlHelpers.CutBetween(tempt1, "<div><a href=\"", "\" class=\"WithEntityCard\" entityid=\"");
                                    string estatePath = UrlHelpers.CutBetween(tempt1, "<h5><a href=\"", "\">" + name);
                                    double area = Convert.ToDouble(UrlHelpers.CutBetween(UrlHelpers.CutBetween(tempt1, "<div class=\"Text Text2\">", "占地面积"), "Number\">", "</p>"));
                                    EstateType type = EstateType.GetEstateType(typestr);
                                    if (null == type)
                                    {
                                        type = new EstateType(typestr);
                                    }

                                    this.Estates.Add(new Estate(name, type, area, estatePath, owner, ownerPath));
                                    temp = UrlHelpers.CutHead(temp, "<div class=\"Estate StatisticsRow\">");
                                }

                                Console.Write("[" + this.Name[0] + "]");
                            }

                            if (j == count)
                            {
                                break;
                            }
                        }
                    }

                    Console.WriteLine("\n窥探【" + this.Name + "】完毕,有种放学别走!");
                    this.ready = true;
                }).Start();
            }
        }
Exemplo n.º 36
0
 public House(string Name, EstateType Type, double Area, string Location, bool IsFurnished, int floors)
     : base(Name, EstateType.House, Area, Location, IsFurnished)
 {
     this.Floors = floors;
 }
Exemplo n.º 37
0
 public House(string initName, EstateType initType, double initArea, string initLocation, bool initIsFurnished, int numberOfFloors)
     : base(initName, initType, initArea, initLocation, initIsFurnished)
 {
     this.Floors = numberOfFloors;
 }
Exemplo n.º 38
0
 public BuildingEstate(EstateType type)
     : base(type)
 {
 }
Exemplo n.º 39
0
 public House(EstateType type)
     : base(type)
 {
 }
Exemplo n.º 40
0
 public Office(string name, double area, string location, EstateType type, bool isFurnished, int rooms, bool hasElevator)
     : base(name, area, location, type, isFurnished, rooms, hasElevator)
 {
 }
Exemplo n.º 41
0
 protected Estate(EstateType type)
 {
     this.Type = type;
 }
Exemplo n.º 42
0
 public static IEstate CreateEstate(EstateType type)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 43
0
 public Apartment(EstateType type)
     : base(type)
 {
 }
Exemplo n.º 44
0
 public BuildingEstate(EstateType type)
     : base(type)
 {
 }
Exemplo n.º 45
0
 public Office(EstateType type)
     : base(type)
 {
 }
Exemplo n.º 46
0
 public void Update(EstateType estateType)
 {
     _uow.Repository <EstateType>().Update(estateType);
 }
Exemplo n.º 47
0
 public async Task <EstateType> Add(EstateType estateType)
 {
     return(await _uow.Repository <EstateType>().Insert(estateType));
 }
Exemplo n.º 48
0
        //Makes sure that no info is empty and then creates and adds and Estate to the list.
        public bool AddEstate(Address address, EstateType estateType, EstateLegalForm estateLegalForm, string estatePrice, string estateDimensions, string estateRent, string imageString)
        {
            Estate estate;

            if (String.IsNullOrEmpty(address.city) || String.IsNullOrEmpty(address.street) || String.IsNullOrEmpty(address.zipCode))
            {
                return(false);
            }

            if (int.TryParse(estatePrice, out int estatePriceResult) &&
                double.TryParse(estateDimensions, out double estateDimensionsResult) &&
                int.TryParse(estateRent, out int estateRentResult))
            {
                if (estateType == EstateType.Apartment)
                {
                    estate = new Apartment(GenerateEstateID(), address, estateLegalForm, estatePriceResult, estateDimensionsResult, estateRentResult);
                    estate.EstatePicture = imageString;
                    em.Add(estate);
                    SetChanged();
                    return(true);
                }
                else if (estateType == EstateType.House)
                {
                    estate = new House(GenerateEstateID(), address, estateLegalForm, estatePriceResult, estateDimensionsResult, estateRentResult);
                    estate.EstatePicture = imageString;
                    em.Add(estate);
                    SetChanged();
                    return(true);
                }
                else if (estateType == EstateType.Villa)
                {
                    estate = new Villa(GenerateEstateID(), address, estateLegalForm, estatePriceResult, estateDimensionsResult, estateRentResult);
                    estate.EstatePicture = imageString;
                    em.Add(estate);
                    SetChanged();
                    return(true);
                }
                else if (estateType == EstateType.Townhouse)
                {
                    estate = new TownHouse(GenerateEstateID(), address, estateLegalForm, estatePriceResult, estateDimensionsResult, estateRentResult);
                    estate.EstatePicture = imageString;
                    em.Add(estate);
                    SetChanged();
                    return(true);
                }
                else if (estateType == EstateType.Factory)
                {
                    estate = new Factory(GenerateEstateID(), address, estateLegalForm, estatePriceResult, estateDimensionsResult, estateRentResult);
                    estate.EstatePicture = imageString;
                    em.Add(estate);
                    SetChanged();
                    return(true);
                }
                else if (estateType == EstateType.Shop)
                {
                    estate = new Shop(GenerateEstateID(), address, estateLegalForm, estatePriceResult, estateDimensionsResult, estateRentResult);
                    estate.EstatePicture = imageString;
                    em.Add(estate);
                    SetChanged();
                    return(true);
                }
                else if (estateType == EstateType.Warehouse)
                {
                    estate = new Warehouse(GenerateEstateID(), address, estateLegalForm, estatePriceResult, estateDimensionsResult, estateRentResult);
                    estate.EstatePicture = imageString;
                    em.Add(estate);
                    SetChanged();
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 49
0
 public Apartment(EstateType type)
     : base(type)
 {
 }
Exemplo n.º 50
0
 public House(EstateType type)
     : base(type)
 {
 }
Exemplo n.º 51
0
 public Estate(EstateType type)
 {
     this.Type = type;
 }
Exemplo n.º 52
0
 public House(string name, double area, string location, EstateType type, bool isFurnished, int floors)
     : base(name, area, location, type, isFurnished)
 {
     this.Floors = floors;
 }
Exemplo n.º 53
0
        override public void execute()
        {
            EstateType form = new EstateType();

            form.ShowDialog();
        }
Exemplo n.º 54
0
 public BuildingEstate(string name, double area, string location, EstateType type, bool isFurnished, int rooms, bool hasElevator)
     : base(name, area, location, type, isFurnished)
 {
     this.Rooms       = rooms;
     this.HasElevator = hasElevator;
 }
Exemplo n.º 55
0
 public Garage(EstateType type)
     : base(type)
 {
 }
Exemplo n.º 56
0
 //Constructor for Residential estates.
 public Residential(int id, int sqrft, int rent, Address address, Residential.Legal legal, EstateType type, string image) : base(id, sqrft, rent, address, image)
 {
     Category     = "Residential";
     LegalType    = legal;
     BuildingType = type;
 }
Exemplo n.º 57
0
 public BuildingEstate(string initName, EstateType initType, double initArea, string initLocation, bool initIsFurnished, int numberOfRooms, bool hasElevator)
     : base(initName, initType, initArea, initLocation, initIsFurnished)
 {
     this.Rooms = numberOfRooms;
     this.HasElevator = hasElevator;
 }
Exemplo n.º 58
0
 //Constructor for Commercial Estates.
 public Commercial(int id, int sqrft, int rent, Address address, Legal legal, EstateType type, string image) : base(id, sqrft, rent, address, image)
 {
     LegalType    = legal;
     BuildingType = type;
 }
Exemplo n.º 59
0
 public Apartment(string Name, EstateType Type, double Area, string Location, bool IsFurnished, int rooms, bool elevator)
     : base(Name, EstateType.Apartment, Area, Location, IsFurnished)
 {
     this.Rooms       = rooms;
     this.HasElevator = elevator;
 }
Exemplo n.º 60
0
 public Garage(string name, double area, string location, EstateType type, bool isFurnished, int width, int height)
     : base(name, area, location, type, isFurnished)
 {
     this.Width  = width;
     this.Height = height;
 }