Ejemplo n.º 1
0
        private static Label getPacketLabel(string iban)
        {
            Label date = new Label();

            date.Text = DataManagement.getIbanPacket(iban);

            switch (date.Text.Trim())
            {
            case "STUDENT PE+":
                date.Font      = new Font("Comic Sans MS", 12, FontStyle.Regular);
                date.ForeColor = Color.YellowGreen;
                break;

            case "GOLD PE+":
                date.Font      = new Font("Times New Roman", 12, FontStyle.Regular);
                date.ForeColor = Color.Yellow;
                break;

            default:
                date.Font = new Font("Century Ghotic", 10, FontStyle.Regular);
                break;
            }



            //position
            date.Top      = 30;
            date.Left     = 10;
            date.AutoSize = false;
            date.Size     = new Size(200, 50);

            return(date);
        }
Ejemplo n.º 2
0
        public static Label getExchangeTable()
        {
            Label lb = new Label();

            // text
            lb.ForeColor = Color.FromArgb(255, 255, 240);
            lb.Font      = new Font("Century Ghotic", 15, FontStyle.Bold);

            //position
            lb.Top       = 20;
            lb.Left      = 540;
            lb.AutoSize  = false;
            lb.Size      = new Size(170, 170);
            lb.BackColor = Color.FromArgb(30, 35, 35);

            List <string> list = DataManagement.getExchange().Split(' ').ToList();

            lb.Controls.Add(getLabelInTable(1, 2, "BUY"));
            lb.Controls.Add(getLabelInTable(1, 3, "SELL"));
            int top = 2, left = 1;

            foreach (string str in list)
            {
                lb.Controls.Add(getLabelInTable(top, left, str));
                left++;
                if (left > 3)
                {
                    left = 1;
                    top++;
                }
            }
            return(lb);
        }
Ejemplo 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 MitBankDBEntities2())
            {
                var result2 = context.getLastLogin(DataManagement.getIdUsername());
                foreach (var item in result2)
                {
                    labelLastLogin.Text = item.ToString();
                }
            }
        }
Ejemplo n.º 4
0
        private void loginButon_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.Reload();

            string pass = DataManagement.getPass(passwordLoginTxtbox.Text);

            if (DataManagement.tryConnection(usernameLoginTxtbox.Text, pass))
            {
                this.Visible = false;
                this.Hide();

                if (isAdmin)
                {
                    FormAdmin frm = new FormAdmin();
                    frm.Show();
                    isAdmin = false;
                }
                else
                {
                    Form2 frm = new Form2();
                    frm.Show();
                }
            }
            else
            {
                MessageBox.Show("Conexiunea nu se poate stabili!");
            }
        }
Ejemplo n.º 5
0
        private void comboBoxSelectTransfer_SelectedIndexChanged(object sender, EventArgs e)
        {
            comboBoxToTransferMyIBAN.Items.Clear();
            if (comboBoxSelectTransfer.Text.ToString() == "My another account")
            {
                label12.Visible                  = false;
                textBoxWriteIBAN.Visible         = false;
                comboBoxToTransferMyIBAN.Visible = true;

                List <Page> lp = new List <Page>();
                lp = DataManagement.getIbanList();

                foreach (var item in lp)
                {
                    int index = -1;
                    index = comboBoxToTransferMyIBAN.FindString(item.Data.ToString());

                    if (index == -1 && item.Data.ToString() != comboBoxIBAN.Text.ToString())
                    {
                        comboBoxToTransferMyIBAN.Items.Add(item.Data.ToString());
                    }
                }
            }
            else
            {
                label12.Visible = true;
                comboBoxToTransferMyIBAN.Visible = false;
                textBoxWriteIBAN.Visible         = true;
                labelcurrencyToIban.Text         = "-";
            }
        }
Ejemplo n.º 6
0
        private void bunifuFlatButton3_Click(object sender, EventArgs e)
        {
            lastMenupanel.Visible     = false;
            panelMainTransfer.Visible = true;
            lastMenupanel.SendToBack();
            lastMenupanel = panelMainTransfer;


            using (var context = new MitBankDBEntities2())
            {
                List <Page> listIban = new List <Page>();
                listIban = DataManagement.getIbanList();
                foreach (var item in listIban)
                {
                    int index = -1;
                    index = comboBoxIBAN.FindString(item.Data.ToString());

                    if (index == -1)
                    {
                        comboBoxIBAN.Items.Add(item.Data.ToString());
                    }
                }
                if (listIban.Count() != 0)
                {
                    comboBoxIBAN.SelectedIndex           = 0;
                    comboBoxSelectTransfer.SelectedIndex = 0;
                }
            }
        }
Ejemplo n.º 7
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();
 }
Ejemplo n.º 8
0
        private void buttonAddInd_Click(object sender, EventArgs e)
        {
            if (textPassword.Text != textPassword2.Text)
            {
                MessageBox.Show("parolele nu coincid!");
                return;
            }

            string username = this.textUsername.Text;
            string password = DataManagement.getPass(this.textPassword.Text);

            if (radioIndivid.Checked)
            {
                var individ = new Individual
                {
                    FirstName = this.textFirstName.Text,
                    LastName  = this.textLastName.Text,
                    Email     = this.textEmail.Text,
                    Birthday  = new DateTime(
                        Int32.Parse(this.comboYear.Text),
                        Int32.Parse(this.comboMonth.Text),
                        Int32.Parse(this.comboDay.Text)
                        ),
                    CNP = this.textCNP.Text,
                };


                DataManagement.addIndividualCustomer(individ, username, password);
            }
            else
            {
                var individ = new Individual
                {
                    FirstName = this.textFirstName.Text,
                    LastName  = this.textLastName.Text,
                    Email     = this.textEmail.Text,
                    Birthday  = new DateTime(
                        Int32.Parse(this.comboYear.Text),
                        Int32.Parse(this.comboMonth.Text),
                        Int32.Parse(this.comboDay.Text)
                        ),
                    CNP = this.textCNP.Text,
                };

                var company = new Company
                {
                    CIF     = Int32.Parse(this.textCif.Text),
                    Name    = this.textCompany.Text,
                    Address = this.textAddress.Text
                };
                DataManagement.addCompany(individ, company, username, password);
            }
        }
Ejemplo n.º 9
0
        private void comboBoxIBAN_SelectedIndexChanged(object sender, EventArgs e)
        {
            Page pg = DataManagement.getSold(comboBoxIBAN.SelectedItem.ToString());

            labelshowsold.Text = pg.Data;


            Page pg2 = DataManagement.getCurrency(comboBoxIBAN.SelectedItem.ToString());

            labelshowcurrency.Text = pg2.Data;

            comboBoxToTransferMyIBAN.Refresh();
            comboBoxSelectTransfer.SelectedIndex = -1;
        }
Ejemplo n.º 10
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;
                }
            }
        }
Ejemplo n.º 11
0
        private static Label getCurrencyLabel(string iban)
        {
            Label currency = new Label();

            currency.Text      = DataManagement.getIbanCurrency(iban);
            currency.ForeColor = Color.Yellow;
            currency.Font      = new Font("Century Ghotic", 25, FontStyle.Bold);

            //position
            currency.Top      = 40;
            currency.Left     = 400;
            currency.AutoSize = false;
            currency.Size     = new Size(200, 50);

            return(currency);
        }
Ejemplo n.º 12
0
        private static Label getSoldLabel(string iban)
        {
            Label sold = new Label();

            sold.Text      = DataManagement.getIbanSold(iban);
            sold.ForeColor = Color.FromArgb(255, 255, 240);
            sold.Font      = new Font("Century Ghotic", 18, FontStyle.Bold);
            sold.TextAlign = ContentAlignment.TopRight;

            //position
            sold.Top      = 47;
            sold.Left     = 250;
            sold.AutoSize = false;
            sold.Size     = new Size(150, 50);

            return(sold);
        }
Ejemplo n.º 13
0
        private static Label getDateLabel(string iban)
        {
            Label date = new Label();

            date.Text      = "Valid until ";
            date.Text     += DataManagement.getIbanDate(iban).Substring(0, 9);
            date.ForeColor = Color.FromArgb(255, 255, 240);
            date.Font      = new Font("Century Ghotic", 8, FontStyle.Italic);

            //position
            date.Top      = 70;
            date.Left     = 10;
            date.AutoSize = false;
            date.Size     = new Size(200, 50);

            return(date);
        }
Ejemplo n.º 14
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();
            }
        }
Ejemplo n.º 15
0
        public static void generateDashboard(List <Label> ibanList, Panel panelMainDashboard, Label exchangeTbl)
        {
            ibanList.Clear();
            int           i    = 0;
            List <string> list = DataManagement.getDashboardInfo();

            foreach (string iban in list)
            {
                var context = new MitBankDBEntities();

                Label lb = UIDashboardAccountFrame.createFrame(iban, i);
                i++;
                ibanList.Add(lb);
            }

            foreach (Label lb in ibanList)
            {
                panelMainDashboard.Controls.Add(lb);
                lb.BringToFront();
            }

            exchangeTbl = UIDashboardAccountFrame.getExchangeTable();
            panelMainDashboard.Controls.Add(exchangeTbl);
        }
Ejemplo n.º 16
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);
        }
Ejemplo n.º 17
0
        private void button1_Click(object sender, EventArgs e)
        {
            PdfDocument document = new PdfDocument();

            document.Info.Title = "Account request informations";

            // Create an empty page
            PdfPage page = document.AddPage();

            // Get an XGraphics object for drawing
            XGraphics gfx = XGraphics.FromPdfPage(page);

            // Create a font
            XFont font = new XFont("Verdana", 11, XFontStyle.Regular);

            // Draw the text
            string infoBank  = "MITBank Society, Military Technical Academy";
            string infoBank2 = "Sucursala Bucuresti, Sector 4";
            string text1     = "Extras de cont din " + DateTime.Now.ToString();
            string text2     = "      Conform dispozitiilor in vigoare, va instiintăm ca, in evidenţele";
            string text3     = "noastre contabile, la data de ............., unitatea dvs. figurează";
            string text4     = "cu următoarele conturi................................................";
            string text5     = "Conturi curente ";

            gfx.DrawString(infoBank, font, XBrushes.Black,
                           new XRect(10, 0, page.Width, page.Height),
                           XStringFormats.TopLeft);

            gfx.DrawString(infoBank2, font, XBrushes.Black,
                           new XRect(10, 12, page.Width, page.Height),
                           XStringFormats.TopLeft);

            gfx.DrawString(text1, font, XBrushes.Black,
                           new XRect(10, 32, page.Width, page.Height),
                           XStringFormats.TopCenter);

            gfx.DrawString(text2, font, XBrushes.Black,
                           new XRect(10, 60, page.Width, page.Height),
                           XStringFormats.TopLeft);

            gfx.DrawString(text3, font, XBrushes.Black,
                           new XRect(10, 72, page.Width, page.Height),
                           XStringFormats.TopLeft);

            gfx.DrawString(text4, font, XBrushes.Black,
                           new XRect(10, 84, page.Width, page.Height),
                           XStringFormats.TopLeft);
            gfx.DrawString(text5, font, XBrushes.Black,
                           new XRect(10, 100, page.Width, page.Height),
                           XStringFormats.TopCenter);



            List <string> lc = new List <string>();

            lc = DataManagement.getAllInfoAccunts();


            string text11 = "ID" + "       " + "IBAN" + "                                       "
                            + "Bank Packet" + "              " + "VALABILITY" + "              " + "SOLD" + "       " + "CURRENCY";

            gfx.DrawString(text11, font, XBrushes.Black,
                           new XRect(30, 130, page.Width, page.Height),
                           XStringFormats.TopLeft);

            int x = 160;

            foreach (string c in lc)
            {
                string text0 = c.ToString();

                gfx.DrawString(text0, font, XBrushes.Black,
                               new XRect(30, x, page.Width, page.Height),
                               XStringFormats.TopLeft);
                x += 20;
            }

            string text12 = "Pentru mai multe informatii, contactati-ne la 0722222222, director adjunct SSSSSSS  SSS";

            gfx.DrawString(text12, font, XBrushes.Black,
                           new XRect(30, 300, page.Width, page.Height),
                           XStringFormats.TopLeft);

            // Save the document...
            string filename = "Account request " + DataManagement.getLastName();

            document.Save(filename);
            // ...and start a viewer.
            Process.Start(filename);
        }
Ejemplo n.º 18
0
        private void buttonSubmitTransfer_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Are you sure?", "Warning", MessageBoxButtons.YesNo);

            try
            {
                if (dialogResult == DialogResult.Yes)
                {
                    double ValWithouComiss = 0;

                    ValWithouComiss = double.Parse(textoxValueToTransfer.Text);

                    double comiss = 0;

                    comiss = double.Parse(labelComisionValue.Text);

                    double valToTransfer = 1;
                    if (labelExchangeValue.Text != "-")
                    {
                        valToTransfer = double.Parse(labelExchangeValue.Text);
                    }

                    double getsold = 0;
                    if (labelComisionValue.Text != "-")
                    {
                        using (var context = new MitBankDBEntities())
                        {
                            var result = DataManagement.getSold(comboBoxIBAN.SelectedItem.ToString());

                            getsold = double.Parse(result.Data);
                        }
                        if (getsold > (ValWithouComiss + comiss))
                        {
                            using (var context = new MitBankDBEntities())
                            {
                                if (comboBoxSelectTransfer.SelectedItem.ToString() == "My another account")
                                {
                                    var result = context.transferMoney(comboBoxIBAN.SelectedItem.ToString(),
                                                                       comboBoxToTransferMyIBAN.SelectedItem.ToString(), ((ValWithouComiss + comiss)),
                                                                       valToTransfer);
                                    DataManagement.addOnHistory(comboBoxIBAN.SelectedItem.ToString(),
                                                                comboBoxToTransferMyIBAN.SelectedItem.ToString(), 4, (ValWithouComiss + comiss));
                                }
                                else if (comboBoxSelectTransfer.SelectedItem.ToString() == "Anyone else account")
                                {
                                    var result = context.transferMoney(comboBoxIBAN.SelectedItem.ToString(),
                                                                       textBoxWriteIBAN.Text, ((ValWithouComiss + comiss)),
                                                                       valToTransfer);

                                    DataManagement.addOnHistory(comboBoxIBAN.SelectedItem.ToString(),
                                                                textBoxWriteIBAN.Text, 4, (ValWithouComiss + comiss));
                                }
                                labelComisionValue.Text = "-";
                                labelExchangeValue.Text = "-";
                                MessageBox.Show("Done!");
                            }
                        }
                        else
                        {
                            MessageBox.Show("You dont have enought money!!!");
                        }
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Put all informations or something wrong!");
            }
        }
Ejemplo n.º 19
0
        private void textoxValueToTransfer_OnValueChanged(object sender, EventArgs e)
        {
            int parsedValue;

            if (!int.TryParse(textoxValueToTransfer.Text, out parsedValue))
            {
                if (textoxValueToTransfer.Text != "")
                {
                    MessageBox.Show("Ups! Only numbers");
                    textoxValueToTransfer.Text = "0";
                }
            }


            double Val = 0;

            if (labelshowcurrency.Text != labelcurrencyToIban.Text &&
                labelcurrencyToIban.Text != "-" && textoxValueToTransfer.Text != "")
            {
                if (labelshowcurrency.Text == "RON")
                {
                    double getToConvert = DataManagement.getCurrencyValueBuy(labelcurrencyToIban.Text);
                    Val = double.Parse(textoxValueToTransfer.Text);
                    double exch = Math.Round(Val / getToConvert, 4);
                    labelExchangeValue.Text = exch.ToString();

                    labelshowToCurrency.Text   = labelcurrencyToIban.Text;
                    labelshowFromCurrency.Text = labelshowcurrency.Text;
                }
                else if (labelcurrencyToIban.Text == "RON")
                {
                    double getToConvert = DataManagement.getCurrencyValueBuy(labelshowcurrency.Text);
                    Val = double.Parse(textoxValueToTransfer.Text);
                    labelExchangeValue.Text = (Val * getToConvert).ToString();

                    labelshowToCurrency.Text   = labelcurrencyToIban.Text;
                    labelshowFromCurrency.Text = labelshowcurrency.Text;
                }
                else if (labelcurrencyToIban.Text != "RON" && labelshowcurrency.Text != "RON")
                {
                    double getToConvertFrom = DataManagement.getCurrencyValueBuy(labelshowcurrency.Text);
                    double getToConvertTo   = DataManagement.getCurrencyValueBuy(labelcurrencyToIban.Text);

                    Val = double.Parse(textoxValueToTransfer.Text);
                    double exch = Math.Round(Val * getToConvertFrom / getToConvertTo, 2);
                    labelExchangeValue.Text = exch.ToString();

                    labelshowToCurrency.Text   = labelcurrencyToIban.Text;
                    labelshowFromCurrency.Text = labelshowcurrency.Text;
                }
            }

            string fromIBAN = comboBoxIBAN.Text;
            Page   pg       = new Page();

            ///////////////////make txt for numberrs


            if (pg.Data != "" && comboBoxIBAN.SelectedIndex != -1)
            {
                pg = DataManagement.getComision(fromIBAN.ToString());
            }



            if (textoxValueToTransfer.Text != "" && comboBoxIBAN.SelectedIndex != -1)
            {
                Val = double.Parse(textoxValueToTransfer.Text);

                double comVal = 0;

                comVal = double.Parse(pg.Data);

                labelComisionValue.Text = (Val * comVal / 100).ToString();
            }
            else
            {
                labelComisionValue.Text = "-";
            }
        }