/// <summary>
 /// creates new item if addNewProductFromDatabase == null else returns addNewProductFromDatabase
 /// </summary>
 /// <returns>addNewProductFromDatabase</returns>
 public static AddNewProductFromDatabase CreateAddNewProductFromDatabase()
 {
     if (addNewProductFromDatabase == null)
     {
         addNewProductFromDatabase = new AddNewProductFromDatabase();
     }
     return(addNewProductFromDatabase);
 }
        public MainFormPanelWithPicture(MainForm mainform)
        {
            this.mainform = mainform;
            InitializeComponent();
            addNewProductFromDatabase = AddNewProductFromDatabase.CreateAddNewProductFromDatabase();
            VeritabaniIslemleri database = VeritabaniIslemleri.bagOlustur("SatisVeritabani");
            int       i     = 0;
            string    query = "select * from UrunlerTablosu where productType = 1 and visibility= 1";
            DataTable table = database.veriCek(query);

            foreach (DataRow item in table.Rows)
            {
                Product     book = addNewProductFromDatabase.CreateNewItem(item);
                BookControl cont = new BookControl((Book)book, mainform.shoppingCard);
                flytbBook.Controls.Add(cont);
                i++;
                if (i == 6)
                {
                    break;
                }
            }
            pctrbxsitephoto.Image = new Bitmap("kitap" + (pictureindex % 3 + 1).ToString() + ".jpg");
            query = "select * from UrunlerTablosu where productType = 2 and visibility= 1";
            table = database.veriCek(query);
            i     = 0;
            foreach (DataRow item in table.Rows)
            {
                Product        music = addNewProductFromDatabase.CreateNewItem(item);
                MusicCdControl cont  = new MusicCdControl((MusicCD)music, mainform.shoppingCard);
                flytbMusic.Controls.Add(cont);
                i++;
                if (i == 6)
                {
                    break;
                }
            }
            query = "select * from UrunlerTablosu where productType = 3 and visibility= 1";
            table = database.veriCek(query);
            i     = 0;
            foreach (DataRow item in table.Rows)
            {
                Product         magazine = addNewProductFromDatabase.CreateNewItem(item);
                MagazineControl cont     = new MagazineControl((Magazine)magazine, mainform.shoppingCard);
                flytbMagazine.Controls.Add(cont);
                i++;
                if (i == 6)
                {
                    break;
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// the constructor of main form
        /// </summary>
        public MainForm()
        {
            InitializeComponent();
            addNewProductFromDatabase  = AddNewProductFromDatabase.CreateAddNewProductFromDatabase();
            bttnUserName.Text          = "Sign In";
            pnlUserNameClicked.Visible = false;
            mainFormPanelWithPicture   = new MainFormPanelWithPicture(this);
            pnlShow.Controls.Add(mainFormPanelWithPicture);
            tvFilter.Visible = false;

            CurrencyInfo currency = new CurrencyInfo("TRY");

            lbEUR.Text = "EUR : " + (1.0 / currency.getCurrency("EUR")).ToString("0.##") + "₺";
            lbUSD.Text = "USD : " + (1.0 / currency.getCurrency("USD")).ToString("0.##") + "₺";

            fillthethreeviever();
        }