コード例 #1
0
        public async Task <ActionResult> DeleteConfirmed(long id)
        {
            listing listing = await db.listings.FindAsync(id);

            db.listings.Remove(listing);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
コード例 #2
0
    void Spawn(listing l)
    {
        current = Server.instance.AddEntity(Server.instance.GetEmptyID(), monster.name) as Entity; //spawn monster from name on Server

        //set pos and rotation of spawned monster
        current.transform.parent   = transform;
        current.transform.position = transform.position;

        current.level = RollLevel(); //figure out level
    }
コード例 #3
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,GivenBy,CreatedTime,Amount,Currency,EndDate,NoAvailable,student_id")] listing listing)
        {
            if (ModelState.IsValid)
            {
                db.Entry(listing).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.student_id = new SelectList(db.students, "Id", "Name", listing.student_id);
            return(View(listing));
        }
コード例 #4
0
    public void CreateGame(listing l)
    {
        hostedGame = l;
        SerializeHostedGame(); //serializes it too

        Debug.Log("sending " + serializedGame);

        if (refreshListing != default(CoroutineHandle))
        {
            Timing.KillCoroutines(refreshListing);
        }
        refreshListing = Timing.RunCoroutine(RefreshGame());
    }
コード例 #5
0
        // GET: listings/Details/5
        public async Task <ActionResult> Details(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            listing listing = await db.listings.FindAsync(id);

            if (listing == null)
            {
                return(HttpNotFound());
            }
            return(View(listing));
        }
コード例 #6
0
        //Method to fetch the listing data by id from the database
        public listing GetListing(int id)
        {
            try
            {
                listing _listing = (from table in db.listings
                                    where table.id.Equals(id)
                                    select table).FirstOrDefault();

                return(_listing);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #7
0
        // GET: listings/Edit/5
        public async Task <ActionResult> Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            listing listing = await db.listings.FindAsync(id);

            if (listing == null)
            {
                return(HttpNotFound());
            }
            ViewBag.student_id = new SelectList(db.students, "Id", "Name", listing.student_id);
            return(View(listing));
        }
コード例 #8
0
        //Method to Update the listing data into the database
        public void EditListing(listing _Listing)
        {
            try
            {
                listing _listing = (from table in db.listings
                                    where table.id.Equals(_Listing.id)
                                    select table).FirstOrDefault();

                if (_listing != null)
                {
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #9
0
        //Method to Filter out the listing data
        public List <listing> FilterSearch(listing filter)
        {
            try
            {
                db.Configuration.ProxyCreationEnabled = false;

                var result = db.listings.Where(f => (filter.layout == "0" || f.layout == filter.layout) &&
                                               (filter.bathroom == "0" || f.bathroom == filter.bathroom) &&
                                               (filter.price == 0 || f.price <= filter.price) &&
                                               (filter.managementid == 0 || f.managementid == filter.managementid) &&
                                               (filter.buildingid == 0 || f.buildingid == filter.buildingid) &&
                                               (filter.has_photos == null || f.has_photos == true) &&
                                               (filter.has_floorplans == null || f.has_floorplans == true)).ToList();
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #10
0
 public ActionResult Add(listing addListing)
 {
     try
     {
         //Check Authentication
         if (Session["user"] == null)
         {
             return(RedirectToAction("Index", "Login"));
         }
         //Object Initiliaze
         ListingModel model    = new ListingModel();
         Agents       agent    = new Agents();
         Buildings    building = new Buildings();
         Features     feature  = new Features();
         //Start performing the logic section
         model.AgentList = agent.GetAgents().Select(t => new ListingAgentControl()
         {
             Name    = t.firstname + " " + t.lastname,
             Id      = t.id,
             IsCheck = false
         }).ToList();
         model.BuildingList = building.GetBuildings().Select(t => new SelectListItem
         {
             Text  = t.Name,
             Value = t.id.ToString()
         }).ToList();
         model.BuildingFeaturesList = feature.GetFeatures().Select(t => new BuildingFeaturesControl()
         {
             features_name = t.features_name,
             id            = t.id,
             IsCheck       = false
         }).ToList();
         model.OpenHouseList.Add(new OpenHouse());
         return(View(model));
     }
     catch (Exception ex)
     {
         //handling exception
         throw ex;
     }
 }
コード例 #11
0
        //Method to Add the listing data into the database
        public int AddListing(listing _Listing, List <ListingAgentControl> _ListingAgents)
        {
            int id = 0;

            try
            {
                listing _listings = (from table in db.listings
                                     where table.id.Equals(_Listing.id)
                                     select table).FirstOrDefault();
                if (_listings != null)
                {
                    id = _listings.id;
                }

                if (_listings == null)
                {
                    db.listings.Add(_Listing);
                    db.SaveChanges();
                    id = _Listing.id;
                    ListingAgents ListingAgents = new ListingAgents();
                    foreach (var item in _ListingAgents)
                    {
                        if (item.IsCheck)
                        {
                            listingagent _listingagent = new listingagent();
                            _listingagent.listingid = id;
                            _listingagent.agentid   = item.Id;
                            ListingAgents.AddListingAgents(_listingagent);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(id);
        }
コード例 #12
0
        public async Task <ActionResult> Create(listing listing)
        {
            if (ModelState.IsValid)
            {
                var l = new listing();
                l.Amount      = listing.Amount;
                l.CreatedTime = DateTime.Now;
                l.Currency    = listing.Currency;
                l.EndDate     = listing.EndDate;
                l.GivenBy     = listing.GivenBy;
                l.NoAvailable = listing.NoAvailable;
                var str = System.Web.HttpContext.Current.Session["UserName"].ToString();
                l.student_id = db.students.Where(x => x.Name == str).FirstOrDefault().Id;

                db.listings.Add(l);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.student_id = new SelectList(db.students, "Id", "Name", listing.student_id);
            return(View(listing));
        }
コード例 #13
0
        public ActionResult Details(int id)
        {
            try
            {
                //Check Authentication
                if (Session["user"] == null)
                {
                    return(RedirectToAction("Index", "Login"));
                }
                //Object Initiliaze
                ListingModel model       = new ListingModel();
                Listings     lstdetails  = new Listings();
                listing      objlisting  = new listing();
                Features     objfeatures = new Features();
                Buildings    objBuilding = new Buildings();
                List <ListingFeaturesControl> lstListingFeaturesControl = new List <ListingFeaturesControl>();
                BuildingFeatures objbuildingfeatures = new BuildingFeatures();
                List <feature>   lstfeat             = new List <feature>();
                objlisting = lstdetails.GetListing(id);

                //Start performing the logic section
                List <buildingfeature> newobjBuildingFeatures = objbuildingfeatures.GetBuildingFeature(objlisting.buildingid);
                foreach (var item in newobjBuildingFeatures)
                {
                    feature objfeat = objfeatures.GetFeatureById(item.id);
                    lstfeat.Add(objfeat);
                }
                foreach (var item in lstfeat)
                {
                    ListingFeaturesControl objListFeat = new ListingFeaturesControl();
                    if (string.IsNullOrEmpty(Convert.ToString(objListFeat)))
                    {
                        objListFeat.features_name = item.features_name;
                        objListFeat.id            = item.id;
                        lstListingFeaturesControl.Add(objListFeat);
                    }
                }
                var building = objBuilding.GetBuilding(objlisting.buildingid);
                model.BuildingName  = building.Name;
                model.Features      = lstListingFeaturesControl;
                model.Address       = objlisting.address;
                model.id            = objlisting.id;
                model.Price         = Convert.ToInt32(objlisting.price);
                model.PropertyType  = objlisting.propertytype;
                model.Layout        = objlisting.layout;
                model.Bathroom      = objlisting.bathroom;
                model.Sqft          = objlisting.sqft;
                model.property_type = objlisting.property_type;
                if (objlisting.property_type == "Residential")
                {
                    model.res_type_str = objlisting.res_type;
                }
                else
                {
                    model.com_type_str = objlisting.com_type;
                }
                model.OwnershipType    = objlisting.ownershiptype;
                model.UnitNumber       = objlisting.unitnumber;
                model.FloorNumber      = objlisting.floornumber;
                model.createdAt        = (DateTime)objlisting.createddate;
                model.PetPolicyListstr = objlisting.petpolicy;
                model.Minleaseterm     = objlisting.minleaseterm;
                model.DateAvailable    = (DateTime)objlisting.dateavailable;
                ListingUploads getObjListingUpload = new ListingUploads();

                var filename = getObjListingUpload.GetListingUploadById(objlisting.id, "PHOTOS").Select(t => t.image).FirstOrDefault();
                if (!string.IsNullOrEmpty(filename))
                {
                    var filenamestr = filename.Split('\\');
                    ViewBag.PhotosList = filenamestr[6];
                }
                else
                {
                    ViewBag.PhotosList = "Desert.jpg";
                }
                ViewBag.PhotoCount = getObjListingUpload.GetListingUploadById(objlisting.id, "PHOTOS").Count.ToString();
                return(View(model));
            }
            catch (Exception ex)
            {
                //handling exception
                throw ex;
            }
        }
コード例 #14
0
 public virtual void ConnectGame(listing game)
 {
 }
コード例 #15
0
    public void ReceiveGames(string data)
    {
        //create list of listings
        //Debug.Log("receivedGames: \n" + data);

        string[] split = data.Substring(1, data.Length - 1).Split(delimeters.listingGroups, StringSplitOptions.RemoveEmptyEntries); //remove mmcode and divide into individual listings
        string[] fields;                                                                                                            //individual listings data but split. temp variable
        for (int i = 0; i < split.Length; i++)
        {
            // Debug.Log("parsing " + i  + "/" + (split.Length) + ": " + split[i]);

            fields = new string(split[i].ToCharArray()).Split(delimeters.listing); //copy to temp to avoid splitting orig and split listing into readable fields

            // Debug.Log("fields: " + fields.Length);

            //  Debug.Log("game running on " + split[i].Substring(8, split[i].IndexOf(delimeters.slisting) - 8) + ":" + fields[1] + " at " + fields[5]);

            if (!listings.ContainsKey(fields[5]))   //if dict doesn't contain listing for ip+port given, add, otherwise replace
            //listings.Add(split[i].Substring(8, split[i].IndexOf(delimeters.slisting) - 8) + fields[1],
            {
                listings.Add(fields[5],                                                            //actually guid now...
                             new listing(
                                 DateTime.Now,                                                     //date
                                 fields[0][0],                                                     //game type
                                 fields[0][1],                                                     //map
                                 fields[0].Substring(2, 3),                                        //num max
                                 fields[0].Substring(5, 3),                                        //num connected
                                 split[i].Substring(8, split[i].IndexOf(delimeters.slisting) - 8), //ip is from char 9 to the first delimeter
                                 fields[1],                                                        //ports
                                 fields[2],                                                        //game host playername
                                 fields[3],                                                        //game name
                                 fields[4],                                                        //description
                                 fields[5]                                                         //guid
                                 ));
            }
            else
            {                                                                         //replace
                //listings[split[i].Substring(8, split[i].IndexOf(delimeters.slisting) - 8) + fields[1]] =
                listings[fields[5]] =                                                 //actually guid now...
                                      new listing(
                    DateTime.Now,                                                     //date
                    fields[0][0],                                                     //game type
                    fields[0][1],                                                     //map
                    fields[0].Substring(2, 3),                                        //num max
                    fields[0].Substring(5, 3),                                        //num connected
                    split[i].Substring(8, split[i].IndexOf(delimeters.slisting) - 8), //ip is from char 9 to the first delimeter
                    fields[1],                                                        //port
                    fields[2],                                                        //game host playername
                    fields[3],                                                        //game name
                    fields[4],                                                        //description
                    fields[5]
                    );
            }
        }



        if (onReceiveGames != null && listings != null)
        {
            onReceiveGames(new Dictionary <string, listing>(listings)); //pass copy to avoid read/write errors to OfflineGUI
        }
    }
コード例 #16
0
        public ActionResult FilterList(ListingModel filter)
        {
            try
            {
                //Check Authentication
                if (Session["user"] == null)
                {
                    return(RedirectToAction("Index", "Login"));
                }

                //Object Initialize
                listing        objlst        = new listing();
                ListingModel   lstListing    = new ListingModel();
                List <listing> objlist       = new List <listing>();
                Buildings      objbuilding   = new Buildings();
                Managements    objmanagement = new Managements();

                //Start performing the logic section
                objlst.managementid = Convert.ToInt32(filter.companyid);
                objlst.buildingid   = Convert.ToInt32(filter.buildid);
                objlst.layout       = Convert.ToString(filter.LayoutList);
                objlst.bathroom     = Convert.ToString(filter.BathroomList);
                var strPrice = (int)((Common.FilterPrice)Enum.Parse(typeof(Common.FilterPrice), filter.FilterPriceList.ToString()));
                objlst.price = Convert.ToDecimal(strPrice);
                var strMedia = (int)((Common.Media)Enum.Parse(typeof(Common.Media), filter.MediaList.ToString()));

                if (strMedia == 1)
                {
                    objlst.has_photos = true;
                }
                else if (strMedia == 2)
                {
                    objlst.has_floorplans = true;
                }

                objlist = new Listings().FilterSearch(objlst);
                if (objlist.Count > 0)
                {
                    foreach (var itm in objlist)
                    {
                        FilterListingControl objFilterControl = new FilterListingControl();
                        var Building = objbuilding.GetBuilding(itm.buildingid);
                        if (!string.IsNullOrEmpty(Convert.ToString(Building)))
                        {
                            objFilterControl.buildingName = Building.Name;
                            var Management = objmanagement.GetManagement(Building.managementid);
                            if (!string.IsNullOrEmpty(Convert.ToString(Management)))
                            {
                                objFilterControl.companyName = Management.name;
                            }
                            else
                            {
                                objFilterControl.companyName = string.Empty;
                            }
                        }
                        else
                        {
                            objFilterControl.buildingName = string.Empty;
                        }
                        objFilterControl.Address            = itm.address;
                        objFilterControl.Price              = itm.price;
                        objFilterControl.id                 = itm.id;
                        objFilterControl.Incentives         = itm.incentives;
                        objFilterControl.Layout             = itm.layout;
                        objFilterControl.Sqft               = itm.sqft;
                        objFilterControl.UnitNumber         = itm.unitnumber;
                        objFilterControl.Bathroom           = itm.bathroom;
                        objFilterControl.BuildingUnitNumber = itm.unitnumber;
                        lstListing.FilterResult.Add(objFilterControl);
                    }
                }
                return(PartialView("_FilterListing", lstListing));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #17
0
        public ActionResult Add(ListingModel model)
        {
            try
            {
                //Check Authentication
                if (Session["user"] == null)
                {
                    return(RedirectToAction("Index", "Login"));
                }
                //Object Initiliaze
                listing        _listing        = new listing();
                Buildings      _building       = new Buildings();
                Listings       listings        = new Listings();
                listingupload  _listinguploads = new listingupload();
                ListingUploads listinguploads  = new ListingUploads();

                //Start performing the logic section
                var building = _building.GetBuilding(model.BuildingId);
                _listing.address              = building.address;
                _listing.propertytype         = Convert.ToString(model.PropertyType);
                _listing.ownershiptype        = Convert.ToString(model.OwnershipType);
                _listing.unitnumber           = model.UnitNumber;
                _listing.floornumber          = model.FloorNumber;
                _listing.layout               = Convert.ToString(model.LayoutList);
                _listing.bathroom             = Convert.ToString(model.BathroomList);
                _listing.sqft                 = model.Sqft;
                _listing.price                = model.Price;
                _listing.dateavailable        = model.DateAvailable;
                _listing.minleaseterm         = model.Minleaseterm;
                _listing.maxleaseterm         = model.Maxleaseterm;
                _listing.furnished            = Convert.ToString(model.FurnishedList);
                _listing.furnishedamount      = Convert.ToDecimal(model.FurnishedAmount);
                _listing.feestructure         = Convert.ToString(model.Feestructure);
                _listing.incentives           = Convert.ToString(model.IncentivesList);
                _listing.renterpays           = model.Renterpays;
                _listing.commissionpercentage = model.CommissionPercentage;
                _listing.cobrokesplit         = model.Cobrokesplit;
                _listing.exclusivetype        = Convert.ToString(model.ExclusiveTypeList);
                if (model.Exclusiveagreement != null)
                {
                    var file = model.Exclusiveagreement;
                    if (file != null && file.ContentLength > 0)
                    {
                        var fileName = Path.GetFileName(file.FileName);
                        var path     = Path.Combine(Server.MapPath("~/images/ExecutiveAgreement/"), fileName);
                        file.SaveAs(path);
                        _listing.exclusiveagreement = path;
                    }
                }
                _listing.petpolicy                 = Convert.ToString(model.PetPolicyList);
                _listing.unitcondition             = Convert.ToString(model.UnitConditionList);
                _listing.unitview                  = Convert.ToString(model.UnitViewList);
                _listing.unitexposure              = Convert.ToString(model.UnitExposure);
                _listing.publicunitdescription     = model.PublicUnitDescription;
                _listing.brokerviewinginstructions = model.BrokerViewingInstructions;
                _listing.occupancystatus           = Convert.ToString(model.OccupancyStatusList);
                _listing.firstshowingdate          = model.FirstShowingDate;
                _listing.keyinoffice               = model.KeyInOffice;
                _listing.keydetails                = model.KeyDetails;
                _listing.privateunitnotes          = model.PrivateUnitNotes;
                _listing.listingprivate            = model.ListingPrivate;
                _listing.managementid              = 2;
                _listing.createddate               = DateTime.Now;
                _listing.updateddate               = DateTime.Now;
                _listing.isactive                  = true;
                _listing.status              = 1;
                _listing.buildingid          = model.BuildingId;
                _listing.sales_price         = model.sales_price;
                _listing.sales_date          = model.sales_date;
                _listing.sales_cc_main_fee   = model.sales_cc_main_fee;
                _listing.sales_monthly_tax   = model.sales_monthly_tax;
                _listing.sales_comm_struct   = model.sales_comm_struct;
                _listing.sales_tax_deduction = model.sales_tax_deduction;
                _listing.sales_flip_tax      = model.sales_flip_tax;
                _listing.sales_max_fin       = model.sales_max_fin;
                _listing.sales_exe_type      = Convert.ToString(model.sales_exe_type);
                _listing.property_type       = model.property_type;
                if (model.property_type == "Residential")
                {
                    _listing.res_type = Convert.ToString(model.res_type);
                }
                else
                {
                    _listing.com_type = Convert.ToString(model.com_type);
                }
                _listing.com_sqft          = model.com_sqft;
                _listing.com_electric_cost = model.com_electric_cost;
                _listing.com_lease_type    = Convert.ToString(model.com_lease_type);
                _listing.is_divide         = model.is_divide;
                _listing.is_food_ok        = model.is_food_ok;
                _listing.is_vented         = model.is_vented;
                _listing.listing_type      = model.listing_type;
                if (model.PhotoUploadList.Count > 0)
                {
                    _listing.has_photos = true;
                }
                else
                {
                    _listing.has_photos = false;
                }
                if (model.FloorUploadList.Count > 0)
                {
                    _listing.has_floorplans = true;
                }
                else
                {
                    _listing.has_floorplans = false;
                }

                int Id = listings.AddListing(_listing, model.AgentList);

                if (model.PhotoUploadList.Count > 0)
                {
                    foreach (HttpPostedFileBase photofile in model.PhotoUploadList)
                    {
                        if (photofile != null && photofile.ContentLength > 0)
                        {
                            var fileName = Path.GetFileName(photofile.FileName);
                            var path     = Path.Combine(Server.MapPath("~/images/Photos/"), fileName);
                            photofile.SaveAs(path);
                            _listinguploads.image     = path;
                            _listinguploads.type      = "PHOTOS";
                            _listinguploads.listingid = Id;
                            listinguploads.AddListingUploads(_listinguploads);
                        }
                    }
                }
                if (model.FloorUploadList.Count > 0)
                {
                    foreach (HttpPostedFileBase floorfile in model.FloorUploadList)
                    {
                        if (floorfile != null && floorfile.ContentLength > 0)
                        {
                            var fileName = Path.GetFileName(floorfile.FileName);
                            var path     = Path.Combine(Server.MapPath("~/images/FloorPlans/"), fileName);
                            floorfile.SaveAs(path);
                            _listinguploads.image     = path;
                            _listinguploads.type      = "FLOORPLANS";
                            _listinguploads.listingid = Id;
                            listinguploads.AddListingUploads(_listinguploads);
                        }
                    }
                }
                if (model.BuildingFeaturesList.Count > 0)
                {
                    BuildingFeatures buildingFeatures = new BuildingFeatures();
                    foreach (var item in model.BuildingFeaturesList)
                    {
                        buildingfeature newBuildingFeature = new buildingfeature();
                        newBuildingFeature.buildingid = model.BuildingId;
                        newBuildingFeature.featuresid = item.id;
                        buildingFeatures.AddBuildingFeatures(newBuildingFeature);
                    }
                }
                if (model.OpenHouseList.Count > 0)
                {
                    OpenHouses objOpenHouses = new OpenHouses();
                    foreach (var item in model.OpenHouseList)
                    {
                        openhous newOpenHous = new openhous();
                        newOpenHous.appoinmentonly = item.IsAppointmentOnly;
                        newOpenHous.brokeronly     = item.IsBrokerOnly;
                        newOpenHous.date           = item.openhousedate;
                        newOpenHous.endtime        = item.openhouseendtime;
                        newOpenHous.starttime      = item.openhousestarttime;
                        newOpenHous.repeat         = Convert.ToString(item.RepeatId);
                        newOpenHous.listingid      = Id;
                        objOpenHouses.AddOpenHouse(newOpenHous);
                    }
                }
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                //handling exception
                throw ex;
            }
        }