public ActionResult CreateAds([Bind(Exclude = "Image")] Advertisment advertisment, HttpPostedFileBase Image)
        {
            if (ModelState.IsValid)
            {
                if (Image != null)
                {
                    if (Extensions.Extensions.CheckImageType(Image))
                    {
                        advertisment.Image     = Extensions.Extensions.SaveImage(Server.MapPath("~/Images/Ads"), Image);
                        advertisment.CreatedAt = advertisment.UpdatedAt = DateTime.Now;
                        advertisment.UserID    = (Session["user"] as User).ID;

                        db.Advertisments.Add(advertisment);
                        db.SaveChanges();
                        return(RedirectToAction("Index", "Home"));
                    }
                    else
                    {
                        ModelState.AddModelError("Image", "The type of image is incorrect or the size of image is greater than 10 Mb.");
                    }
                }
                else
                {
                    ModelState.AddModelError("Image", "Please choose image.");
                }
            }
            return(View());
        }
예제 #2
0
        public Advertisment GetAdvertisementBy(string field)
        {
            Advertisment advertisementResult = null;
            Person       personResult        = null;
            MySqlCommand command             = conn.CreateCommand();
            string       queryText           = string.Format("SELECT advertisement.adname, advertisement.price, advertisement.currency, advertisement.servicetype, advertisement.id"
                                                             + "person.id, person.name, person.phone_number, person.email FROM advertisement INNER JOIN person ON advertisement.person_id = person.id");

            command.CommandText = queryText;
            MySqlDataReader dataRead = command.ExecuteReader(CommandBehavior.Default);

            while (dataRead.Read())
            {
                int    price = 0;
                char   currency;
                string adname = dataRead.GetValue(0).ToString();
                int.TryParse(dataRead.GetValue(1).ToString(), out price);
                char.TryParse(dataRead.GetValue(2).ToString(), out currency);
                string servType = dataRead.GetValue(3).ToString();
                int    adId     = (int)dataRead.GetValue(4);
                int    personID = (int)dataRead.GetValue(5);
                if (adname == field || price.ToString() == field || currency.ToString() == field || servType == field || personID.ToString() == field)
                {
                    string personName  = dataRead.GetValue(6).ToString();
                    string phoneNumber = dataRead.GetValue(7).ToString();
                    string eMail       = dataRead.GetValue(8).ToString();
                    personResult        = new Person(personID, personName, phoneNumber, eMail);
                    advertisementResult = new Advertisment(adId, adname, Advertisment.GetServiceFromStr(servType), personResult, price == 0 ? "" : price.ToString() + currency);
                }
            }
            dataRead.Close();

            return(advertisementResult);
        }
예제 #3
0
        public string GetList()
        {
            Database            db   = new Database();
            List <Advertisment> advs = new List <Advertisment>();

            SqlConnection conn = new SqlConnection(db.connectionString);

            conn.Open();

            SqlCommand command = new SqlCommand("SELECT * FROM [AdvertismentTest].[dbo].[advertisments]", conn);

            using (SqlDataReader reader = command.ExecuteReader())
            {
                while (reader.Read())
                {
                    Advertisment adv = new Advertisment((int)reader["id"], (string)reader["firstname"],
                                                        (string)reader["lastname"], (string)reader["patronimic"],
                                                        (string)reader["phonenumber"], (string)reader["email"], (int)reader["age"],
                                                        (string)reader["advtext"], Convert.ToSingle(reader["priceusd"]),
                                                        Convert.ToSingle(reader["courseusd"]), Convert.ToSingle(reader["pricebyn"]));

                    advs.Add(adv);
                }
            }


            conn.Close();

            string output = JsonConvert.SerializeObject(advs, Formatting.None);

            HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", "*");

            return(output);
        }
예제 #4
0
        /// <summary>
        ///     Provides an option to update an existing advertisement if user is the owner of the advert
        /// </summary>
        /// <param name="advertisment">The advertisement.<seealso cref="Advertisment" /> </param>
        public void UpdateAdvertisment(Advertisment advertisment)
        {
            // Validate arguments
            ArgumentsValidator.Validate(nameof(advertisment), advertisment);
            ArgumentsValidator.Validate(nameof(advertisment.AdvertismentId), advertisment.AdvertismentId);

            Advertisment advert = GetAdvertismentById(advertisment.AdvertismentId.Value);

            if (advert == null)
            {
                throw new ArgumentException("Advertisement not found");
            }

            advert.AdvertismentName        = advertisment.AdvertismentName;
            advert.Category                = advertisment.Category;
            advert.AdvertismentDescription = advertisment.AdvertismentDescription;
            advert.IsBuyNow                = advertisment.IsBuyNow;
            advert.IsAuction               = advertisment.IsAuction;
            advert.IsPromoted              = advertisment.IsPromoted;

            if (advert.IsBuyNow)
            {
                advert.BuyNowPrice = advertisment.BuyNowPrice;
            }

            if (advert.IsAuction)
            {
                advert.CurrentPrice = advertisment.CurrentPrice;
            }

            // update DB with pending changes
            _context.SaveChanges();
        }
예제 #5
0
        public IEnumerable <Advertisment> GetAllAdvertisements()
        {
            List <Advertisment> advs    = new List <Advertisment>();
            MySqlCommand        command = conn.CreateCommand();
            string queryText            = "SELECT * FROM advertisement LEFT JOIN person on(person.id = advertisement.person_id)";

            command.CommandText = queryText;
            MySqlDataReader reader = command.ExecuteReader(CommandBehavior.Default);

            while (reader.Read())
            {
                string      adname      = reader.GetValue(0).ToString();
                int         price       = reader.GetValue(1) != null ? (int)reader.GetValue(1) : 0;
                char        currency    = reader.GetValue(2) != null ? (char)reader.GetValue(2) : char.MinValue;
                ServiceType servType    = Advertisment.GetServiceFromStr(reader.GetValue(3).ToString());
                int         adId        = (int)reader.GetValue(4);
                int         id          = (int)reader.GetValue(5);
                string      name        = reader.GetValue(6).ToString();
                string      phoneNumber = reader.GetValue(7).ToString();
                string      eMail       = reader.GetValue(8).ToString();
                Person      p           = new Person(id, name, phoneNumber, eMail);
                advs.Add(new Advertisment(adId, adname, servType, p, price != 0 ? price.ToString() : ""));
            }
            reader.Close();
            command.Dispose();
            return(advs);
        }
예제 #6
0
        public void InsertInto(Advertisment advertisment)
        {
            if (advertisment == null || advertisment.Who == null)
            {
                throw new Exception("Спроба записати null значення");
            }
            InsertInto(advertisment.Who);
            int          lastID  = GetLastPersonID();
            MySqlCommand command = this.conn.CreateCommand();

            string queryText = string.Format
                                   ("INSERT INTO advertisement(adname,price,currency,servicetype,person_id) VALUES(\"{0}\",{1},\"{2}\",\"{3}\",{4})"
                                   , advertisment.NameOfAd, advertisment.Price.Substring(0, advertisment.Price.Length - 1)
                                   , advertisment.Price[advertisment.Price.Length - 1], advertisment.ServiceType.ToString(), lastID);

            command.CommandText = queryText;
            int result = command.ExecuteNonQuery();

            if (result == 1)
            {
                Console.WriteLine("Успiшно добавлено в базу даних");
            }
            else
            {
                throw new Exception("Помилка при вставцi");
            }
            command.Dispose();
        }
예제 #7
0
        //GetTaxanomy
        //AddToSharePoinList
        public void AddToSharePoinList(ClientContext context, Advertisment formData, string listTitle)
        {
            _user = GetUser();
            List bookedRooms = context.Web.Lists.GetByTitle(listTitle);
            ListItemCreationInformation SVitemCreateInfo = new ListItemCreationInformation();
            ListItem newItem = bookedRooms.AddItem(SVitemCreateInfo);

            Web Web = context.Web;

            context.Load(Web);
            context.ExecuteQuery();

            User newUser = Web.EnsureUser(_user.LoginName);

            context.Load(newUser);
            context.ExecuteQuery();

            FieldUserValue userValue = new FieldUserValue
            {
                LookupId = newUser.Id
            };

            newItem["Title"]         = formData.ProductTitle;
            newItem["ubza"]          = formData.Description;
            newItem["Pris"]          = formData.Price;
            newItem["Kategorier"]    = formData.Category;
            newItem["Bild"]          = formData.ImageUrl;
            newItem["S_x00e4_ljare"] = userValue;

            newItem.Update();
            context.ExecuteQuery();
        }
        public ActionResult EditAdvertisment(Advertisment advertisment)
        {
            var dataModel = new DataModel();

            try
            {
                var dbAdvertisment = dataModel.Advertisments
                                     .SingleOrDefault(a => a.Id == advertisment.Id);
                if (dbAdvertisment == null)
                {
                    throw new Exception("Can not find advertisment with current ID.");
                }

                dbAdvertisment.modifyDate = SystemUtils.Utils.Date.GetUkranianDateTimeNow();
                dbAdvertisment.Address1   = advertisment.Address1;
                dbAdvertisment.text       = advertisment.text;

                dataModel.SubmitChanges();
            }
            catch (Exception e)
            {
                ViewBag.ErrorMessage = e.Message;
                return(PartialView("~/Views/Controls/FormSubmitSaveFailed.cshtml"));
            }

            return(PartialView("~/Views/Controls/FormSubmitSaveSuccess.cshtml"));
        }
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }

            Advertisment advertisment = db.Advertisments.Find(id);

            if (advertisment == null)
            {
                return(HttpNotFound("This advertisments not found"));
            }

            DetailsVM vm = new DetailsVM
            {
                Advertisment = advertisment,
                RelatedAds   = db.Advertisments.Where(a => a.Model.ID == advertisment.Model.ID && a.ID != advertisment.ID).Take(5).ToList(),
                ResentNewsVM = new ResentNewsVM
                {
                    News = db.News.Take(5).ToList()
                },
            };

            return(View(vm));
        }
예제 #10
0
        //CheckTermGroupName
        //GetDeatils
        public Advertisment GetDeatils(ClientContext context, string listTitle, int id)
        {
            Advertisment adDetails = new Advertisment();

            if (context != null)
            {
                List     list    = context.Web.Lists.GetByTitle(listTitle);
                ListItem newItem = list.GetItemById(id);
                context.Load(newItem);
                context.ExecuteQuery();

                TaxonomyFieldValue taxFieldValue = newItem["Kategorier"] as TaxonomyFieldValue;
                FieldUserValue     user          = (FieldUserValue)newItem["S_x00e4_ljare"];
                adDetails = new Advertisment
                {
                    ID           = Convert.ToInt32(newItem["ID"]),
                    ProductTitle = newItem["Title"].ToString(),
                    Description  = Convert.ToString(newItem["ubza"]),
                    Created      = Convert.ToDateTime(newItem["Created"]),
                    Price        = Convert.ToDecimal(newItem["Pris"]),
                    Category     = taxFieldValue.Label,
                    ImageUrl     = ((FieldUrlValue)(newItem["Bild"])).Url,
                    Seller       = user.Email,
                    SellerToken  = VerifyUser(user),
                };
            }

            return(adDetails);
        }
예제 #11
0
        //RetriveallFields
        //GetItems
        public List <Advertisment> GetItems(ClientContext context, string listTitle)
        {
            ListItemCollection  listItems = RetriveList2(context, listTitle);
            List <Advertisment> products  = new List <Advertisment>();

            foreach (var items in listItems)
            {
                TaxonomyFieldValue taxFieldValue = items["Kategorier"] as TaxonomyFieldValue;
                FieldUserValue     user          = (FieldUserValue)items["S_x00e4_ljare"];
                Advertisment       product       = new Advertisment
                {
                    ID           = Convert.ToInt32(items["ID"]),
                    ProductTitle = items["Title"].ToString(),
                    Description  = Convert.ToString(items["ubza"]),
                    Created      = Convert.ToDateTime(items["Created"]),
                    Price        = Convert.ToDecimal(items["Pris"]),
                    Category     = taxFieldValue.Label,
                    Seller       = user.Email,
                    SellerToken  = VerifyUser(user),
                };
                products.Add(product);
            }

            return(products);
        }
        public ActionResult EditAds(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound("ID is missing"));
            }

            Advertisment advertisment = db.Advertisments.Find(id);

            if (advertisment == null)
            {
                return(HttpNotFound("ID was not found"));
            }

            ViewBag.Markas           = new SelectList(db.Markas, "ID", "Markaname");
            ViewBag.Models           = new SelectList(db.Models, "ID", "ModelName");
            ViewBag.Cities           = new SelectList(db.Cities, "ID", "Name");
            ViewBag.EngineCapacities = new SelectList(db.EngineCapacities, "ID", "Capacity");
            ViewBag.Colors           = new SelectList(db.Colors, "ID", "Colorname");
            ViewBag.SpeedBoxes       = new SelectList(db.SpeedBoxes, "ID", "BoxType");
            ViewBag.Fueltypes        = new SelectList(db.Fueltypes, "ID", "Fueltype1");


            return(View(advertisment));
        }
예제 #13
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,UserID,DateOfPublication,Accepted,DecisionMade,Description,AdditionalEquipmentDescription,Price,Address,AdvertismentCreator,AdvertismentImages")] Advertisment advertisment)
        {
            if (id != advertisment.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(advertisment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AdvertismentExists(advertisment.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(UserAdvertisments)));
            }
            return(View(advertisment));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Advertisment advertisment = db.Advertisment.Find(id);

            db.Advertisment.Remove(advertisment);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        protected void CreateBarter_Click(object sender, EventArgs e)
        {
            try
            {
                var uow   = new BarterSystemData();
                var newAd = new Advertisment();
                newAd.Title                 = this.TitleAd.Text;
                newAd.Content               = this.Content.Text;
                newAd.CategoryId            = uow.Categories.All().FirstOrDefault(c => c.Name == this.Category.SelectedValue).Id;
                newAd.UserId                = this.User.Identity.GetUserId();
                newAd.Status                = Status.Unapproved;
                newAd.CreationDate          = DateTime.Now;
                newAd.CommentedByUser       = false;
                newAd.CommentedByAcceptUser = false;

                if (this.FileUploadImage.HasFile)
                {
                    if (this.FileUploadImage.PostedFile.ContentLength > 1024000)
                    {
                        Notifier.Error("File has to be less than 1MB");
                        return;
                    }
                    else
                    {
                        string fileName      = this.FileUploadImage.PostedFile.FileName;
                        var    fileExtension = fileName.Substring(fileName.LastIndexOf('.'));
                        var    newName       = Guid.NewGuid() + fileExtension;
                        this.FileUploadImage.SaveAs(Server.MapPath(GlobalConstants.ImagesPath + newName));

                        newAd.ImageUrl = newName;
                    }
                }
                else if (this.ControlImageUrl.HaveUrl())
                {
                    var imageName = Guid.NewGuid().ToString();
                    var filePath  = Server.MapPath(GlobalConstants.ImagesPath + imageName);
                    var extension = this.ControlImageUrl.DownloadRemoteImageFile(filePath);
                    imageName      = imageName + '.' + extension;
                    newAd.ImageUrl = imageName;
                }
                else
                {
                    newAd.ImageUrl = GlobalConstants.DefautlBarterImg;
                }

                uow.Advertisments.Add(newAd);
                uow.SaveChanges();
                Notifier.Success("Barter offer successfully created");
                Response.Redirect("~/Barter/Create");
            }
            catch (Exception er)
            {
                if (er.Message != "Thread was being aborted.")
                {
                    Notifier.Error(er.Message);
                }
            }
        }
 private void Start()
 {
     gameId      = "<my id here>";
     testMode    = false;
     placementId = "<placement id here>";
     // WAIT FOR ADS
     Advertisment.AddListener(this);
     Advertisement.Initialize(gameId, true);
 }
예제 #17
0
        public ActionResult Add(Advertisment a, HttpPostedFileBase file)
        {
            string path = Path.Combine("~/Content/images", file.FileName);

            file.SaveAs(Server.MapPath(path));
            a.Image = file.FileName.ToString();

            advModel.create(a);
            return(RedirectToAction("Index"));
        }
예제 #18
0
        public void Delete(Advertisment advertisement)
        {
            MySqlCommand command   = conn.CreateCommand();
            string       price     = advertisement.Price.Substring(0, advertisement.Price.Length - 1);
            string       currency  = advertisement.Price.Substring(advertisement.Price.Length - 1, 1);
            string       queryText = string.Format("DELETE FROM advertisement WHERE id = {0}", advertisement.ID);

            command.CommandText = queryText;
            command.ExecuteNonQuery();
            command.Dispose();
        }
예제 #19
0
 public Task UpdateAsync(Advertisment entity, dynamic values)
 {
     AttachCollectionItems(values);
     entity.Kind    = DbContext.Set <Kind>().Attach(values.Kind);
     entity.Heating = DbContext.Set <Heating>().Attach(values.Heating);
     DbContext.Entry(entity).CurrentValues.SetValues(values);
     UpdateRelation(entity, old => old.Media, (IEnumerable <Media>)values.Media, media => media.Id);
     UpdateRelation(entity, old => old.Images, (IEnumerable <Image>)values.Images, image => image.Id);
     UpdateRelation(entity, old => old.ExtraInfo, (IEnumerable <ExtraInfo>)values.ExtraInfo, extraInfo => extraInfo.Id);
     return(DbContext.SaveChangesAsync());
 }
예제 #20
0
        public int CreateAdvertisment(Advertisment advertisment)
        {
            _context.Advertisment.Add(advertisment);
            _context.SaveChanges();
            if (advertisment.AdvertismentId.HasValue)
            {
                return(advertisment.AdvertismentId.Value);
            }

            return(-1);
        }
 public ActionResult Edit([Bind(Include = "Id,UserId,CategoryId,CityId,Visits,IsPremium,IsActive,Pub_Time,Exp_Time,Title,Description")] Advertisment advertisment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(advertisment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CityId     = new SelectList(db.City, "Id", "Name", advertisment.CityId);
     ViewBag.CategoryId = new SelectList(db.Category, "Id", "Name", advertisment.CategoryId);
     ViewBag.UserId     = new SelectList(db.AspNetUsers, "Id", "Email", advertisment.UserId);
     return(View(advertisment));
 }
예제 #22
0
        //Details---
        public ActionResult Details(int?id)
        {
            Advertisment ViewModel = new Advertisment();

            using (var context = MySession.Current.spcontext.CreateUserClientContextForSPHost())
            {
                if (context != null)
                {
                    ViewModel = _BuyAndSellRepository.GetDeatils(context, _BuyAndSellRepository.ANNONSLISTA, Convert.ToInt32(id));
                }
            }
            return(View(ViewModel));
        }
        // GET: Advertisments/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Advertisment advertisment = db.Advertisment.Find(id);

            if (advertisment == null)
            {
                return(HttpNotFound());
            }
            return(View(advertisment));
        }
예제 #24
0
        public void Handle(Create command)
        {
            if (advertisementsRepository.Exists(command.Id))
            {
                throw new InvalidOperationException($"قبلا آگهی با شناسه {command.Id} ثبت شده است.");
            }
            var advertisement = new Advertisment(command.Id
                                                 , new UserId(command.OwnerId));

            advertisementsRepository.Add(advertisement);
            unitOfWork.Commit();
            //  var events = advertisement.GetEvents();
            //eventSource.Save("Advertisement", command.Id.ToString(), events);
        }
예제 #25
0
        //GetListItem
        //ModifyItem
        public void ModifyItem(ClientContext context, string listTitle, Advertisment formData)
        {
            List     list    = context.Web.Lists.GetByTitle(listTitle);
            ListItem newItem = list.GetItemById(formData.ID);

            newItem["Title"]      = formData.ProductTitle;
            newItem["ubza"]       = formData.Description;
            newItem["Pris"]       = formData.Price;
            newItem["Bild"]       = formData.ImageUrl;
            newItem["Kategorier"] = formData.Category;

            newItem.Update();
            context.ExecuteQuery();
        }
        public void InsertObject(BarterViewModel barterData)
        {
            var barter = new Advertisment();

            barter.CategoryId = barterData.CategoryId;
            barter.Content    = barterData.Content;
            barter.Title      = barterData.Title;
            barter.Status     = barterData.Status;
            //TODO: handle unreliable user input
            barter.User = data.Users.All()
                          .FirstOrDefault(x => x.UserName == barterData.UserName);
            data.Advertisments.Add(barter);
            data.SaveChanges();
        }
예제 #27
0
        public void Handle(Create command)
        {
            if (advertisementsRepository.Exists(command.Id))
            {
                throw new InvalidOperationException($"قبلا آگهی با شناسه {command.Id} ثبت شده است.");
            }

            var advertisement = new Advertisment(command.Id,
                                                 new UserId(command.OwnerId)
                                                 );

            advertisementsRepository.Add(advertisement);
            unitOfWork.Commit();
        }
예제 #28
0
        /// <summary>
        /// Updates and existing advertisment
        /// </summary>
        /// <param name="saveModel">The save model <seealso cref="AdvertismentSaveModel"/></param>
        public void UpdateAdvertisment(AdvertismentSaveModel saveModel)
        {
            try
            {
                ArgumentsValidator.Validate(nameof(saveModel), saveModel);
                ArgumentsValidator.Validate(nameof(saveModel.AdvertismentName), saveModel.AdvertismentName);

                string requesterId = _userService.GetUserIdForUserNameAsync(saveModel.UserName).Result;

                ArgumentsValidator.Validate(nameof(requesterId), requesterId);

                /**
                 * Check for existing advert name for user requesting operation
                 */

                Advertisment existingAdvertisement = _adverismentRepository.GetAdvertismentByUserAndId(requesterId, saveModel.AdvertismentId.Value);

                if (existingAdvertisement == null)
                {
                    throw new Exception("No advertisement found");
                }

                existingAdvertisement.AdvertismentId          = existingAdvertisement.AdvertismentId;
                existingAdvertisement.AdvertismentName        = saveModel.AdvertismentName;
                existingAdvertisement.AdvertismentDescription = saveModel.Description;
                existingAdvertisement.InitialPrice            = saveModel.InitialPrice;
                existingAdvertisement.IsAuction       = saveModel.IsAuction;
                existingAdvertisement.IsBuyNow        = saveModel.IsBuyNow;
                existingAdvertisement.IsPromoted      = saveModel.IsPromoted;
                existingAdvertisement.BuyNowPrice     = saveModel.BuyNowPrice;
                existingAdvertisement.CurrentPrice    = saveModel.CurrentPrice;
                existingAdvertisement.CreatedDateTime = saveModel.CreatedDateTime;
                existingAdvertisement.CategoryId      = saveModel.CategoryId;
                existingAdvertisement.Status          = saveModel.Status;
                existingAdvertisement.UserId          = requesterId;

                _adverismentRepository.UpdateAdvertisment(existingAdvertisement);
            }
            catch (DbUpdateException ex)
            {
                Log.Warning(ex, AdvertismentConstants.CANNOT_UPDATE_ADVERT);
                throw;
            }
            catch (Exception ex)
            {
                Log.Error(ex, ex.Message);
                throw;
            }
        }
예제 #29
0
 //UpdateItemInSharePoint---
 public ActionResult UpdateItemInSharePoint(Advertisment formData)
 {
     using (var context = MySession.Current.spcontext.CreateUserClientContextForSPHost())
     {
         if (ModelState.IsValid && context != null)
         {
             _BuyAndSellRepository.ModifyItem(context, _BuyAndSellRepository.ANNONSLISTA, formData);
         }
         else
         {
             return(RedirectToAction("Edit"));
         }
     }
     return(RedirectToAction("MainView"));
 }
예제 #30
0
        //Edit---
        public ActionResult Edit(int?id)
        {
            Advertisment ViewModel = new Advertisment();

            using (var context = MySession.Current.spcontext.CreateUserClientContextForSPHost())
            {
                if (context != null)
                {
                    ViewModel = _BuyAndSellRepository.GetListItem(context, _BuyAndSellRepository.ANNONSLISTA, Convert.ToInt32(id));

                    ViewBag.category = _BuyAndSellRepository.GetTaxanomy(context);
                }
            }
            return(View(ViewModel));
        }
예제 #31
0
    void Awake()
    {
        refurbishmentTab = controller.transform.FindChild ("RefurbishmentCTR").gameObject.GetComponent<Refurbishment>();
        staffMenu = GameObject.FindGameObjectWithTag ("StaffingController").GetComponent<StaffMenu> ();
        bankingTab = controller.transform.FindChild ("BankingController").gameObject.GetComponent<BankingReport>();
        emsTab = controller.transform.FindChild("EMSController").gameObject.GetComponent<EMSReport>();
        revenueManagementTab = controller.transform.FindChild("RevenueManagerCTR").GetComponent<RevenueManagement>();
        randomEvent = controller.transform.FindChild("EventController").GetComponent<RandomEvent>();
        rateSetup = controller.transform.FindChild("RatesSetUp").GetComponent<RatesSetup>();
        groupController = controller.transform.FindChild("GroupBooking").GetComponent<GroupBookController>();
        calendarController = controller.transform.FindChild("CalendarController").GetComponent<CalendarController>();
        feedbackController = controller.transform.FindChild("FeedBackController").GetComponent<FeedbackController>();
        dataProcessor = GameObject.Find("DataCollection").GetComponent<Serializer_Deserializer>();
        assetSwapper = controller.transform.FindChild("AssetController").GetComponent<AssetSwapper>();
        toolbar = GameObject.FindGameObjectWithTag("UI").transform.FindChild("OverWorld").GetComponent<ToolbarOptions>();
        adController = controller.transform.FindChild("AdvertController").gameObject.GetComponent<Advertisment>();

        SingletonCheck();
        if(monthlyReports == null){
            monthlyReports = new List<MonthlyReport>();//create list on first run.
        }
        //Ensure there's a log for this week (special case for 1st time run)
        if (receptionLogs == null) {
            receptionLogs = new List<ReceptionLog> ();
        }
        if(restaurantBooks == null){
            restaurantBooks = new List<RestaurantBook>();//create a new list on first run.
        }
        //Ensure there's a log for this week (special case for 1st time run)
        if (staffingLogs == null) {
            staffingLogs = new List<StaffingLog> ();
        }
        //create the log once.
        if(balanceSheets == null){
            balanceSheets = new List<BalanceSheet>();//create new balance sheet list on first run.
        }
        GenerateNewMonthReports ();
        firstGeneration = true;

        medianRoomCostWD = rateSetup.medianRoomCostWD;
        medianRoomCostWE = rateSetup.medianRoomCostWE;
    }