/// <summary>
 /// classın constructor methodu.
 /// </summary>
 /// <param name="musicCD"></param> verilerin tutulduğu class
 public MusicCDDetailsForm(MusicCD musicCD)
 {
     this.musicCD = musicCD;
     InitializeComponent();
     this.Text           = musicCD.name;
     pcbPicture.Image    = musicCD.image;
     pcbPicture.SizeMode = PictureBoxSizeMode.StretchImage;
     lblName.Text        = musicCD.name;
     lblSinger.Text      = musicCD.Singer;
     lblCategory.Text    = "Category:" + musicCD.Category;
     if (musicCD.Sale > 0 && musicCD.Sale < 100)
     {
         lblBDiscounte.Text = musicCD.price + " TL  %" + musicCD.Sale;
     }
     else
     {
         lblBDiscounte.Text = "";
     }
     lblADiscounte.Text = (musicCD.price - musicCD.price * (musicCD.Sale / 100)) + " TL";
     string[] descriptionText = musicCD.Description.Split('$');
     lblSongList.Text = "";
     for (int i = 0; i < descriptionText.Length; i++)
     {
         lblSongList.Text += descriptionText[i] + Environment.NewLine;
     }
     nupQuantity.Text = "01";
     pcbPicture.BackgroundImageLayout = ImageLayout.Zoom;
 }
Exemple #2
0
        public List <Product> MusicCDLoader() ///albumlerin listesi, yuklemesi yapilir
        {
            List <Product> musiclist = new List <Product>();

            db.connection.Open();
            SqlCommand    command = new SqlCommand("SELECT * FROM [dbo].[MUSICCD]", connection);
            SqlDataReader reader  = command.ExecuteReader();
            MusicCD       mc;

            while (reader.Read())
            {
                mc             = new MusicCD();
                mc.ProductID   = (int)reader["ID"];
                mc.name        = (string)reader["NAME"];
                mc.price       = Convert.ToDouble(reader["PRICE"]);
                mc.Singer      = (string)reader["SINGER"];
                mc.Category    = (string)reader["TYPE"];
                mc.Description = (string)reader["DESCRIPTION"];
                mc.Sale        = Convert.ToDouble(reader["SALE"]);



                if (mc.Sale <= 0 || mc.Sale >= 100)
                {
                    mc.discountedPrice = mc.price;
                }
                else
                {
                    mc.discountedPrice = mc.price - (mc.price * mc.Sale) / 100;
                }


                try
                {
                    mc.image = Image.FromFile(Application.StartupPath + @"\Resources\MusicCdPictures\" + (string)reader["IMAGEDEST"] + ".png");
                }
                catch (Exception)
                {
                    mc.image = Properties.Resources.dasdas;
                }
                musiclist.Add(mc);
            }
            db.connection.Close();
            return(musiclist);
        }
Exemple #3
0
        /// <summary>
        /// panelin içerdiği componentlerin oluşturulduğu constructor.
        /// </summary>
        /// <param name="item"></param>
        public MusicCDPanel(MusicCD item)
        {
            musicCD          = item;
            this.BackColor   = Color.Transparent;
            this.Size        = new Size(350, 190);
            this.BorderStyle = BorderStyle.FixedSingle;


            picBox                       = new PictureBox();
            picBox.Size                  = new Size(105, 160);
            picBox.BackgroundImage       = item.image;
            picBox.BackgroundImageLayout = ImageLayout.Zoom;


            magnifier                       = new PictureBox();
            magnifier.Size                  = new Size(32, 32);
            magnifier.BackgroundImage       = Properties.Resources.magnifier;
            magnifier.BackgroundImageLayout = ImageLayout.Zoom;
            magnifier.Cursor                = Cursors.Hand;
            magnifier.Click                += new EventHandler(panelClick);

            name           = new Label();
            name.AutoSize  = true;
            name.Text      = item.name;
            name.TextAlign = ContentAlignment.MiddleLeft;
            name.Font      = new Font("Century Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
            this.Controls.Add(name);

            Singer          = new Label();
            Singer.AutoSize = true;
            Singer.Text     = item.Singer;
            Singer.Font     = new Font("Century Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
            this.Controls.Add(Singer);

            Type           = new Label();
            Type.AutoSize  = true;
            Type.Text      = item.Category;
            Type.Font      = new Font("Century Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
            Type.ForeColor = Color.Black;
            this.Controls.Add(Type);

            Price1          = new Label();
            Price1.AutoSize = true;
            if (item.Sale > 0 && item.Sale < 100)
            {
                Price1.Text = item.price + "TL  %" + item.Sale;
            }
            else
            {
                Price1.Text = "";
            }
            Price1.Font      = new Font("Century Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
            Price1.ForeColor = Color.Black;
            this.Controls.Add(Price1);

            Price2          = new Label();
            Price2.AutoSize = true;
            Price2.Text     = item.discountedPrice + " TL";
            Price2.Font     = new Font("Century Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
            this.Controls.Add(Price2);



            picAdd                       = new PictureBox();
            picAdd.Size                  = new Size(32, 32);
            picAdd.BackgroundImage       = Properties.Resources.cart;
            picAdd.BackgroundImageLayout = ImageLayout.Zoom;
            picAdd.Cursor                = Cursors.Hand;
            picAdd.Click                += new EventHandler(addCart);

            this.Controls[0].Location = new Point(125, 20);  // Name label
            this.Controls[0].BringToFront();
            this.Controls[1].Location = new Point(125, 50);  // Singer label
            this.Controls[1].BringToFront();
            this.Controls[2].Location = new Point(125, 80);  // Type label
            this.Controls[2].BringToFront();
            this.Controls[3].Location = new Point(125, 110); //  Price1 label
            this.Controls[3].BringToFront();
            this.Controls[4].Location = new Point(210, 110); // Price2 label
            this.Controls[4].BringToFront();
            this.Controls.Add(picBox);
            this.Controls[5].Location = new Point(10, 15);   //Picturebox
            this.Controls.Add(magnifier);
            this.Controls[6].Location = new Point(175, 140); //Magnifier image
            this.Controls.Add(picAdd);
            this.Controls[7].Location = new Point(225, 140); //Add to cart image
        }