Esempio n. 1
0
        protected void Create_Click(object sender, EventArgs e)
        {
            if (ModelState.IsValid)
            {
                var catalogItem = new CatalogItem()
                {
                    Name                  = Name.Text,
                    Description           = Description.Text,
                    CatalogManufacturerId = int.Parse(Manufacturer.SelectedValue),
                    CatalogTypeId         = int.Parse(Type.SelectedValue),
                    Price                 = decimal.Parse(Price.Text),
                    AvailableStock        = int.Parse(Stock.Text)
                };
                var itemSpecs = new CatalogItemSpecs()
                {
                    Polyphony    = Polyphony.Text,
                    Oscillators  = Oscillators.Text,
                    Lfo          = Lfo.Text,
                    Filter       = Filter.Text,
                    Effects      = Effects.Text,
                    Keyboard     = Keyboard.Text,
                    Memory       = Memory.Text,
                    DateProduced = int.Parse(DateProduced.Text)
                };

                var specId = CatalogService.CreateCatalogItemSpecs(itemSpecs);
                catalogItem.CatalogItemSpecsId = specId;
                CatalogService.CreateCatalogItem(catalogItem);
                Response.Redirect("~");
            }
        }
Esempio n. 2
0
        public int CreateCatalogItemSpecs(CatalogItemSpecs itemSpecs)
        {
            var maxId = catalogItemSpecs.Max(i => i.Id);

            itemSpecs.Id = ++maxId;
            catalogItemSpecs.Add(itemSpecs);
            return(maxId);
        }
Esempio n. 3
0
        public void UpdateCatalogItemSpecs(CatalogItemSpecs modifiedItem)
        {
            var originalItem = GetCatalogItemSpecs(modifiedItem.Id);

            if (originalItem != null)
            {
                catalogItemSpecs[catalogItemSpecs.IndexOf(originalItem)] = modifiedItem;
            }
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var productId = Convert.ToInt32(Page.RouteData.Values["id"]);

            _log.Info($"Now loading... /Catalog/Details.aspx?id={productId}");
            product   = CatalogService.FindCatalogItem(productId);
            itemSpecs = CatalogService.GetCatalogItemSpecs(product.Id);

            this.DataBind();
        }
Esempio n. 5
0
 protected void Save_Click(object sender, EventArgs e)
 {
     if (ModelState.IsValid)
     {
         var catalogItemSpecs = new CatalogItemSpecs()
         {
             Id           = Convert.ToInt32(Page.RouteData.Values["id"]),
             Polyphony    = Polyphony.Text,
             Oscillators  = Oscillators.Text,
             Lfo          = Lfo.Text,
             Effects      = Effects.Text,
             Keyboard     = Keyboard.Text,
             Memory       = Memory.Text,
             DateProduced = int.Parse(DateProduced.Text)
         };
         CatalogService.UpdateCatalogItemSpecs(catalogItemSpecs);
         Response.Redirect("~");
     }
 }
Esempio n. 6
0
 public void UpdateCatalogItemSpecs(CatalogItemSpecs catalogItemSpecs)
 {
     throw new NotImplementedException();
 }
Esempio n. 7
0
 public int CreateCatalogItemSpecs(CatalogItemSpecs itemSpecs)
 {
     throw new NotImplementedException();
 }