Exemplo n.º 1
0
        public Form2()
        {
            InitializeComponent();
            panelMainDashboard.BackColor    = System.Drawing.Color.FromArgb(100, 100, 40);
            panelMainPaySomething.BackColor = System.Drawing.Color.FromArgb(100, 100, 40);
            panelMainSendMail.BackColor     = System.Drawing.Color.FromArgb(100, 100, 40);
            panelMainSettings.BackColor     = System.Drawing.Color.FromArgb(100, 100, 40);
            panelMainTransfer.BackColor     = System.Drawing.Color.FromArgb(100, 100, 40);

            panelMainDashboard.Visible    = true;
            panelMainPaySomething.Visible = false;
            panelMainSendMail.Visible     = false;
            panelMainTransfer.Visible     = false;
            panelMainSettings.Visible     = false;

            pictureFailed.Visible = false;
            pictureValid.Visible  = false;
            lastMenupanel         = panelMainDashboard;

            UIDashboardAccountFrame.generateDashboard(ibanList, panelMainDashboard, exchangeTbl);
            labelLastName.Text = DataManagement.getLastName();
            using (var context = new MitBankDBEntities2())
            {
                var result2 = context.getLastLogin(DataManagement.getIdUsername());
                foreach (var item in result2)
                {
                    labelLastLogin.Text = item.ToString();
                }
            }
        }
Exemplo n.º 2
0
 private void label11_Click(object sender, EventArgs e)
 {
     using (var context = new MitBankDBEntities())
     {
         var result = context.insertLastLogin(DataManagement.getIdUsername(), DateTime.Now.ToString());
     }
     Application.Exit();
 }
Exemplo n.º 3
0
        public Form2()
        {
            InitializeComponent();
            panelMainDashboard.BackColor    = System.Drawing.Color.FromArgb(100, 100, 40);
            panelMainPaySomething.BackColor = System.Drawing.Color.FromArgb(100, 100, 40);
            panelMainSendMail.BackColor     = System.Drawing.Color.FromArgb(100, 100, 40);
            panelMainSettings.BackColor     = System.Drawing.Color.FromArgb(100, 100, 40);
            panelMainTransfer.BackColor     = System.Drawing.Color.FromArgb(100, 100, 40);

            panelMainDashboard.Visible    = true;
            panelMainPaySomething.Visible = false;
            panelMainSendMail.Visible     = false;
            panelMainTransfer.Visible     = false;
            panelMainSettings.Visible     = false;

            pictureFailed.Visible = false;
            pictureValid.Visible  = false;
            lastMenupanel         = panelMainDashboard;

            UIDashboardAccountFrame.generateDashboard(ibanList, panelMainDashboard, exchangeTbl);
            labelLastName.Text = DataManagement.getLastName();
            using (var context = new MitBankDBEntities())
            {
                var result2 = context.getLastLogin(DataManagement.getIdUsername());
                foreach (var item in result2)
                {
                    labelLastLogin.Text = item.ToString();
                }
            }

            labelChangeEmail.Visible   = false;
            textBoxChangeEmail.Visible = false;

            using (var context = new MitBankDBEntities())
            {
                var result = context.selectOnIndividuals(DataManagement.getIdUsername()).ToArray();

                foreach (var items in result)
                {
                    labelLastNameSettings.Text  = items.LastName;
                    labelFirstNameSettings.Text = items.FirstName;
                    labelEmailSettings.Text     = items.Email;
                    labelBirthdateSettings.Text = items.Birthday.ToShortDateString();

                    int idInd = items.ID;
                }
            }
        }
Exemplo n.º 4
0
        private void logoutButton_Click(object sender, EventArgs e)
        {
            var result = MessageBox.Show("Are you sure?", "Info",
                                         MessageBoxButtons.YesNo,
                                         MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                using (var context = new MitBankDBEntities())
                {
                    var result2 = context.insertLastLogin(DataManagement.getIdUsername(), DateTime.Now.ToString());
                }
                this.Hide();
                Form1 frm = new Form1();
                this.Refresh();
                this.Invalidate();
                frm.Refresh();
                frm.Invalidate();
                frm.Show();
            }
        }
Exemplo n.º 5
0
        private void buttonGenerateHistoryTranz_Click(object sender, EventArgs e)
        {
            char delim = ';';

            DataTable  tb    = new DataTable();
            DataColumn ordId = new DataColumn("IdTranzaction");

            ordId.DataType = typeof(int);
            tb.Columns.Add(ordId);

            DataColumn usAccount = new DataColumn("UserId");

            usAccount.DataType  = typeof(string);
            usAccount.MaxLength = 100;
            tb.Columns.Add(usAccount);

            DataColumn fAccount = new DataColumn("From Account");

            fAccount.DataType  = typeof(string);
            fAccount.MaxLength = 100;
            tb.Columns.Add(fAccount);

            DataColumn tAccount = new DataColumn("To Account");

            tAccount.DataType  = typeof(string);
            tAccount.MaxLength = 100;
            tb.Columns.Add(tAccount);


            DataColumn typeTranz = new DataColumn("Type Transaction");

            typeTranz.DataType  = typeof(string);
            typeTranz.MaxLength = 100;
            tb.Columns.Add(typeTranz);

            DataColumn val = new DataColumn("Value");

            val.DataType = typeof(float);
            tb.Columns.Add(val);

            DataColumn dateTrans = new DataColumn("Date");

            dateTrans.DataType = typeof(DateTime);
            tb.Columns.Add(dateTrans);

            DataColumn tipTranz = new DataColumn("Type Trnsaction");

            tipTranz.DataType = typeof(string);
            tb.Columns.Add(tipTranz);

            using (var context = new MitBankDBEntities())
            {
                var result = context.HistoryTransactionProc(DataManagement.getIdUsername()).ToArray();
                foreach (var items in result)
                {
                    if (items.TypeTransaction.Value == 4)
                    {
                        tb.Rows.Add(items.ID, items.UserAccountID, items.fromAccount, items.toWichAccount, items.TypeTransaction
                                    , items.Value, items.DateTransaction, "transfer");
                    }
                    else
                    {
                        if (items.TypeTransaction.Value == 3)
                        {
                            tb.Rows.Add(items.ID, items.UserAccountID, items.fromAccount, items.toWichAccount, items.TypeTransaction
                                        , items.Value, items.DateTransaction, "pay bill");
                        }
                    }
                }
                StringBuilder sb = new StringBuilder();
                foreach (DataRow row in tb.Rows)
                {
                    string[] fields = row.ItemArray.Select(field => field.ToString()).
                                      ToArray();
                    sb.AppendLine(string.Join(",", fields));
                }
                if (comboBoxTakeFormat.SelectedItem == "Excel Format")
                {
                    WriteToExcel(tb, "C:\\Users\\" + Environment.UserName + "\\Desktop\\History Transaction " + DataManagement.getLastName() + ".xlsx");
                    MessageBox.Show("It`s saved. Please see file on desktop!");
                }
                else
                if (comboBoxTakeFormat.SelectedItem == "CSV Format")
                {
                    File.WriteAllText("C:\\Users\\" + Environment.UserName + "\\Desktop\\History Transaction " + DataManagement.getLastName() + ".csv", sb.ToString());
                    MessageBox.Show("It`s saved. Please see file on desktop!");
                }
            }

            //order.Rows.Add("O9876", 10, 2001);
        }