Example #1
0
        private void FormTransfer_FormClosed(object sender, FormClosedEventArgs e)
        {
            FormClienti fClienti = new FormClienti(banca);

            fClienti.Show();
            this.Hide();
        }
Example #2
0
        private void FormAdaugareCont_FormClosed(object sender, FormClosedEventArgs e)
        {
            FormClienti fClienti = new FormClienti(banca);

            fClienti.Show();
            this.Hide();
        }
Example #3
0
        public void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            var         SelectedItem    = listView1.SelectedItems[0]; //obiectul selectat
            string      banca           = SelectedItem.Text;          // denumirea bancii selectate
            FormClienti formOpenClienti = new FormClienti(banca);

            formOpenClienti.Show();
            this.Hide();
        }
Example #4
0
        private void buttonTransfer_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(comboBoxTransferFrom.Text) || string.IsNullOrWhiteSpace(comboBoxTransferTo.Text))
            {
                DialogResult result = MessageBox.Show("Selectati conturile!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                if (result == DialogResult.OK)
                {
                    this.Show();
                }
            }
            else if (String.IsNullOrEmpty(textBoxSumaTransfer.Text) || String.IsNullOrWhiteSpace(textBoxSumaTransfer.Text))
            {
                DialogResult result = MessageBox.Show("Introduceti suma pe care doriti sa o transferati!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                if (result == DialogResult.OK)
                {
                    this.Show();
                }
            }
            else
            {
                double suma = Convert.ToDouble(textBoxSumaTransfer.Text);

                //update db cu sumele calculate dupa transfer
                foreach (DataRow dr in bazaDeDateDataSet.ContBancar)
                {
                    if (dr["Numar_Cont"].ToString().Contains("RON"))
                    {
                        if (dr["Numar_Cont"].Equals(comboBoxTransferFrom.Text))
                        {
                            dr["Suma"] = Convert.ToDouble(dr["suma"].ToString()) - suma;
                            contBancarTableAdapter.Update(dr);
                        }
                        if (dr["Numar_Cont"].Equals(comboBoxTransferTo.Text))
                        {
                            dr["Suma"] = Convert.ToDouble(dr["suma"].ToString()) + suma;
                            contBancarTableAdapter.Update(dr);
                        }
                    }
                }

                tableAdapterManager.UpdateAll(bazaDeDateDataSet);

                FormClienti fClienti = new FormClienti(banca);
                fClienti.Show();
                this.Hide();
            }
        }
Example #5
0
        private void buttonAdaugareCont_Click(object sender, EventArgs e)
        {
            int nrConturi = 0;

            nrConturi = MaxConturi(comboBoxClient.Text);
            if (String.IsNullOrEmpty(comboBoxClient.Text) || String.IsNullOrWhiteSpace(comboBoxClient.Text))
            {
                DialogResult result = MessageBox.Show("Selectati clientul!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                if (result == DialogResult.OK)
                {
                    this.Show();
                }
            }
            else if (String.IsNullOrEmpty(comboBoxtipCont.Text) || String.IsNullOrWhiteSpace(comboBoxtipCont.Text))
            {
                MessageBox.Show("Selectati tipul contului!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (nrConturi < 5)
            {
                double suma = 0;
                if (String.IsNullOrEmpty(textBoxSuma.Text) || String.IsNullOrWhiteSpace(textBoxSuma.Text))
                {
                    suma = 0;
                }
                else
                {
                    suma = Convert.ToDouble(textBoxSuma.Text);
                }
                string cont   = comboBoxtipCont.Text + Convert.ToString(nrCont);
                string client = comboBoxClient.Text;

                contBancarTableAdapter.Insert(cont, suma, GetIdClient(client));
                tableAdapterManager.UpdateAll(bazaDeDateDataSet);
                contBancarTableAdapter.Fill(bazaDeDateDataSet.ContBancar);

                FormClienti fClienti = new FormClienti(banca);
                fClienti.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Clientul are deja 5 conturi.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                FormClienti fClienti = new FormClienti(banca);
                fClienti.Show();
                this.Hide();
            }
        }
        private void buttonAdaugaClient_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(textBoxNume.Text) || String.IsNullOrWhiteSpace(textBoxNume.Text))
            {
                DialogResult result = MessageBox.Show("Introduceti numele clientului!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                if (result == DialogResult.OK)
                {
                    this.Show();
                }
            }
            else if (String.IsNullOrEmpty(textBoxCnp.Text) || String.IsNullOrWhiteSpace(textBoxCnp.Text) || ValidareCNP(textBoxCnp.Text) == false)
            {
                DialogResult result = MessageBox.Show("CNP-ul clientului nu este valid!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                if (result == DialogResult.OK)
                {
                    this.Show();
                }
            }
            else if (String.IsNullOrEmpty(textBoxAdresa.Text) || String.IsNullOrWhiteSpace(textBoxAdresa.Text))
            {
                DialogResult result = MessageBox.Show("Introduceti adresa clientului!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                if (result == DialogResult.OK)
                {
                    this.Show();
                }
            }
            else if (String.IsNullOrEmpty(comboBoxTipCont.Text) || String.IsNullOrWhiteSpace(comboBoxTipCont.Text))
            {
                DialogResult result = MessageBox.Show("Selectati tipul contului!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                if (result == DialogResult.OK)
                {
                    this.Show();
                }
            }
            else
            {
                double suma = 0;
                if (String.IsNullOrEmpty(textBoxSuma.Text) || String.IsNullOrWhiteSpace(textBoxSuma.Text))
                {
                    suma = 0;
                }
                else
                {
                    suma = Convert.ToDouble(textBoxSuma.Text);;
                }

                string tipCont     = comboBoxTipCont.Text;
                string formareCont = tipCont.ToUpper() + contGenerat.ToString();

                int maxValue = (int)bazaDeDateDataSet.Client.Compute("MAX([Id_Client])", "");
                bazaDeDateDataSet.Client.AddClientRow(maxValue + 1, textBoxCnp.Text, textBoxNume.Text, textBoxAdresa.Text);//adaugare in tabelul client
                tableAdapterManager.UpdateAll(bazaDeDateDataSet);
                clientTableAdapter.Fill(bazaDeDateDataSet.Client);

                //adaugare legaturi in tabelele ContBancar si banca_client
                foreach (DataRow dr in bazaDeDateDataSet.Client)
                {
                    if (dr["cnp"].ToString() == textBoxCnp.Text)
                    {
                        contBancarTableAdapter1.Insert(formareCont, suma, Convert.ToInt16(dr["Id_client"]));
                        contBancarTableAdapter1.Fill(bazaDeDateDataSet.ContBancar);
                        banca_ClientTableAdapter1.Insert(banca, Convert.ToInt16(dr["Id_client"]));
                        banca_ClientTableAdapter1.Fill(bazaDeDateDataSet.Banca_Client);
                        tableAdapterManager.UpdateAll(bazaDeDateDataSet);
                    }
                }

                this.tableAdapterManager.UpdateAll(this.bazaDeDateDataSet);

                FormClienti formClient = new FormClienti(banca);
                formClient.Show();
                this.Hide();
            }
        }