Exemplo n.º 1
0
        public ItemViewModel(MarketplaceItem anItemSelling)
        {
            ItemId = anItemSelling.Id;
            UniversityId = anItemSelling.UniversityId;
            Title = anItemSelling.Title;
            Description = anItemSelling.Description;
            Price = anItemSelling.Price.ToString();
            ImageUrl = PhotoHelper.ItemSellingPhoto(anItemSelling);

            TimeZone myLocalZone = TimeZone.CurrentTimeZone;
            DateTime myStartDateLocal = myLocalZone.ToLocalTime(anItemSelling.ExpireListing);

            ExpireListing = myStartDateLocal.ToString("MM-dd-yyyy");
        }
 public void UpdateItem(MarketplaceItem anItem)
 {
     theEntities.ApplyCurrentValues(anItem.EntityKey.EntitySetName, anItem);
     theEntities.SaveChanges();
 }
Exemplo n.º 3
0
 public static string ItemDetails(MarketplaceItem anItem)
 {
     return "/" + anItem.UniversityId + "/Marketplace/Details/" + anItem.Id;
 }
        private void UpdateItemPhoto(string anId, HttpPostedFileBase aTextBookImage, MarketplaceItem anItem)
        {
            string myImageName = string.Empty;

            try {
                myImageName = AWSPhotoHelper.TakeImageAndResizeAndUpload(aTextBookImage,
                        AWSHelper.GetClient(),
                        SiteConfiguration.MarketplacePhotosBucket(),
                        anId,
                        MarketplaceConstants.ITEM_MAX_SIZE);
            } catch (Exception myException) {
                throw new PhotoException("Error while resizing and uploading the photo. ", myException);
            }
            try {
                anItem.ImageName = myImageName;
                theMarketplaceRepository.UpdateItem(anItem);
            } catch (Exception myException) {
                AWSPhotoHelper.PhysicallyDeletePhoto(AWSHelper.GetClient(), SiteConfiguration.TextbookPhotosBucket(), myImageName);
                throw new CustomException("Error while updating the item to the new item photo.", myException);
            }
        }
 /// <summary>
 /// Create a new MarketplaceItem object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="universityId">Initial value of the UniversityId property.</param>
 /// <param name="userId">Initial value of the UserId property.</param>
 /// <param name="itemTypeId">Initial value of the ItemTypeId property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 /// <param name="price">Initial value of the Price property.</param>
 /// <param name="dateTimeStamp">Initial value of the DateTimeStamp property.</param>
 /// <param name="expireListing">Initial value of the ExpireListing property.</param>
 /// <param name="sold">Initial value of the Sold property.</param>
 /// <param name="deleted">Initial value of the Deleted property.</param>
 public static MarketplaceItem CreateMarketplaceItem(global::System.Int32 id, global::System.String universityId, global::System.Int32 userId, global::System.String itemTypeId, global::System.String title, global::System.String description, global::System.Double price, global::System.DateTime dateTimeStamp, global::System.DateTime expireListing, global::System.Boolean sold, global::System.Boolean deleted)
 {
     MarketplaceItem marketplaceItem = new MarketplaceItem();
     marketplaceItem.Id = id;
     marketplaceItem.UniversityId = universityId;
     marketplaceItem.UserId = userId;
     marketplaceItem.ItemTypeId = itemTypeId;
     marketplaceItem.Title = title;
     marketplaceItem.Description = description;
     marketplaceItem.Price = price;
     marketplaceItem.DateTimeStamp = dateTimeStamp;
     marketplaceItem.ExpireListing = expireListing;
     marketplaceItem.Sold = sold;
     marketplaceItem.Deleted = deleted;
     return marketplaceItem;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the MarketplaceItems EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMarketplaceItems(MarketplaceItem marketplaceItem)
 {
     base.AddObject("MarketplaceItems", marketplaceItem);
 }