Exemplo n.º 1
0
 private void OverviewShowContent()
 {
     this.tabControl1.SelectedTab  = this.OverviewTab;
     this.FilterAllBtn.Checked     = true;
     this.FilterYearlyBtn.Checked  = false;
     this.FilterMonthlyBtn.Checked = false;
     this.FilterDailyBtn.Checked   = false;
     //INCOME_EXPENSE
     IncomeChartAllLoading();
     //CATEGOGY
     CategoryAllLoading();
     //TODAY TRANSACTION
     Connection.Connect();
     try
     {
         DateTime      today  = DateTime.Now;
         SqlDataReader reader = Connection.Select($"SELECT * FROM transactions JOIN categogies ON transactions.categogyName = categogies.categogyName WHERE username = '******' AND transactionTime = '{today.ToString("yyyy-MM-dd")}'");
         if (reader.HasRows)
         {
             this.TodayTransactionPanel.Controls.Clear();
         }
         while (reader.Read())
         {
             TransactionModel transactionModel = new TransactionModel();
             transactionModel.Username   = (string)reader["username"];
             transactionModel.WalletName = (string)reader["walletName"];
             transactionModel.Type       = (string)reader["transactionType"];
             transactionModel.Value      = (double)reader["transactionValue"];
             transactionModel.Note       = (string)reader["transactionNote"];
             OverviewWallet transaction = new OverviewWallet(transactionModel.Type, this.user);
             transaction.Value.Text     = String.Format("{0:n0}", transactionModel.Value);
             transaction.Wallet.Text    = transactionModel.WalletName;
             transaction.Categogy.Image = ImageProccess.ByteToImage((byte[])reader["categogyImage"]);
             transaction.MouseClick    += TransactionMenu_Click;
             this.TodayTransactionPanel.Controls.Add(transaction);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     Connection.Close();
 }
Exemplo n.º 2
0
        private void TransactionShowContent()
        {
            this.TransactionContainer.Controls.Clear();
            TransactionContainer.AutoScroll = false;
            TransactionContainer.HorizontalScroll.Enabled = false;
            TransactionContainer.HorizontalScroll.Visible = false;
            TransactionContainer.HorizontalScroll.Maximum = 0;
            TransactionContainer.AutoScroll = true;
            Connection.Connect();
            SqlDataReader reader = Connection.Select($"SELECT * FROM transactions JOIN categogies ON transactions.categogyName = categogies.categogyName WHERE username = '******' ORDER BY transactionTime DESC");

            try
            {
                while (reader.Read())
                {
                    TransactionModel transactionModel = new TransactionModel();
                    transactionModel.Username   = (string)reader["username"];
                    transactionModel.WalletName = (string)reader["walletName"];
                    transactionModel.Type       = (string)reader["transactionType"];
                    transactionModel.Value      = (double)reader["transactionValue"];
                    transactionModel.Note       = (string)reader["transactionNote"];
                    string date1 = reader.GetDateTime(7).ToString("yyyy-MM-dd");
                    transactionModel.Time = DateTime.Parse(date1);
                    Transaction transaction = new Transaction(transactionModel.Type, this.user);
                    transaction.Value.Text     = String.Format("{0:n0}", transactionModel.Value);
                    transaction.id             = (int)reader["id"];
                    transaction.Wallet.Text    = transactionModel.WalletName;
                    transaction.note           = (string)reader["transactionNote"];
                    transaction.Time.Text      = transactionModel.Time.ToString("dd-MM-yyyy");
                    transaction.Categogy.Image = ImageProccess.ByteToImage((byte[])reader["categogyImage"]);
                    transaction.MouseClick    += ModifyTransaction;
                    this.TransactionContainer.Controls.Add(transaction);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Connection.Close();
        }
Exemplo n.º 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Connection.Connect();
            SqlDataReader reader = Connection.Select("SELECT * FROM categogies");

            try
            {
                while (reader.Read())
                {
                    PictureBox pic = new PictureBox();
                    pic.Image       = ImageProccess.ByteToImage((byte[])reader["categogyImage"]);
                    pic.Name        = (string)reader["categogyName"];
                    pic.Cursor      = Cursors.Hand;
                    pic.MouseClick += new MouseEventHandler(GetName);
                    this.flowLayoutPanel1.Controls.Add(pic);
                }
                Connection.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemplo n.º 4
0
 private void SubmitBtn_Click(object sender, EventArgs e)
 {
     if (valid())
     {
         this.wallet       = new WalletModel(this.WalletName.Text, (double)this.Amount.Value, ImageProccess.ImageToByte(icon));
         this.DialogResult = DialogResult.OK;
     }
     else
     {
         this.DialogResult = DialogResult.None;
     }
 }