Exemplo n.º 1
0
        public MusicCD GetMusicCD(int id)
        {
            MusicCD       musicCD    = null;
            SqlConnection connection = new SqlConnection(ConnectionString);

            connection.Open();
            SqlCommand    command = new SqlCommand("select * from musicCD", connection);
            SqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                if (id == Convert.ToInt32(reader["id"]))
                {
                    MusicCDType type = MusicCD.getMusicCDType(reader["type"].ToString().Trim());
                    musicCD    = new MusicCD(reader["singer"].ToString().Trim(), type, reader["name"].ToString(), Convert.ToInt32(reader["id"]), Convert.ToDouble(reader["price"]), reader["demo"].ToString().Trim(), reader["picture"].ToString(), reader["issue"].ToString());
                    musicCD.Id = Convert.ToInt32(reader["id"]);
                    if (musicCD.Id > Product.Idcount)
                    {
                        Product.Idcount = musicCD.Id;
                    }
                }
            }
            connection.Close();
            return(musicCD);
        }
Exemplo n.º 2
0
        public void addNewMusicCD(String singer, MusicCDType type, String name, int id, double price, String picture, String issue)
        {
            MusicCD musicCD = (MusicCD)ProductFactory.CreateProduct(ProductNames.MusicCD, name, id, price, picture, issue);

            if (musicCD is MusicCD)
            {
                musicCD.Type   = type;
                musicCD.Singer = singer;
            }
            data.addmusicCD(musicCD);
        }
Exemplo n.º 3
0
        private void btnAddMusicCD_Click(object sender, EventArgs e)
        {
            ;
            MusicCDType type = MusicCD.getMusicCDType(cmbMusicType.SelectedItem.ToString());

            adminUser.addNewMusicCD(txtMusicSinger.Text, type, txtMusicName.Text, Product.Idcount, Convert.ToDouble(txtMusicPrice.Text.Trim()), txtMusicName.Text.Trim() + ".jpg", txtMusicIssue.Text);
            DataTable dataTable = new DataTable();

            DataTable             = data.datagrid(dataTable, "musicCD");
            dtgMusicCD.DataSource = DataTable;
        }
Exemplo n.º 4
0
        public MusicCD addNewMusicCD(String singer, MusicCDType type, String name, int id, double price)
        {
            MusicCD musicCD = (MusicCD)ProductFactory.CreateProduct(ProductName.MusicCD, name, id, price);

            if (musicCD is MusicCD)
            {
                musicCD.Type   = type;
                musicCD.Singer = singer;
            }
            return(musicCD);
        }
Exemplo n.º 5
0
 public MusicCD(String singer, MusicCDType type, String name, int id, double price) : base(name, id, price)
 {
     this.Singer = singer;
     this.Type   = type;
 }
Exemplo n.º 6
0
 public MusicCD(String singer, MusicCDType type, String name, int id, double price, String demo, String picture, String issue) : base(name, id, price, picture, issue)
 {
     this.Singer = singer;
     this.Type   = type;
     this.Demo   = demo;
 }