public Payments(Employee emp) { this.connect = ConnectDatabase.getInstance(); this.employee = emp; InitializeComponent(); dt = new DataTable(); dt = connect.executeQuery("select * from customer"); int size = dt.Rows.Count; for (int i = 0; i < size; i++) { data = dt.Rows[i]; sendernames.Add(data["name"].ToString()); senderaccnum.Add(data["accountnumber"].ToString()); } combobox.ItemsSource = sendernames; types.Add("Electric Bill"); types.Add("Phone Bill"); types.Add("Voucher"); types.Add("E-Commerce"); types.Add("Credit Card"); types.Add("Tickets"); types.Add("Others"); typebox.ItemsSource = types; }
private void searchButton(object sender, RoutedEventArgs e) { listaccnumbers.Clear(); listbox.ItemsSource = ""; string accnum = accnumtxt.Text; dt = new DataTable(); dt = connect.executeQuery("select * from customer where accountnumber like '" + accnum + "%'"); if (dt.Rows.Count == 0) { listbox.Visibility = Visibility.Hidden; label.Content = "Invalid Account Number!"; return; } else { label.Content = ""; int size = dt.Rows.Count; for (int i = 0; i < size; i++) { data = dt.Rows[i]; listaccnumbers.Add(data["accountnumber"].ToString()); } listbox.ItemsSource = listaccnumbers; listbox.Visibility = Visibility.Visible; } }
private void Button_Click(object sender, RoutedEventArgs e) { if (virtualacctxt.Text == "") { MessageBox.Show("Account Number Must Be Filled!"); return; } if (customer.accountnumber == virtualacctxt.Text.ToString()) { MessageBox.Show("You cannot transfer to yourself!"); return; } DataTable dt = new DataTable(); dt = connect.executeQuery("select * from virtualaccount where virtualaccount = '" + virtualacctxt.Text + "' and status = 'Not Paid'"); DataRow data = dt.Rows[0]; if (dt.Rows.Count == 0) { MessageBox.Show("This Virtual Account Is Invalid / Has Expired!"); return; } label.Content = ""; Window a = new PinConfirmationATM(customer, virtualacctxt.Text.ToString(), Int32.Parse(data["amount"].ToString()), "virtualacc"); a.Show(); this.Close(); }
private void Button_Click(object sender, RoutedEventArgs e) { if (acctxt.Text == "") { label.Content = "Account Number must be filled!"; return; } if (pintxt.Password == "") { label.Content = "PIN must be filled!"; return; } string accnum = acctxt.Text; DataTable dt2 = new DataTable(); dt = new DataTable(); dt2 = new DataTable(); dt = connect.executeQuery("select * from customer where accountnumber = '" + accnum + "' and pin = '" + pintxt.Password.ToString() + "' limit 1"); dt2 = connect.executeQuery("select * from customer c join saving s on s.accountnumber = c.accountnumber where c.accountnumber = '" + accnum + "' and c.pin = '" + pintxt.Password.ToString() + "' limit 1"); int count = 0; if (dt.Rows.Count == 0) { count++; label.Content = "Invalid User!"; return; } else { DataRow data = dt.Rows[0]; label.Content = ""; Customer cust = new Customer(data["accountnumber"].ToString(), data["pin"].ToString(), data["name"].ToString(), data["identitycard"].ToString(), data["familycard"].ToString(), Int32.Parse(data["balance"].ToString()), data["type"].ToString()); Window atm = new ATMWindow(cust); atm.Show(); this.Close(); } }
public TransferMoney(Employee emp, Customer cust) { this.connect = ConnectDatabase.getInstance(); this.employee = emp; this.customer = cust; InitializeComponent(); dt = new DataTable(); dt = connect.executeQuery("select * from customer"); int size = dt.Rows.Count; for (int i = 0; i < size; i++) { data = dt.Rows[i]; sendernames.Add(data["name"].ToString()); senderaccnum.Add(data["accountnumber"].ToString()); } combobox.ItemsSource = sendernames; }
private void Button_Click(object sender, RoutedEventArgs e) { if (accnumtxt.Text == "") { MessageBox.Show("Account Number Must Be Filled!"); return; } if (amountxt.Text == "") { MessageBox.Show("Amount Must Be Filled!"); return; } DataTable dt = new DataTable(); dt = connect.executeQuery("select * from customer where accountnumber = '" + accnumtxt.Text.ToString() + "' limit 1"); if (dt.Rows.Count == 0) { label.Content = "Invalid Username/Password!"; return; } else { DataRow data = dt.Rows[0]; Customer rvcr = new Customer(data["accountnumber"].ToString(), data["pin"].ToString(), data["name"].ToString(), data["identitycard"].ToString(), data["familycard"].ToString(), Int32.Parse(data["balance"].ToString()), data["type"].ToString()); if (customer.familycard != rvcr.familycard) { MessageBox.Show("Only siblings can do deposit!"); return; } else { Window next = new PinConfirmationATM(customer, rvcr, Int32.Parse(amountxt.Text.ToString()), "deposit"); next.Show(); this.Close(); } } }
private void Button_Click(object sender, RoutedEventArgs e) { if (accnumtxt.Text == "") { MessageBox.Show("Account Number Must Be Filled!"); return; } if (amounttxt.Text == "") { MessageBox.Show("Amount Must Be Filled!"); return; } if (customer.accountnumber == accnumtxt.Text.ToString()) { MessageBox.Show("You cannot transfer to yourself!"); return; } string accnum = accnumtxt.Text; dt = new DataTable(); dt = connect.executeQuery("select * from customer where accountnumber = '" + accnumtxt.Text.ToString() + "' limit 1"); if (dt.Rows.Count == 0) { label.Content = "Invalid User!"; return; } else { DataRow data = dt.Rows[0]; label.Content = ""; Customer receiver = new Customer(data["accountnumber"].ToString(), data["pin"].ToString(), data["name"].ToString(), data["identitycard"].ToString(), data["familycard"].ToString(), Int32.Parse(data["balance"].ToString()), data["type"].ToString()); Window a = new PinConfirmationATM(customer, receiver, Int32.Parse(amounttxt.Text.ToString()), "regularacc"); a.Show(); this.Close(); } }
private void done(object sender, RoutedEventArgs e) { if (amountxt.Text == "") { MessageBox.Show("Must Input Amount!"); return; } int amount = Int32.Parse(amountxt.Text.ToString()); if (customer.balance - Int32.Parse(amountxt.Text.ToString()) <= 50000 && customer.type.ToString() != "Student") { MessageBox.Show("The Balance left in your account must be more than or equals 50000!"); return; } if (customer.balance - Int32.Parse(amountxt.Text.ToString()) <= 1000 && customer.type.ToString() == "Student") { MessageBox.Show("The Balance left in your account must be more than or equals 1000!"); return; } DataTable dt = new DataTable(); dt = connect.executeQuery("select sum(amount) as 'Total' from transaction where transactiontype = 'Withdraw Money' and receiver = '" + customer.accountnumber + "' and date = current_date"); DataRow data = dt.Rows[0]; //if (Int32.Parse(data["Total"].ToString()) + Int32.Parse(amountxt.Text.ToString()) > 2500000 && customer.type == "Bronze") //{ // MessageBox.Show("You have achieved the limit of withdraw money today!"); // Window a = new TellerWindow(employee); // a.Show(); // this.Close(); // return; //} //if (Int32.Parse(data["Total"].ToString()) + Int32.Parse(amountxt.Text.ToString()) > 5000000 && customer.type == "Silver") //{ // MessageBox.Show("You have achieved the limit of withdraw money today!"); // Window a = new TellerWindow(employee); // a.Show(); // this.Close(); // return; //} //if (Int32.Parse(data["Total"].ToString()) + Int32.Parse(amountxt.Text.ToString()) > 7500000 && customer.type == "Gold") //{ // MessageBox.Show("You have achieved the limit of withdraw money today!"); // Window a = new TellerWindow(employee); // a.Show(); // this.Close(); // return; //} //if (Int32.Parse(data["Total"].ToString()) + Int32.Parse(amountxt.Text.ToString()) > 10000000 && customer.type == "Black") //{ // MessageBox.Show("You have achieved the limit of withdraw money today!"); // Window a = new TellerWindow(employee); // a.Show(); // this.Close(); // return; //} //if (Int32.Parse(data["Total"].ToString()) + Int32.Parse(amountxt.Text.ToString()) > 1000000 && customer.type == "Student") //{ // MessageBox.Show("You have achieved the limit of withdraw money today!"); // Window a = new TellerWindow(employee); // a.Show(); // this.Close(); // return; //} string id = customer.accountnumber; connect.executeUpdate("update customer set balance = balance - " + amount + " where accountnumber = '" + id + "'"); connect.executeUpdate("insert into transaction values('','', 'Withdraw Money', " + amount + ", '" + customer.accountnumber + "', '', current_Date)"); MessageBox.Show("Success Withdraw Money!"); Window qrcode = new QRCode(employee); qrcode.Show(); this.Close(); }
private void Button_Click(object sender, RoutedEventArgs e) { if (username.Text == "") { MessageBox.Show("USERNAME MUST NOT BE EMPTY!"); return; } if (password.Password == "") { MessageBox.Show("PASSWORD MUST NOT BE EMPTY!"); return; } string id = username.Text; string pass = password.Password; DataTable dt = new DataTable(); dt = connect.executeQuery("select * from employee where id = '" + id + "' and password = '******' and status = 'Active' limit 1"); if (dt.Rows.Count == 0) { MessageBox.Show("Invalid Username/Password!"); return; } else { DataRow data = dt.Rows[0]; Employee emp = new Employee(data["id"].ToString(), data["name"].ToString(), data["password"].ToString(), Int32.Parse(data["salary"].ToString()), float.Parse(data["rating"].ToString()), Int32.Parse(data["ratecount"].ToString())); MessageBox.Show("Success!"); if (id[0] == 'T') { Window tellerwindow = new TellerWindow(emp); tellerwindow.Show(); this.Close(); } else if (id[0] == 'C') { Window cswindow = new CustomerService.CSWindow(emp); cswindow.Show(); this.Close(); } else if (id[0] == 'S') { Window swindow = new Security_and_Maintenance_Team.SMWindow(emp); swindow.Show(); this.Close(); } else if (id[0] == 'M') { Window mwindow = new Manager.ManagerWindow(emp); mwindow.Show(); this.Close(); } else if (id[0] == 'H') { Window hwindow = new Human_Resource_Management_Team.HRMWindow(emp); hwindow.Show(); this.Close(); } else if (id[0] == 'F') { Window fwindow = new Finance.FinanceWindow(emp); fwindow.Show(); this.Close(); } } }
private void done(object sender, RoutedEventArgs e) { if (nominaltxt.Text == "") { MessageBox.Show("Must Input Nominal!"); return; } int balance = Int32.Parse(nominaltxt.Text.ToString()); string id = customer.accountnumber; if (combobox.SelectedIndex < 0) { string note = new TextRange(notetxt.Document.ContentStart, notetxt.Document.ContentEnd).Text; connect.executeUpdate("insert into transaction values('" + combobox.Text + "','', 'Transfer Money', " + balance + ", '" + id + "', '" + note + "', current_Date)"); } else { DataTable getsender = new DataTable(); getsender = connect.executeQuery("select * from customer where accountnumber = '" + senderaccnum.ElementAt(combobox.SelectedIndex) + "' limit 1"); DataRow data2 = getsender.Rows[0]; Customer sendercust = new Customer(data2["accountnumber"].ToString(), data2["pin"].ToString(), data2["name"].ToString(), data2["identitycard"].ToString(), data2["familycard"].ToString(), Int32.Parse(data2["balance"].ToString()), data2["type"].ToString()); if (sendercust.balance - balance <= 50000 && sendercust.type.ToString() != "Student") { MessageBox.Show("The Balance left in your account must be more than or equals 50000!"); return; } if (sendercust.balance - balance <= 1000 && sendercust.type.ToString() == "Student") { MessageBox.Show("The Balance left in your account must be more than or equals 1000!"); return; } DataTable dt2 = new DataTable(); dt2 = connect.executeQuery("select sum(amount) as 'Total' from transaction where transactiontype in ('Transfer Money','Payments','Deposit Money') and senderaccnum = '" + sendercust.accountnumber + "' and date = current_date"); DataRow data = dt2.Rows[0]; //if (Int32.Parse(data["Total"].ToString()) + balance > 2000000 && sendercust.type == "Bronze") //{ // MessageBox.Show("You have achieved the limit of transfer money today!"); // Window a = new TellerWindow(employee); // a.Show(); // this.Close(); // return; //} //if (Int32.Parse(data["Total"].ToString()) + balance > 3000000 && sendercust.type == "Silver") //{ // MessageBox.Show("You have achieved the limit of transfer money today!"); // Window a = new TellerWindow(employee); // a.Show(); // this.Close(); // return; //} //if (Int32.Parse(data["Total"].ToString()) + balance > 5000000 && sendercust.type == "Gold") //{ // MessageBox.Show("You have achieved the limit of transfer money today!"); // Window a = new TellerWindow(employee); // a.Show(); // this.Close(); // return; //} //if (Int32.Parse(data["Total"].ToString()) + balance > 7000000 && sendercust.type == "Black") //{ // MessageBox.Show("You have achieved the limit of transfer money today!"); // Window a = new TellerWindow(employee); // a.Show(); // this.Close(); // return; //} //if (Int32.Parse(data["Total"].ToString()) + balance > 500000 && sendercust.type == "Student") //{ // MessageBox.Show("You have achieved the limit of transfer money today!"); // Window a = new TellerWindow(employee); // a.Show(); // this.Close(); // return; //} string note = new TextRange(notetxt.Document.ContentStart, notetxt.Document.ContentEnd).Text; connect.executeUpdate("insert into transaction values('" + combobox.Text + "','" + senderaccnum.ElementAt(combobox.SelectedIndex) + "', 'Transfer Money', " + balance + ", '" + id + "', '" + note + "', current_date)"); connect.executeUpdate("update customer set balance = balance - " + balance + " where accountnumber = '" + senderaccnum.ElementAt(combobox.SelectedIndex) + "'"); } connect.executeUpdate("update customer set balance = balance + " + balance + " where accountnumber = '" + id + "'"); MessageBox.Show("Success Transfer to " + customer.name); Window qrcode = new QRCode(employee); qrcode.Show(); this.Close(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { if (nominaltxt.Text == "") { MessageBox.Show("Must Input Nominal!"); return; } int balance = Int32.Parse(nominaltxt.Text.ToString()); if (senderfamilycard.ElementAt(combobox.SelectedIndex).Equals(customer.familycard)) { DataTable getsender = new DataTable(); getsender = connect.executeQuery("select * from customer where accountnumber = '" + senderaccnum.ElementAt(combobox.SelectedIndex) + "' limit 1"); DataRow data2 = getsender.Rows[0]; Customer sendercust = new Customer(data2["accountnumber"].ToString(), data2["pin"].ToString(), data2["name"].ToString(), data2["identitycard"].ToString(), data2["familycard"].ToString(), Int32.Parse(data2["balance"].ToString()), data2["type"].ToString()); if (sendercust.balance - balance <= 50000 && sendercust.type.ToString() != "Student") { MessageBox.Show("The Balance left in your account must be more than or equals 50000!"); return; } if (sendercust.balance - balance <= 1000 && sendercust.type.ToString() == "Student") { MessageBox.Show("The Balance left in your account must be more than or equals 1000!"); return; } DataTable dt2 = new DataTable(); dt2 = connect.executeQuery("select sum(amount) as 'Total' from transaction where transactiontype in ('Transfer Money','Payments','Deposit Money') and senderaccnum = '" + sendercust.accountnumber + "' and date = current_date"); DataRow data = dt2.Rows[0]; //if (Int32.Parse(data["Total"].ToString()) + balance > 2000000 && sendercust.type == "Bronze") //{ // MessageBox.Show("You have achieved the limit of transfer money today!"); // Window a = new TellerWindow(employee); // a.Show(); // this.Close(); // return; //} //if (Int32.Parse(data["Total"].ToString()) + balance > 3000000 && sendercust.type == "Silver") //{ // MessageBox.Show("You have achieved the limit of transfer money today!"); // Window a = new TellerWindow(employee); // a.Show(); // this.Close(); // return; //} //if (Int32.Parse(data["Total"].ToString()) + balance > 5000000 && sendercust.type == "Gold") //{ // MessageBox.Show("You have achieved the limit of transfer money today!"); // Window a = new TellerWindow(employee); // a.Show(); // this.Close(); // return; //} //if (Int32.Parse(data["Total"].ToString()) + balance > 7000000 && sendercust.type == "Black") //{ // MessageBox.Show("You have achieved the limit of transfer money today!"); // Window a = new TellerWindow(employee); // a.Show(); // this.Close(); // return; //} //if (Int32.Parse(data["Total"].ToString()) + balance > 500000 && sendercust.type == "Student") //{ // MessageBox.Show("You have achieved the limit of transfer money today!"); // Window a = new TellerWindow(employee); // a.Show(); // this.Close(); // return; //} string id = customer.accountnumber; dt2 = new DataTable(); dt2 = connect.executeQuery("select * from deposit where accountnumber = '" + customer.accountnumber + "' and enddate - current_date > 0"); int size = dt2.Rows.Count; if (size == 0) { MessageBox.Show("This user has no deposit account or deposit account has expired!"); return; } connect.executeUpdate("insert into transaction values('" + combobox.Text + "','" + senderaccnum.ElementAt(combobox.SelectedIndex) + "', 'Deposit Money', " + balance + ", '" + id + "', '', current_Date)"); Double amount = 0; DataRow dtrow = dt2.Rows[0]; if (Double.Parse(dtrow["currency"].ToString()).Equals("IDR")) { amount = balance; } else if (Double.Parse(dtrow["currency"].ToString()).Equals("IDR")) { amount = balance / 10638; } else { amount = balance / 14116; } connect.executeUpdate("update deposit set depositmoney = depositmoney + " + amount + " where accountnumber = '" + id + "'"); connect.executeUpdate("update customer set balance = balance - " + balance + " where accountnumber = '" + senderaccnum.ElementAt(combobox.SelectedIndex) + "'"); MessageBox.Show("Deposit Money Success!"); Window qrcode = new QRCode(employee); qrcode.Show(); this.Close(); } else { MessageBox.Show("Only family can do deposit!"); } }
private void submit_Click(object sender, RoutedEventArgs e) { if (pintxt.Password == "") { MessageBox.Show("PIN must be inputted!"); return; } DataTable dt = new DataTable(); dt = connect.executeQuery("select * from customer where accountnumber = '" + sendercust.accountnumber + "' and pin = '" + pintxt.Password.ToString() + "' limit 1"); if (dt.Rows.Count == 0) { MessageBox.Show("Your PIN is incorrect!"); return; } if (sendercust.balance - amount <= 50000 && sendercust.type.ToString() != "Student") { MessageBox.Show("The Balance left in your account must be more than or equals 50000!"); return; } if (sendercust.balance - amount <= 1000 && sendercust.type.ToString() == "Student") { MessageBox.Show("The Balance left in your account must be more than or equals 1000!"); return; } DataTable dt2 = new DataTable(); dt2 = connect.executeQuery("select sum(amount) as Total from transaction where transactiontype in ('Transfer Money','Payments','Deposit Money') and senderaccnum = '" + sendercust.accountnumber + "' and date = current_date"); DataRow data = dt2.Rows[0]; //if (long.Parse(data["Total"].ToString()) + amount > 2000000 && sendercust.type == "Bronze") //{ // MessageBox.Show("You have achieved the limit of transfer money today!"); // Window a = new ATMWindow(sendercust); // a.Show(); // this.Close(); // return; //} //if (long.Parse(data["Total"].ToString()) + amount > 3000000 && sendercust.type == "Silver") //{ // MessageBox.Show("You have achieved the limit of transfer money today!"); // Window a = new ATMWindow(sendercust); // a.Show(); // this.Close(); // return; //} //if (long.Parse(data["Total"].ToString()) + amount > 5000000 && sendercust.type == "Gold") //{ // MessageBox.Show("You have achieved the limit of transfer money today!"); // Window a = new ATMWindow(sendercust); // a.Show(); // this.Close(); // return; //} //if (long.Parse(data["Total"].ToString()) + amount > 7000000 && sendercust.type == "Black") //{ // MessageBox.Show("You have achieved the limit of transfer money today!"); // Window a = new ATMWindow(sendercust); // a.Show(); // this.Close(); // return; //} //if (long.Parse(data["Total"].ToString()) +amount > 500000 && sendercust.type == "Student") //{ // MessageBox.Show("You have achieved the limit of transfer money today!"); // Window a = new ATMWindow(sendercust); // a.Show(); // this.Close(); // return; //} if (action == "regularacc") { connect.executeUpdate("update customer set balance = balance - '" + amount + "' where accountnumber = '" + sendercust.accountnumber + "'"); connect.executeUpdate("update customer set balance = balance + '" + amount + "' where accountnumber = '" + receiver.accountnumber + "'"); connect.executeUpdate("insert into transaction values('" + sendercust.name + "','" + sendercust.accountnumber + "', 'Transfer Money', " + amount + ", '" + receiver.accountnumber + "', '', current_date)"); MessageBox.Show("Success Transfer!"); Window atm = new ATMWindow(sendercust); atm.Show(); this.Close(); } else if (action == "virtualacc") { connect.executeUpdate("update customer set balance = balance - " + amount + " where accountnumber = '" + sendercust.accountnumber + "'"); connect.executeUpdate("insert into transaction values('" + sendercust.name + "','" + sendercust.accountnumber + "', 'Transfer Money', " + amount + ", '" + virtualacc + "', '', current_date)"); connect.executeUpdate("update virtualaccount set status = 'Paid' where virtualaccount = '" + virtualacc + "'"); MessageBox.Show("Success Transfer!"); Window atm = new ATMWindow(sendercust); atm.Show(); this.Close(); } else if (action == "deposit") { dt2 = new DataTable(); dt2 = connect.executeQuery("select * from deposit where accountnumber = '" + receiver.accountnumber + "' and enddate - current_date > 0"); int size = dt2.Rows.Count; if (size == 0) { MessageBox.Show("This user has no deposit account or deposit account has expired!"); return; } connect.executeUpdate("update customer set balance = balance - " + amount + " where accountnumber = '" + sendercust.accountnumber + "'"); Double balance = 0; DataRow dtrow = dt2.Rows[0]; if ((dtrow["currency"].ToString()).Equals("IDR")) { balance = amount; } else if ((dtrow["currency"].ToString()).Equals("IDR")) { balance = amount / 10638; } else { balance = amount / 14116; } connect.executeUpdate("update deposit set depositmoney = depositmoney + " + balance + " where accountnumber = '" + receiver.accountnumber + "'"); connect.executeUpdate("insert into transaction values('" + sendercust.name + "','" + sendercust.accountnumber + "', 'Deposit Money', " + amount + ", '" + receiver.accountnumber + "', '', current_Date)"); MessageBox.Show("Deposit Money Success!"); Window atm = new ATMWindow(sendercust); atm.Show(); this.Close(); } }