Exemplo n.º 1
0
        public ItemCatalog.Items createNewItem(string id, string author, string title, string genre, double price, string publishdate, string filename)
        {
            ItemCatalog.Items       newitem = new ItemCatalog.Items(id, author, title, genre, price, publishdate);
            ItemCatalog.ItemCatalog catalog = new ItemCatalog.ItemCatalog();

            catalog = new ItemCatalog.ItemCatalog {
                items = client.getItems(filename)
            };
            client.createNewItem(filename, catalog, newitem);

            return(newitem);
        }
        public void booklistSelectionItem(string file, int index)
        {
            edit.Visibility = Visibility.Visible;

            if (index >= 0)
            {
                ItemCatalog.Items item = business.returnSelectedItem(file, index);
                author.Text      = item.author;
                title.Text       = item.title;
                genre.Text       = item.genre;
                price.Text       = item.price.ToString();
                publishdate.Text = item.publish_date;
                index            = -1;
            }
        }
        public void editButtonFunc(string filename, int index)
        {
            ItemCatalog.ItemCatalog catalog = business.returnCatalog(filename);
            ItemCatalog.Items       item    = business.returnItems(filename)[index];

            create.Visibility = Visibility.Hidden;
            if (edit.Content.Equals("Edit Book"))
            {
                edit.Content           = "Save Book";
                author.Text            = item.author;
                title.Text             = item.title;
                genre.Text             = item.genre;
                price.Text             = item.price.ToString();
                publishdate.Text       = item.publish_date;
                author.IsReadOnly      = false;
                title.IsReadOnly       = false;
                genre.IsReadOnly       = false;
                price.IsReadOnly       = false;
                publishdate.IsReadOnly = false;
            }

            else if (edit.Content.Equals("Save Book"))
            {
                create.Visibility = Visibility.Visible;
                if (author.Text.Length == 0 || title.Text.Length == 0 || genre.Text.Length == 0 || price.Text.Length == 0 || publishdate.Text.Length == 0)
                {
                    MessageBox.Show("Please fill in the gaps!");
                }
                else
                {
                    edit.Content      = "Edit Book";
                    item.author       = author.Text;
                    item.title        = title.Text;
                    item.genre        = genre.Text;
                    item.price        = double.Parse(price.Text);
                    item.publish_date = publishdate.Text;

                    business.editItem(filename, catalog, item, index);

                    author.IsReadOnly      = true;
                    title.IsReadOnly       = true;
                    genre.IsReadOnly       = true;
                    price.IsReadOnly       = true;
                    publishdate.IsReadOnly = true;
                }
            }
        }
Exemplo n.º 4
0
 public System.Threading.Tasks.Task createNewItemAsync(string xml, ItemCatalog.ItemCatalog catalog, ItemCatalog.Items newbook)
 {
     return(base.Channel.createNewItemAsync(xml, catalog, newbook));
 }
Exemplo n.º 5
0
 public void createNewItem(string xml, ItemCatalog.ItemCatalog catalog, ItemCatalog.Items newbook)
 {
     base.Channel.createNewItem(xml, catalog, newbook);
 }
Exemplo n.º 6
0
 public System.Threading.Tasks.Task editItemAsync(string xml, ItemCatalog.ItemCatalog catalog, ItemCatalog.Items book, int index)
 {
     return(base.Channel.editItemAsync(xml, catalog, book, index));
 }
Exemplo n.º 7
0
 public void editItem(string xml, ItemCatalog.ItemCatalog catalog, ItemCatalog.Items book, int index)
 {
     base.Channel.editItem(xml, catalog, book, index);
 }
Exemplo n.º 8
0
 public void editItem(string file, ItemCatalog.ItemCatalog catalog, ItemCatalog.Items item, int index)
 {
     client.editItem(file, catalog, item, index);
 }
Exemplo n.º 9
0
        public ItemCatalog.Items returnSelectedItem(string file, int index)
        {
            ItemCatalog.Items item = returnItems(file)[index];

            return(item);
        }