private void Button1_Click(object sender, EventArgs e) { banking_dbEntities context = new banking_dbEntities(); newAccount acc = new newAccount(); Deposit dp = new Deposit(); dp.Date = date1b1.Text; dp.AccountNo = Convert.ToDecimal(acctxt.Text); dp.Name = nametxt.Text; dp.OldBalance = Convert.ToDecimal(oldbaltxt.Text); dp.Mode = ComboBox.SelectedItem.ToString(); dp.DipAmount = Convert.ToDecimal(amounttxt.Text); context.Deposit.Add(dp); decimal b = Convert.ToDecimal(acctxt.Text); var item = (from u in context.userAccount where u.Account_No == b select u).FirstOrDefault(); item.balance = item.balance + Convert.ToDecimal(amounttxt.Text); try { context.SaveChanges(); MessageBox.Show("Deposit Money Sucessfully"); } catch { // throw new NotImplementedException(); MessageBox.Show("Deposit Money Sucessfully"); } // MessageBox.Show("Deposit Money Sucessfully"); }
private void Button1_Click(object sender, EventArgs e) { banking_dbEntities dbe = new banking_dbEntities(); if (usrtxt.Text != string.Empty || passtxt.Text != string.Empty) { var user1 = dbe.Admin_Table.FirstOrDefault(a => a.UserName.Equals(usrtxt.Text)); //일치하는 항목을 찾을 때까지 집합열거시킨다. if (user1 != null) { if (user1.Password.Equals(passtxt.Text)) { Menu m1 = new Menu(); m1.ShowDialog(); } else { MessageBox.Show("password incorrect"); } } else { MessageBox.Show("Null Value"); } } else { MessageBox.Show("please enter username and password"); } }
private void Button1_Click(object sender, EventArgs e) { banking_dbEntities dbe = new banking_dbEntities(); decimal accno = Convert.ToDecimal(accnotxt.Text); var accounts = dbe.userAccount.Where(x => x.Account_No == accno).SingleOrDefault(); //SingleOrDefault()으로 시퀀스의 특정 단일 요소를 반환 합니다. FD fdform = new FD(); //FD fdform = new FD(); fdform.Account_No = Convert.ToDecimal(accnotxt.Text); fdform.Mode = comboBox1.SelectedItem.ToString(); fdform.Rupees = rupeestxt.Text; fdform.Period = Convert.ToInt32(periodtxt.Text); fdform.Interest_rate = Convert.ToDecimal(interesttxt.Text); fdform.Start_Date = DateTime.UtcNow.ToString("MM/dd/yyyy"); fdform.Maturity_Date = (DateTime.UtcNow.AddDays(Convert.ToInt32(periodtxt.Text))).ToString("MM/dd/yyyy"); fdform.Maturity_Amount = ((Convert.ToDecimal(rupeestxt.Text) * Convert.ToInt32(periodtxt.Text) * Convert.ToDecimal(interesttxt.Text)) / (100 * 12 * 30)) + (Convert.ToDecimal(rupeestxt.Text)); dbe.FD.Add(fdform); decimal amount = Convert.ToDecimal(rupeestxt.Text); decimal totalamount = Convert.ToDecimal(accounts.balance); decimal fdammount = totalamount - amount; accounts.balance = fdammount; try { dbe.SaveChanges(); MessageBox.Show("FD Started Now"); } catch { // throw new NotImplementedException(); MessageBox.Show("FD Started Now"); } }
private void Button2_Click(object sender, EventArgs e) { banking_dbEntities dbe = new banking_dbEntities(); newAccount nacc = new newAccount(); debit dp = new debit();//debit dp dp.Date = date1b1.Text; dp.Account = Convert.ToDecimal(acctxt.Text); dp.Name = nametxt.Text; dp.OldBalance = Convert.ToDecimal(oldbaltxt.Text); dp.Mode = comboBox1.SelectedItem.ToString(); dp.DebAmount = Convert.ToDecimal(DebAmount1.Text); dbe.debit.Add(dp); decimal b = Convert.ToDecimal(acctxt.Text); var item = (from u in dbe.userAccount where u.Account_No == b select u).FirstOrDefault(); item.balance = item.balance - Convert.ToDecimal(DebAmount1.Text); try { dbe.SaveChanges(); MessageBox.Show("Debit Money"); } catch { // throw new NotImplementedException(); MessageBox.Show("Debit Money"); } }
private void Button2_Click(object sender, EventArgs e) { banking_dbEntities dbe = new banking_dbEntities(); if (textBox1.Text != string.Empty || textBox3.Text != string.Empty || repass.Text != string.Empty) { userTable user1 = dbe.userTable.FirstOrDefault(a => a.UserName.Equals(usrtxt.Text)); try { MessageBox.Show("Password Change Successfully"); } catch { MessageBox.Show("Password Change Successfully"); } if (user1 != null) { if (user1.PassWord.Equals(textBox1.Text)) { user1.PassWord = textBox3.Text; dbe.SaveChanges(); MessageBox.Show("Password Change Successfully"); } else { MessageBox.Show("Password Incorrect"); } } } }
private void loadaccount() { BSE = new banking_dbEntities(); var item = BSE.userAccount.ToArray(); no = item.LastOrDefault().Account_No + 1; accnotext.Text = Convert.ToString(no); }
private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { dataGridView1.AutoGenerateColumns = false;//AutoGenerateColumns으로 열을 자동으로 만들지 여부를 나타내는 값을 가져오거나 설정 합니다. banking_dbEntities bs = new banking_dbEntities(); var item = bs.userAccount.ToList(); dataGridView1.DataSource = item; }
private void Button2_Click(object sender, EventArgs e) { banking_dbEntities context = new banking_dbEntities(); decimal b = Convert.ToDecimal(acctxt.Text); var item = (from u in context.userAccount where u.Account_No == b select u).FirstOrDefault();//FirstOrDefault으로 시퀀스의 첫 번째 요소를 반환 합니다. nametxt.Text = item.Name; oldbaltxt.Text = Convert.ToString(item.balance); }
private void Button1_Click(object sender, EventArgs e) { banking_dbEntities dbe = new banking_dbEntities(); decimal b = Convert.ToDecimal(fromacctxt.Text); var item = (from u in dbe.userAccount where u. Account_No == b select u).FirstOrDefault(); nametxt.Text = item.Name; amounttxt.Text = Convert.ToString(item.balance); }
private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { b1 = new BindingList <FDForm>(); dbe = new banking_dbEntities(); string date = dateTimePicker1.Value.ToString("MM/dd/yyyy"); MessageBox.Show(date); var item = dbe.FD.Where(a => a.Start_Date.Equals(date)); dataGridView1.DataSource = item.ToList();//커넥터가 바인딩된 데이터 소스를 가져오거나 설정합니다. }
private void Button4_Click(object sender, EventArgs e) { bi = new BindingList <userAccount>(); dbe = new banking_dbEntities(); var item = dbe.userAccount.Where(a => a.Name == nametxt.Text); foreach (var item1 in item) { bi.Add(item1); } dataGridView1.DataSource = bi; }
private void Button3_Click(object sender, EventArgs e) { bi = new BindingList <userAccount>(); dbe = new banking_dbEntities(); decimal accno = Convert.ToDecimal(acctxt.Text); var item = dbe.userAccount.Where(a => a.Account_No == accno); foreach (var item1 in item) { bi.Add(item1); } dataGridView1.DataSource = bi; }
private void Button2_Click(object sender, EventArgs e) { if (maleradio.Checked) { gender = "male"; } else if (femalereadio.Checked) { gender = "female"; } if (marriedradio.Checked) { m_status = "married"; } else if (unmarriedradio.Checked) { m_status = "Un-Married"; } BSE = new banking_dbEntities(); userAccount acc = new userAccount(); acc.Account_No = Convert.ToDecimal(accnotext.Text); acc.Name = nametxt.Text; acc.DOB = dateTimePicker1.Value.ToString(); acc.PhoneNo = phonetxt.Text; acc.Address = addtxt.Text; acc.District = disttxt.Text; acc.State = comboBox1.SelectedItem.ToString(); acc.Gender = gender; acc.maritial_status = m_status; acc.balance = Convert.ToDecimal(balancetxt.Text); acc.Date = date1b1.Text; acc.Picture = ms.ToArray(); // BSE = SaveChanges(); BSE.userAccount.Add(acc); // MessageBox.Show("file saved"); try { // BSE = SaveChanges(); MessageBox.Show("file saved"); } catch { MessageBox.Show("file saved"); } }
private void Button1_Click(object sender, EventArgs e) { banking_dbEntities dbe = new banking_dbEntities(); decimal b = Convert.ToDecimal(textBox1.Text); var item = (from u in dbe.debit where u.Account == b select u); DataGridView1.DataSource = item.ToList(); var item1 = (from u in dbe.Deposit where u.AccountNo == b select u); DataGridView2.DataSource = item1.ToList(); var item2 = (from u in dbe.Transfer where u.Account_No == b select u); DataGridView3.DataSource = item2.ToList(); }
private void DataGridView1_CellContentClick_1(object sender, DataGridViewCellEventArgs e) { dbe = new banking_dbEntities(); decimal accno = Convert.ToDecimal(dataGridView1.Rows[e.RowIndex].Cells[0].Value); var item = dbe.userAccount.Where(a => a.Account_No == accno).FirstOrDefault(); acctxt.Text = item.Account_No.ToString(); nametxt.Text = item.Name; phonetxt.Text = item.PhoneNo; addresstxt.Text = item.Address; byte[] img = item.Picture; MemoryStream mss = new MemoryStream(img); pictureBox1.Image = Image.FromStream(mss); disttxt.Text = item.District; comboBox1.Text = item.State; dataGridView1.ForeColor = Color.Black; this.dataGridView1.DefaultCellStyle.ForeColor = Color.White; this.dataGridView1.DefaultCellStyle.BackColor = Color.White; //다른 셀 스타일 속성이 설정되어 있지 않은 경우 DataGridView의 셀에 적용할 기본 셀 스타일을 가져오거나 설정합니다. //this.dataGridView1.DefaultCellStyle.Font = new Font("Tahoma", 15); //this.dataGridView1.DefaultCellStyle.ForeColor = Color.Black; if (item.Gender == "male") { maleradio.Checked = true; } else if (item.Gender == "female") { famaeradio.Checked = true; } if (item.maritial_status == "married") { maleradio.Checked = true; } else if (item.maritial_status == "unmarried") { unmarriedradio.Checked = true; } }
private void Button2_Click(object sender, EventArgs e) { try { bi.RemoveAt(dataGridView1.SelectedRows[0].Index); //RemoveAt으로 List<T>의 지정된 인덱스에 있는 요소를 제거합니다. dbe = new banking_dbEntities(); decimal a = Convert.ToDecimal(acctxt.Text); userAccount acc = dbe.userAccount.First(s => s.Account_No.Equals(a)); //db불러옴 dbe.userAccount.Remove(acc); //db 제거 해준다 dbe.SaveChanges(); //db 변경해준다 //MessageBox.Show("file saved"); // BSE = SaveChanges(); MessageBox.Show("file saved"); } catch { MessageBox.Show("file saved"); } }
private void Button2_Click(object sender, EventArgs e) { banking_dbEntities dbe = new banking_dbEntities(); decimal b = Convert.ToDecimal(fromacctxt.Text); var item = (from u in dbe.userAccount where u.Account_No == b select u).FirstOrDefault(); decimal b1 = Convert.ToDecimal(item.balance); decimal totalbal = Convert.ToDecimal(transfertxt.Text);//이체금액 decimal transferacc = Convert.ToDecimal(desaccounttxt.Text); if (b1 > totalbal) { userAccount item2 = (from u in dbe.userAccount where u.Account_No == transferacc select u).FirstOrDefault(); item2.balance = item2.balance + totalbal; item.balance = item.balance - totalbal; //dbe.SaveChanged(); Transfer transfer = new Transfer(); //Transfer transfer = new transfer.Account_No = Convert.ToDecimal(fromacctxt.Text); transfer.ToTransfer = Convert.ToDecimal(desaccounttxt.Text); //입금계좌번호 transfer.Date = DateTime.UtcNow.ToString(); transfer.Name = nametxt.Text; transfer.balance = Convert.ToDecimal(amounttxt.Text);//db에 있는잔액을 가져온다 dbe.Transfer.Add(transfer); dbe.SaveChanges(); try { dbe.SaveChanges(); MessageBox.Show("Transfer Money Successfully"); } catch { // throw new NotImplementedException(); MessageBox.Show("Transfer Money Successfully"); } } }