private void InvoiceForm_Load(object sender, EventArgs e)
 {
     using (var bitmap = new Bitmap(this.ClientSize.Width, this.ClientSize.Height))
     {
         Customer cust = Customer.getInstance();
         this.pnlInvoice.DrawToBitmap(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height));
         System.IO.Directory.CreateDirectory(Application.StartupPath + @"\Resources\Invoices\");
         bitmap.Save(Application.StartupPath + @"\Resources\Invoices\" + cust.Username + cust.PurchCount + ".png");
         cust.PurchCount++;
         DataBaseHandler dh = DataBaseHandler.getInstance();
         dh.CustomerUpdate(cust);
     }
 }
示例#2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Logger.logger("Profile Form Update");
            DataBaseHandler dh = DataBaseHandler.getInstance();

            cstmr.Name     = txtName.Text;
            cstmr.Adress   = txtAddress.Text;
            cstmr.Email    = txtEmail.Text;
            cstmr.Password = txtPassword.Text;
            dh.CustomerUpdate(cstmr);
            MessageBox.Show("Your profile has been updated successfully.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }
示例#3
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            panelCreator = new FactoryPanelCreator();
            DataBaseHandler dh = DataBaseHandler.getInstance();

            productList = new ArrayList();
            booklist    = dh.BookLoader();
            CurrentProductList.AddRange(booklist);
            musiclist    = dh.MusicCDLoader();
            magazinelist = dh.MagazineLoader();
            productList.Add(booklist);
            productList.Add(magazinelist);
            productList.Add(musiclist);
            cbProduct.SelectedIndex    = 0;
            worker.DoWork             += new DoWorkEventHandler(Worker_DoWork);
            worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Worker_RunWorkerCompleted);
            worker.ProgressChanged    += Worker_ProgressChanged;
        }
示例#4
0
        private void btnRoot_Click(object sender, EventArgs e)
        {
            Logger.logger(" Main Form Root");
            DataBaseHandler dh   = DataBaseHandler.getInstance();
            RootForm        root = new RootForm();

            root.ShowDialog();
            booklist.Clear();
            musiclist.Clear();
            magazinelist.Clear();
            CurrentProductList.Clear();
            booklist = dh.BookLoader();
            CurrentProductList.AddRange(booklist);

            musiclist    = dh.MusicCDLoader();
            magazinelist = dh.MagazineLoader();
            productList.Clear();
            productList.Add(booklist);
            productList.Add(magazinelist);
            productList.Add(musiclist);

            btnRoot.Visible = Isroot;
            cbProduct_SelectedIndexChanged(cbProduct, null);
        }
示例#5
0
        private void pbLogin_Click(object sender, EventArgs e)
        {
            DataBaseHandler dh       = DataBaseHandler.getInstance();
            Customer        logined  = Customer.getInstance();
            Customer        customer = dh.CustomerHandler(txtUsername.Text, txtPassword.Text);

            if (customer != null)
            {
                this.Hide();
                logined = customer;
                Logger.logger("Login");
                MainForm mainform = new MainForm();
                mainform.ShowDialog();
                mainform = null;
                GC.Collect();
                txtUsername.Clear();
                txtPassword.Clear();
                this.Show();
            }
            else
            {
                MessageBox.Show("Wrong Username or Password.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }