Example #1
0
 private void attach_accounts(account entity)
 {
     this.SendPropertyChanging();
     entity.customer = this;
 }
Example #2
0
 private void detach_accounts(account entity)
 {
     this.SendPropertyChanging();
     entity.customer = null;
 }
Example #3
0
 partial void Updateaccount(account instance);
Example #4
0
 partial void Deleteaccount(account instance);
Example #5
0
 partial void Insertaccount(account instance);
Example #6
0
 private void detach_accounts(account entity)
 {
     this.SendPropertyChanging();
     entity.branch = null;
 }
Example #7
0
 private void attach_accounts(account entity)
 {
     this.SendPropertyChanging();
     entity.branch = this;
 }
Example #8
0
        private void button5_Click(object sender, EventArgs e)
        {
            try
            {
                if (button5.Text == "Edit" && comboBox7.Text != "")
                {
                    AccountBalance = float.Parse(textBox2.Text);
                    Date           = dateTimePicker2.Value.ToString("yyyy/MM/dd");



                    DataClasses1DataContext dr = new DataClasses1DataContext();
                    account a = dr.accounts.Single(id => id.AccountNumber == AccountID);
                    a.AccountNumber   = AccountID;
                    a.CustomerID      = CID;
                    a.BranchID        = BID;
                    a.AccountBalance  = AccountBalance;
                    a.IntrestRate     = IntrestRate;
                    a.DateAccountOpen = Date;
                    a.AccountType     = AccountType;
                    dr.SubmitChanges();
                    MessageBox.Show("Data edited Succcessfully");

                    // TODO: This line of code loads data into the 'bank_SystemDataSet5.account' table. You can move, or remove it, as needed.
                    this.accountTableAdapter.Fill(this.bank_SystemDataSet5.account);

                    comboBox7.Items.Clear();

                    //Get all customer id to combobox3 to edit/delete branch
                    var items = from i in dr.GetTable <account>() select i;

                    foreach (var i in items)
                    {
                        comboBox7.Items.Add(i.AccountNumber.ToString());
                    }

                    comboBox6.Text        = "";
                    textBox2.Text         = "";
                    label44.Text          = "";
                    dateTimePicker2.Value = DateTime.Today;
                    comboBox7.Text        = "";
                    label32.Text          = "";
                    label34.Text          = "";
                    label36.Text          = "";
                    label38.Text          = "";
                    label40.Text          = "";

                    label47.Enabled         = false;
                    label44.Enabled         = false;
                    textBox2.Enabled        = false;
                    dateTimePicker2.Enabled = false;
                    button5.Enabled         = false;
                    button6.Enabled         = false;
                    comboBox7.Enabled       = false;
                }
                else if (button5.Text == "Delete" && comboBox7.Text != "")
                {
                    CID = comboBox3.Text;

                    DialogResult result = MessageBox.Show("Are You sure want to delete it ?", "Conformation", MessageBoxButtons.YesNoCancel);

                    if (result == DialogResult.Yes)
                    {
                        DataClasses1DataContext dr = new DataClasses1DataContext();
                        account a = dr.accounts.Single(id => id.AccountNumber == AccountID);
                        dr.accounts.DeleteOnSubmit(a);
                        dr.SubmitChanges();
                        MessageBox.Show("Data deleted Succcessfully");

                        // TODO: This line of code loads data into the 'bank_SystemDataSet5.account' table. You can move, or remove it, as needed.
                        this.accountTableAdapter.Fill(this.bank_SystemDataSet5.account);

                        constructors();

                        comboBox7.Items.Clear();

                        //Get all branch id to combobox2 to edit/delete branch
                        var items = from i in dr.GetTable <account>() select i;

                        foreach (var i in items)
                        {
                            comboBox7.Items.Add(i.AccountNumber.ToString());
                        }

                        comboBox6.Text        = "";
                        textBox2.Text         = "";
                        label44.Text          = "";
                        dateTimePicker2.Value = DateTime.Today;
                        comboBox7.Text        = "";
                        label32.Text          = "";
                        label34.Text          = "";
                        label36.Text          = "";
                        label38.Text          = "";
                        label40.Text          = "";

                        label47.Enabled         = false;
                        label44.Enabled         = false;
                        textBox2.Enabled        = false;
                        dateTimePicker2.Enabled = false;
                        button5.Enabled         = false;
                        button6.Enabled         = false;
                        comboBox7.Enabled       = false;
                    }
                }
                else
                {
                    MessageBox.Show("Select the Account Number");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Example #9
0
        private void button3_Click(object sender, EventArgs e)
        {
            AccountID = label16.Text;
            Date      = dateTimePicker1.Value.ToString("yyyy/MM/dd");
            try
            {
                AccountBalance = float.Parse(textBox1.Text);
            }
            catch (FormatException)
            {
                MessageBox.Show("Check your Account balance");
            }
            if (comboBox3.Text == "" || AccountID == "" || IntrestRate == "" || textBox1.Text == "" || Date == DateTime.Today.ToString("yyyy/MM/dd"))
            {
                MessageBox.Show("Check All Inputs");
            }

            else
            {
                try
                {
                    AccountID = label16.Text;
                    using (DataClasses1DataContext dr = new DataClasses1DataContext())
                    {
                        account a = new account();
                        a.AccountNumber   = AccountID;
                        a.AccountBalance  = AccountBalance;
                        a.AccountType     = AccountType;
                        a.DateAccountOpen = Date;
                        a.CustomerID      = CID;
                        a.BranchID        = BID;
                        a.IntrestRate     = IntrestRate;
                        dr.accounts.InsertOnSubmit(a);
                        dr.SubmitChanges();
                        MessageBox.Show("Data inserted Succcessfully");
                    }

                    getvalues();

                    comboBox1.Text = "";
                    comboBox2.Text = "";
                    comboBox3.Text = "";
                    label10.Text   = "";
                    label22.Text   = "";
                    label9.Text    = "";
                    label13.Text   = "";
                    label29.Text   = "";
                    label24.Text   = "";
                    label25.Text   = "";
                    label27.Text   = "";

                    label16.Text          = "";
                    comboBox3.Text        = "";
                    label19.Text          = "";
                    dateTimePicker1.Value = DateTime.Today;
                    textBox1.Text         = "";

                    label16.Enabled         = false;
                    comboBox3.Enabled       = false;
                    label19.Enabled         = false;
                    dateTimePicker1.Enabled = false;
                    textBox1.Enabled        = false;
                    button4.Enabled         = false;
                    button3.Enabled         = false;


                    // TODO: This line of code loads data into the 'bank_SystemDataSet5.account' table. You can move, or remove it, as needed.
                    this.accountTableAdapter.Fill(this.bank_SystemDataSet5.account);

                    //Get the Last account number

                    DataClasses1DataContext dr1 = new DataClasses1DataContext();
                    var acid = (from t in dr1.GetTable <account>() orderby t.AccountNumber descending select t.AccountNumber).First();

                    ID1          = ((int.Parse(acid.Substring(5, 8))) + 1).ToString();
                    label16.Text = ID1;

                    comboBox7.Items.Clear();

                    //Add the all customer ids to combobox2 to edit/delete the banch

                    DataClasses1DataContext dr2 = new DataClasses1DataContext();
                    var items = from i in dr2.GetTable <account>() select i;

                    foreach (var a in items)
                    {
                        comboBox7.Items.Add(a.AccountNumber.ToString());
                    }
                }
                catch (InvalidOperationException)
                {
                    label16.Text = "-11111111-";
                    AccountID    = "-11111111-";
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }