private void Button2_Click(object sender, EventArgs e) { BankDataEntities dbe = new BankDataEntities(); decimal b = Convert.ToDecimal(txtFromAN.Text); var item = (from u in dbe.user_Accounts where u.AccountNo == b select u).FirstOrDefault(); decimal b1 = Convert.ToDecimal(item.Balance); decimal totalbal = Convert.ToDecimal(txtCurrentAmount.Text);////////check check////// decimal transferacc = Convert.ToDecimal(txtDestAmt.Text); if (b1 > totalbal) { user_Accounts item2 = (from u in dbe.user_Accounts where u.AccountNo == transferacc select u).FirstOrDefault(); item2.Balance = item2.Balance + totalbal; item2.Balance = item2.Balance - totalbal; Transfer transfer = new Transfer(); transfer.AccountNo = Convert.ToInt32(txtFromAN.Text); transfer.ToTransfer = Convert.ToDecimal(txtDestAmt.Text); transfer.Date = DateTime.UtcNow.ToString(); transfer.Name = txtName.Text; transfer.Balance = Convert.ToDecimal(txtAmount.Text); dbe.Transfers.Add(transfer); dbe.SaveChanges(); MessageBox.Show("Transfer successful"); } }
private void Button1_Click(object sender, EventArgs e) { BankDataEntities dbe = new BankDataEntities(); decimal b = Convert.ToDecimal(txtFromAN.Text); var item = (from u in dbe.user_Accounts where u.AccountNo == b select u).FirstOrDefault(); txtName.Text = item.Name; txtAmount.Text = Convert.ToString(item.Balance); }
private void Button4_Click(object sender, EventArgs e) { bi.RemoveAt(dataGridView1.SelectedRows[0].Index); dbe = new BankDataEntities(); int acc = Convert.ToInt32(txtAccountNo.Text); user_Accounts a = dbe.user_Accounts.First(s => s.AccountNo.Equals(acc)); dbe.user_Accounts.Remove(a); dbe.SaveChanges(); }
private void BtnShow_Click(object sender, EventArgs e) { bl = new BindingList <FD>(); dbe = new BankDataEntities(); string date = dateTimePicker1.Value.ToString("MM/dd/yyyy"); MessageBox.Show(date); var item = dbe.FDs.Where(a => a.StartDate.Equals(date)); dataGridView1.DataSource = item.ToList(); }
private void bindgrid() { dataGridView1.AutoGenerateColumns = false; BankDataEntities bs = new BankDataEntities(); var item = bs.user_Accounts.ToList(); dataGridView1.DataSource = item; //throw new NotImplementedException(); }
private void Button2_Click(object sender, EventArgs e) { bi = new BindingList <user_Accounts>(); dbe = new BankDataEntities(); var item = dbe.user_Accounts.Where(a => a.Name == txtName.Text); foreach (var item1 in item) { bi.Add(item1); } dataGridView1.DataSource = bi; }
private void Button3_Click(object sender, EventArgs e) { dbe = new BankDataEntities(); decimal accno = Convert.ToInt32(txtAccountNo.Text); user_Accounts ua = new user_Accounts(); // user_Accounts a = dbe.user_Accounts.First(s => s.AccountNo.Equals(ua)); ua.AccountNo = Convert.ToInt32(txtAccountNo.Text); ua.Name = txtName.Text; ua.DOB = dateTimePicker1.ToString(); ua.Mother_name = txtMN.Text; ua.Father_name = txtFN.Text; ua.PhoneNo = txtPN.Text; if (btnRmale.Checked == true) { ua.Gender = "male"; } else { if (btnRFemale.Checked == true) { ua.Gender = "female"; } } if (btnRMarried.Checked == true) { ua.marital_status = "married"; } else { if (btnRUnMarried.Checked == true) { ua.marital_status = "Un-married"; } } //Image img = pictureBox1.Image; // if (img.RawFormat != null) ///if (ms != null) // { // img.Save(ms, img.RawFormat); // ua.Picture = ms.ToArray(); //} ua.Address = txtA.Text; ua.District = txtDistrict.Text; ua.State = txtState.Text; dbe.SaveChanges(); MessageBox.Show("Record Updated"); }
private void Button1_Click(object sender, EventArgs e) { bi = new BindingList <user_Accounts>(); dbe = new BankDataEntities(); int acc = Convert.ToInt32(txtAccountNo.Text); var item = dbe.user_Accounts.Where(a => a.AccountNo == acc); foreach (var item1 in item) { bi.Add(item1); } dataGridView1.DataSource = bi; }
private void Button2_Click(object sender, EventArgs e)//update { BankDataEntities context = new BankDataEntities(); decimal b = Convert.ToDecimal(txtAccountNo.Text); var item = (from u in context.user_Accounts where u.AccountNo == b select u).FirstOrDefault(); //txtName.Text = item.Name; //txtOB.Text = Convert.ToString(item.Balance); item.Balance = item.Balance + Convert.ToDecimal(txtDepositAmt.Text); // context.Deposits.Add() context.SaveChanges(); MessageBox.Show("Deposit Money Successfully"); }
private void Button1_Click(object sender, EventArgs e) //details { //hre we have EDMX file, model1.edmx BankDataEntities context = new BankDataEntities(); formNewAccount acc = new formNewAccount(); Deposit dp = new Deposit(); int b = Convert.ToInt32(txtAccountNo.Text); var item = (from u in context.user_Accounts where u.AccountNo == b select u).FirstOrDefault(); txtName.Text = item.Name.ToString(); txtOldBalance.Text = item.Balance.ToString(); dp.Date = lblDate.Text; dp.AccountNo = Convert.ToInt32(txtAccountNo.Text); dp.Name = txtName.Text; //dp.OldBalance = Convert.ToDecimal(txtOB.Text); // dp.Mode = comboBox1.SelectedItem.ToString(); ///dp.DipAmount = Convert.ToDecimal(txtDepositAmt.Text); context.Deposits.Add(dp); //context.SaveChanges(); //to check old balance //item.Balance = item.Balance + Convert.ToDecimal(txtDepositAmt.Text); }
private void BtnSave_Click(object sender, EventArgs e) { BankDataEntities dbe = new BankDataEntities(); formNewAccount nacc = new formNewAccount(); Debit wd = new Debit(); wd.Date = lblDate.Text; wd.AccountNo = Convert.ToInt32(txtAccountNo.Text); wd.Name = txtName.Text; wd.OldBalance = Convert.ToDecimal(txtOldBalance.Text); wd.Mode = comboBox1.SelectedItem.ToString(); wd.DebitAmount = Convert.ToDecimal(txtAmount.Text); dbe.Debits.Add(wd); dbe.SaveChanges(); decimal b = Convert.ToDecimal(txtAccountNo.Text); var item = (from u in dbe.user_Accounts where u.AccountNo == b select u).FirstOrDefault(); item.Balance = item.Balance - NewMethod(); dbe.SaveChanges(); MessageBox.Show("Debit Money"); }
private void DataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { dbe = new BankDataEntities(); int acc = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value); var item = dbe.user_Accounts.Where(a => a.AccountNo == acc).FirstOrDefault(); txtAccountNo.Text = item.AccountNo.ToString(); txtName.Text = item.Name; txtMN.Text = item.Mother_name; txtFN.Text = item.Father_name; txtPN.Text = item.PhoneNo; txtA.Text = item.Address; byte[] img = item.Picture; //MemoryStream ms = new MemoryStream(img); //pictureBox1.Image = Image.FromStream(ms); txtFN.Text = item.District; txtState.Text = item.State; if (item.Gender == "Male") { btnRmale.Checked = true; } else if (item.Gender == "Female") { btnRFemale.Checked = true; } else if (item.Gender == "Others") { btnROthers.Checked = true; } if (item.marital_status == "Married") { btnRMarried.Checked = true; } else if (item.marital_status == "UnMarried") { btnRUnMarried.Checked = true; } }