Пример #1
0
        public ActionResult Choose(BaseApplicationManager bam)
        {
            var res = _myBll.GetAppropriateApartments(bam);

            MyBuffer.Bam = bam;
            return(View(res));
        }
Пример #2
0
 protected override void Dispose(bool disposing)
 {
     if (_baseManager != null)
     {
         _baseManager.Dispose();
         _baseManager = null;
     }
     base.Dispose(disposing);
 }
Пример #3
0
        public new void ConfigureForm(BaseApplicationManager m)
        {
            base.ConfigureForm(m);

            // Set Contact info from datastore
            string ucn = "", uce = "", ucp = "", ucp2 = "", ucp3 = "";

            m.SetContanctInfo(ref ucn, ref uce, ref ucp, ref ucp2, ref ucp3);
            AdContactName   = ucn;
            AdContactEmail  = uce;
            AdContactPhone  = ucp;
            AdContactPhone2 = ucp2;
            AdContactPhone3 = ucp3;
            IEnumerable <MiscInfoNoId> tl;

            // Set radiobutton Ad Type
            if (CategoryName.Equals("Real Estate") || CategoryName.Equals("Jobs") || SubCategoryName.Equals("Pet Adoption") ||
                SubCategoryName.Equals("Pet & Animal Services") || SubCategoryName.Equals("Lost Pet") || CategoryName.Equals("Business Services"))
            {
                tl = m.GetAllAdTypes().Where(x => !x.Value.Equals("ALL") && !x.Value.Equals("TRADE")).ToList();
                // Rename
                if (SubCategoryName.Equals("Lost Pet"))
                {
                    tl.SingleOrDefault(x => x.Value.Equals("SELL")).Name = "Found";
                    tl.SingleOrDefault(x => x.Value.Equals("WANT")).Name = "Missing";
                }
                else if (SubCategoryName.Equals("Pet Adoption"))
                {
                    tl.SingleOrDefault(x => x.Value.Equals("SELL")).Name = "Offering (I am Offering)";
                    tl.SingleOrDefault(x => x.Value.Equals("WANT")).Name = "Looking for (I am Looking For)";
                }
                else if (CategoryName.Equals("Jobs"))
                {
                    tl.SingleOrDefault(x => x.Value.Equals("SELL")).Name = "Hiring (I am Hiring)";
                    tl.SingleOrDefault(x => x.Value.Equals("WANT")).Name = "Looking for (I am Looking For)";
                }
                else
                {
                    tl.SingleOrDefault(x => x.Value.Equals("SELL")).Name = "Offering (I am Selling)";
                    tl.SingleOrDefault(x => x.Value.Equals("WANT")).Name = "Looking For (I am Looking for)";
                }
            }
            else
            {
                tl = m.GetAllAdTypes().Where(x => !x.Value.Equals("ALL")).ToList();
                tl.SingleOrDefault(x => x.Value.Equals("SELL")).Name  = "Offering (I am Selling)";
                tl.SingleOrDefault(x => x.Value.Equals("WANT")).Name  = "Looking For (I am Looking for)";
                tl.SingleOrDefault(x => x.Value.Equals("TRADE")).Name = "Trading (I am Trading)";
            }
            SelectListForm.Add(new SelectListForm()
            {
                Name = "TypeList", List = new SelectList(tl, "Name", "Value")
            });
        }
Пример #4
0
        public new void ConfigureForm(BaseApplicationManager m)
        {
            base.ConfigureForm(m);

            IEnumerable <MiscInfoNoId> tl;

            // Set radiobutton Ad Type
            if (CategoryName.Equals("Real Estate") || CategoryName.Equals("Jobs") || SubCategoryName.Equals("Pet Adoption") ||
                SubCategoryName.Equals("Pet & Animal Services") || SubCategoryName.Equals("Lost Pet") || CategoryName.Equals("Business Services"))
            {
                tl = m.GetAllAdTypes().Where(x => !x.Value.Equals("ALL") && !x.Value.Equals("TRADE")).ToList();
                // Rename
                if (SubCategoryName.Equals("Lost Pet"))
                {
                    tl.SingleOrDefault(x => x.Value.Equals("SELL")).Name = "Found";
                    tl.SingleOrDefault(x => x.Value.Equals("WANT")).Name = "Missing";
                }
                else if (CategoryName.Equals("Jobs"))
                {
                    tl.SingleOrDefault(x => x.Value.Equals("SELL")).Name = "Hiring (I am Hiring)";
                    tl.SingleOrDefault(x => x.Value.Equals("WANT")).Name = "Looking for (I am Looking For)";
                }
                else
                {
                    tl.SingleOrDefault(x => x.Value.Equals("SELL")).Name = "Offering (I am Selling)";
                    tl.SingleOrDefault(x => x.Value.Equals("WANT")).Name = "Looking For (I am Looking for)";
                }
            }
            else
            {
                tl = m.GetAllAdTypes().Where(x => !x.Value.Equals("ALL")).ToList();
                tl.SingleOrDefault(x => x.Value.Equals("SELL")).Name  = "Offering (I am Selling)";
                tl.SingleOrDefault(x => x.Value.Equals("WANT")).Name  = "Looking For (I am Looking for)";
                tl.SingleOrDefault(x => x.Value.Equals("TRADE")).Name = "Trading (I am Trading)";
            }
            SelectListForm.Add(new SelectListForm()
            {
                Name = "TypeList", List = new SelectList(tl, "Name", "Value")
            });
        }
Пример #5
0
        public AdlistPage(int countryId, int regionId, int catId, int subCatId) : base(countryId, regionId, catId, subCatId)
        {
            CountryId = countryId;
            RegionId  = regionId;
            using (BaseApplicationManager Manager = new BaseApplicationManager())
            {
                SelectLists.Add(new SelectListForm {
                    Name = "AdType", List = new SelectList(Manager.GetAllAdTypes(), "Name", "Value", "All Ads")
                });
                SelectLists.Add(new SelectListForm
                {
                    Name = "Search Only",
                    List = new SelectList(new List <string>()
                    {
                        "All Ads",
                        "Urgent Ads"
                    }, "All Ads")
                });

                // Get All Categories Based on current catId

                Category = Categories.FirstOrDefault(x => x.Id == catId);
                // =======================
                if (Category != null)
                {
                    if (Category.Name.Equals("Jobs"))
                    {
                        var list = SelectLists.SingleOrDefault(x => x.Name.Equals("AdType")).List.ToList();
                        list.Remove(list.SingleOrDefault(x => x.Text == "TRADE"));
                        // remove old list
                        SelectLists.Remove(SelectLists.SingleOrDefault(x => x.Name.Equals("AdType")));
                        // recreate new list
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "AdType", List = new SelectList(list, "Value", "Text", "All Ads")
                        });

                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "JobTypeList",
                            List = new SelectList(new List <string>()
                            {
                                "Full-time",
                                "Permanent Full-time",
                                "Part-time",
                                "Permanent Part-time",
                                "Temporary",
                                "Contract",
                                "Internship",
                                "Project",
                                "Please Contact"
                            })
                        });
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "SalaryInfoList",
                            List = new SelectList(new List <string>()
                            {
                                "Hourly",
                                "Daily",
                                "Weekly",
                                "Fortnightly",
                                "Monthly",
                                "Yearly"
                            })
                        });
                    }
                }

                // =======================
                if (SubCategory != null)
                {
                    if (SubCategory.Name.Equals("Cars/Trucks"))
                    {
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "MakeList", List = new SelectList(Manager.GetAllMake(), "Value", "Value")
                        });
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "BodyTypeList", List = new SelectList(Manager.BodyTypeGetAll(), "Value", "Value")
                        });
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "TransmissionList", List = new SelectList(Manager.GetAllTransmission(), "Value", "Value")
                        });
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "FuelTypeList", List = new SelectList(Manager.GetAllFuelType(), "Value", "Value")
                        });
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "ConditionList", List = new SelectList(Manager.GetAllCondition(), "Value", "Value")
                        });
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "DrivetrainList", List = new SelectList(Manager.GetAllDrivetrain(), "Value", "Value")
                        });
                    }
                    else if (SubCategory.Name.Equals("Motorcycles/ATVs"))
                    {
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "MakeList", List = new SelectList(Manager.GetAllMake(), "Value", "Value")
                        });
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "FuelTypeList", List = new SelectList(Manager.GetAllFuelType(), "Value", "Value")
                        });
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "ConditionList", List = new SelectList(Manager.GetAllCondition(), "Value", "Value")
                        });
                    }
                    else if (SubCategory.Name.Equals("Automotive Parts"))
                    {
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "MakeList", List = new SelectList(Manager.GetAllMake(), "Value", "Value")
                        });
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "ConditionList", List = new SelectList(Manager.GetAllCondition(), "Value", "Value")
                        });
                    }
                    else if (SubCategory.Name.Contains("Apartments/Condos") || SubCategory.Name.Contains("House"))
                    {
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "BedroomList",
                            List = new SelectList(new List <string>()
                            {
                                "Bachelor / Studio",
                                "1 bedroom",
                                "2 bedrooms",
                                "3 bedrooms",
                                "4 bedrooms",
                                "5 or more bedrooms"
                            })
                        });
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "BathroomList",
                            List = new SelectList(new List <string>()
                            {
                                "1 bathroom",
                                "2 bathrooms",
                                "3 bathrooms",
                                "4 bathrooms",
                                "5 or more bathrooms"
                            })
                        });
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "FurnishedList",
                            List = new SelectList(new List <string>()
                            {
                                "Fully-Furnished",
                                "Semi-Furnished",
                                "Unfurnished"
                            })
                        });
                    }
                    else if (SubCategory.Name.Equals("Commercial Office Space"))
                    {
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "FurnishedList",
                            List = new SelectList(new List <string>()
                            {
                                "Fully-Furnished",
                                "Semi-Furnished",
                                "Unfurnished"
                            })
                        });
                    }

                    if (SubCategory.Name.Equals("Apartments/Condos Rental") || SubCategory.Name.Equals("House Rental") || SubCategory.Name.Equals("Land Rental/Leasing"))
                    {
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "RentalType",
                            List = new SelectList(new List <string>()
                            {
                                "Rental Only",
                                "Rent To Own"
                            })
                        });
                    }

                    if (SubCategory.Name.Equals("Lost Pet") || SubCategory.Name.Equals("Pet Accessories") ||
                        SubCategory.Name.Equals("Pet Adoption") || SubCategory.Name.Equals("Pet Hub"))
                    {
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "SpeciesList",
                            List = new SelectList(new List <string>()
                            {
                                "Bird",
                                "Cat",
                                "Dog",
                                "Fish",
                                "Other"
                            })
                        });


                        if (SubCategory.Name.Equals("Pet Adoption") || SubCategory.Name.Equals("Pet Hub"))
                        {
                            SelectLists.Add(new SelectListForm()
                            {
                                Name = "AgeTypeList",
                                List = new SelectList(new List <string>()
                                {
                                    "Days",
                                    "Weeks",
                                    "Months",
                                    "Years"
                                })
                            });
                        }
                        if (SubCategory.Name.Equals("Lost Pet"))
                        {
                            var list = SelectLists.SingleOrDefault(x => x.Name.Equals("AdType")).List.ToList();
                            list.Remove(list.SingleOrDefault(x => x.Text == "TRADE"));
                            list.SingleOrDefault(x => x.Text == "SELL").Value = "Found";
                            list.SingleOrDefault(x => x.Text == "WANT").Value = "Missing";
                            // remove old list
                            SelectLists.Remove(SelectLists.SingleOrDefault(x => x.Name.Equals("AdType")));
                            // recreate new list
                            SelectLists.Add(new SelectListForm()
                            {
                                Name = "AdType", List = new SelectList(list, "Value", "Text", "All Ads")
                            });
                        }
                    }
                    else if (SubCategory.Name.Equals("Pet Services"))
                    {
                        SelectLists.Add(new SelectListForm()
                        {
                            Name = "SpeciesList",
                            List = new SelectList(new List <string>()
                            {
                                "All",
                                "Bird",
                                "Cat",
                                "Dog",
                                "Fish",
                                "Other"
                            })
                        });
                    }
                }
                CountryAdList = new List <CountryAdList>();
                CountryAdList = Manager.GetCountryAdLists(CountryId);
            }
        }
Пример #6
0
        public void ConfigureForm(BaseApplicationManager m)
        {
            if (SelectListForm == null)
            {
                SelectListForm = new List <SelectListForm>();
            }

            // Set Price Info (Saved values set in view)
            SelectListForm.Add(new SelectListForm()
            {
                Name = "PriceInfoList", List = new SelectList(m.GetAllPriceInfo(), "Value", "Value", (PriceInfo ?? null))
            });

            // populate select lists (Saved values set in view)
            SelectListForm.Add(new SelectListForm()
            {
                Name = "CountryList", List = new SelectList(m.GetAllCountries(), "Id", "Name", CountryId)
            });

            if (CountryId.HasValue)
            {
                var regions = m.GetAllRegionsByCountryId(CountryId.Value);
                SelectListForm.Add(new SelectListForm()
                {
                    Name = "RegionList", List = new SelectList(regions, "Id", "Name", 0)
                });
            }
            else
            {
                SelectListForm.Add(new SelectListForm()
                {
                    Name = "RegionList", List = new SelectList(Enumerable.Empty <SelectListItem>())
                });
            }

            // =======================
            if (SubCategoryName.Equals("Cars/Trucks"))
            {
                SelectListForm.Add(new SelectListForm()
                {
                    Name = "MakeList", List = new SelectList(m.GetAllMake(), "Value", "Value", (AdInfo != null) ? AdInfo.SingleOrDefault(x => x.Name.Equals("Make")).Description : null)
                });
                SelectListForm.Add(new SelectListForm()
                {
                    Name = "BodyTypeList", List = new SelectList(m.BodyTypeGetAll(), "Value", "Value", (AdInfo != null) ? AdInfo.SingleOrDefault(x => x.Name.Equals("Body Type")).Description : null)
                });
                SelectListForm.Add(new SelectListForm()
                {
                    Name = "TransmissionList", List = new SelectList(m.GetAllTransmission(), "Value", "Value", (AdInfo != null) ? AdInfo.SingleOrDefault(x => x.Name.Equals("Transmission")).Description : null)
                });
                SelectListForm.Add(new SelectListForm()
                {
                    Name = "FuelTypeList", List = new SelectList(m.GetAllFuelType(), "Value", "Value", (AdInfo != null) ? AdInfo.SingleOrDefault(x => x.Name.Equals("Fuel Type")).Description : null)
                });
                SelectListForm.Add(new SelectListForm()
                {
                    Name = "ConditionList", List = new SelectList(m.GetAllCondition(), "Value", "Value", (AdInfo != null) ? AdInfo.SingleOrDefault(x => x.Name.Equals("Condition")).Description : null)
                });
                SelectListForm.Add(new SelectListForm()
                {
                    Name = "DrivetrainList", List = new SelectList(m.GetAllDrivetrain(), "Value", "Value", (AdInfo != null) ? AdInfo.SingleOrDefault(x => x.Name.Equals("Drivetrain")).Description : null)
                });
            }
            else if (SubCategoryName.Equals("Motorcycles/ATVs"))
            {
                SelectListForm.Add(new SelectListForm()
                {
                    Name = "MakeList", List = new SelectList(m.GetAllMake(), "Value", "Value", (AdInfo != null) ? AdInfo.SingleOrDefault(x => x.Name.Equals("Make")).Description : null)
                });
                SelectListForm.Add(new SelectListForm()
                {
                    Name = "FuelTypeList", List = new SelectList(m.GetAllFuelType(), "Value", "Value", (AdInfo != null) ? AdInfo.SingleOrDefault(x => x.Name.Equals("Fuel Type")).Description : null)
                });
                SelectListForm.Add(new SelectListForm()
                {
                    Name = "ConditionList", List = new SelectList(m.GetAllCondition(), "Value", "Value", (AdInfo != null) ? AdInfo.SingleOrDefault(x => x.Name.Equals("Condition")).Description : null)
                });
            }
            else if (SubCategoryName.Equals("Automotive Parts"))
            {
                SelectListForm.Add(new SelectListForm()
                {
                    Name = "MakeList", List = new SelectList(m.GetAllMake(), "Value", "Value", (AdInfo != null) ? AdInfo.SingleOrDefault(x => x.Name.Equals("Make")).Description : null)
                });
                SelectListForm.Add(new SelectListForm()
                {
                    Name = "ConditionList", List = new SelectList(m.GetAllCondition(), "Value", "Value", (AdInfo != null) ? AdInfo.SingleOrDefault(x => x.Name.Equals("Condition")).Description : null)
                });
            }
            else if (CategoryName.Equals("Real Estate"))
            {
                if (SubCategoryName.Equals("Apartments/Condos Rental") || SubCategoryName.Equals("House Rental") || SubCategoryName.Equals("Land Rental/Leasing"))
                {
                    SelectListForm.Add(new SelectListForm()
                    {
                        Name = "RentalType",
                        List = new SelectList(new List <string>()
                        {
                            "Rental Only",
                            "Rent To Own"
                        }, (AdInfo != null) ? AdInfo.DefaultIfEmpty(null).SingleOrDefault(x => x.Name.Equals("Rental Type")).Description : null)
                    });
                }

                if (SubCategoryName.Contains("Apartments/Condos") || SubCategoryName.Contains("House"))
                {
                    SelectListForm.Add(new SelectListForm()
                    {
                        Name = "BedroomList",
                        List = new SelectList(new List <string>()
                        {
                            "Bachelor / Studio",
                            "1 bedroom",
                            "2 bedrooms",
                            "3 bedrooms",
                            "4 bedrooms",
                            "5 or more bedrooms"
                        }, (AdInfo != null) ? AdInfo.DefaultIfEmpty(null).SingleOrDefault(x => x.Name.Equals("Bedrooms")).Description : null)
                    });
                    SelectListForm.Add(new SelectListForm()
                    {
                        Name = "BathroomList",
                        List = new SelectList(new List <string>()
                        {
                            "1 bathroom",
                            "2 bathrooms",
                            "3 bathrooms",
                            "4 bathrooms",
                            "5 or more bathrooms"
                        }, (AdInfo != null) ? AdInfo.SingleOrDefault(x => x.Name.Equals("Bathrooms")).Description : null)
                    });
                    SelectListForm.Add(new SelectListForm()
                    {
                        Name = "FurnishedList",
                        List = new SelectList(new List <string>()
                        {
                            "Unfurnished",
                            "Semi-Furnished",
                            "Fully-Furnished"
                        }, (AdInfo != null) ? AdInfo.SingleOrDefault(x => x.Name.Equals("Furnished")).Description : null)
                    });
                }
                else if (SubCategoryName.Equals("Commercial Office Space"))
                {
                    SelectListForm.Add(new SelectListForm()
                    {
                        Name = "FurnishedList",
                        List = new SelectList(new List <string>()
                        {
                            "Unfurnished",
                            "Semi-Furnished",
                            "Fully-Furnished"
                        }, (AdInfo != null) ? AdInfo.SingleOrDefault(x => x.Name.Equals("Furnished")).Description : null)
                    });
                }
            }
            else if (CategoryName.Equals("Jobs"))
            {
                SelectListForm.Add(new SelectListForm()
                {
                    Name = "JobTypeList",
                    List = new SelectList(new List <string>()
                    {
                        "Full-time",
                        "Permanent Full-time",
                        "Part-time",
                        "Permanent Part-time",
                        "Temporary",
                        "Contract",
                        "Internship",
                        "Project",
                        "Please Contact"
                    }, (AdInfo != null) ? AdInfo.SingleOrDefault(x => x.Name.Equals("Job Type")).Description : null)
                });
                SelectListForm.Add(new SelectListForm()
                {
                    Name = "SalaryInfoList",
                    List = new SelectList(new List <string>()
                    {
                        "Hourly",
                        "Daily",
                        "Weekly",
                        "Fortnightly",
                        "Monthly",
                        "Yearly"
                    }, (AdInfo != null) ? AdInfo.SingleOrDefault(x => x.Name.Equals("Salary Type")).Description : null)
                });
            }
            else if (CategoryName.Equals("Pets"))
            {
                if (SubCategoryName.Equals("Lost Pet") || SubCategoryName.Equals("Pet Adoption") || SubCategoryName.Equals("Pet Hub") || SubCategoryName.Equals("Pet Services") || SubCategoryName.Equals("Pet Accessories") || SubCategoryName.Equals("Pet & Animal Services"))
                {
                    SelectListForm.Add(new SelectListForm()
                    {
                        Name = "SpeciesList",
                        List = new SelectList(new List <string>()
                        {
                            "Bird",
                            "Cat",
                            "Dog",
                            "Fish",
                            "Other"
                        }, (AdInfo != null) ? AdInfo.SingleOrDefault(x => x.Name.Equals("Species")).Description : null)
                    });
                }
            }
            // Handles Create ad photo init
            if (Photos == null)
            {
                if (CategoryName.Equals("Jobs"))
                {
                    Photos = new UploadPhoto[1];
                }
                else if (SubCategoryName.Contains("Apartments/Condos") || SubCategoryName.Contains("House") || SubCategoryName.Contains("Office") || SubCategoryName.Contains("Cars/Trucks"))
                {
                    Photos = new UploadPhoto[12];
                }
                else
                {
                    Photos = new UploadPhoto[6];
                }
            }
        }
Пример #7
0
        public new void ConfigureForm(BaseApplicationManager m)
        {
            CurrentPhotoCount = Photos.Length;
            if (Photos != null)
            {
                var temp = Photos;
                var max  = 0;
                if (CategoryName.Equals("Jobs"))
                {
                    max = 1;
                }
                else if (SubCategoryName.Contains("Apartments/Condos") || SubCategoryName.Contains("House") || SubCategoryName.Contains("Office") || SubCategoryName.Contains("Cars/Trucks"))
                {
                    max = 12;
                }
                else
                {
                    max = 6;
                }
                Photos = new UploadPhoto[max];
                for (int i = 0; i < max; i++)
                {
                    Photos[i] = _getPhoto(i, temp.Length, temp);
                }
            }
            base.ConfigureForm(m);
            try
            {
                var years = AdInfo.Where(x => x.Name.Equals("Year")).ToList();
                if (years != null && years.Count > 1)
                {
                    AdInfo.FirstOrDefault(x => x.Name.Equals("Year")).Description = years.FirstOrDefault().Description + "-" + years.LastOrDefault().Description;
                    foreach (var y in years)
                    {
                        if (y != years.FirstOrDefault())
                        {
                            AdInfo.Remove(y);
                        }
                    }
                }

                var ages = AdInfo.Where(x => x.Name.Equals("Age")).ToList();
                if (ages != null && ages.Count > 0)
                {
                    foreach (var a in ages)
                    {
                        if (a != ages.FirstOrDefault())
                        {
                            AdInfo.Remove(a);
                        }
                    }
                    if (ages.FirstOrDefault().Description != null)
                    {
                        AgeType = AdInfo.SingleOrDefault(x => x.Name.Equals("Age")).Description.Split(' ').Last();
                        AdInfo.SingleOrDefault(x => x.Name.Equals("Age")).Description = AdInfo.SingleOrDefault(x => x.Name.Equals("Age")).Description.Split(' ').First();
                    }
                }
                var ai = m.GetAdTemplate(SubCategoryId).Except(AdInfo, new CustomCompare()).ToList();
                AdInfo = AdInfo.Union(ai).ToList();
            }
            catch (Exception) { }
        }