コード例 #1
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            Loans window = new Loans();

            window.Show();
            this.Hide();
        }
コード例 #2
0
 private void button_Click(object sender, RoutedEventArgs e) //return
 {
     if (goback == "client")
     {
         ClientExtra window = new ClientExtra();
         window.Show();
         this.Hide();
     }
     else if (goback == "account")
     {
         AccountExtra window = new AccountExtra();
         window.Show();
         this.Hide();
     }
     else
     {
         if (editing.Approved)
         {
             Loans window = new Loans();
             window.Show();
             this.Hide();
         }
         else
         {
             LoansApprove window = new LoansApprove();
             window.Show();
             this.Hide();
         }
     }
 }
コード例 #3
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     if (mode == "loan")
     {
         Loans window = new Loans();
         window.Show();
         this.Hide();
     }
     else
     {
         Clients window = new Clients();
         window.Show();
         this.Hide();
     }
 }
コード例 #4
0
 private void button1_Click(object sender, RoutedEventArgs e) //go back
 {
     if (mode == "loan")
     {
         Loans window = new Loans();
         window.Show();
         this.Hide();
     }
     else
     {
         AccountDetails window = new AccountDetails();
         window.Show();
         this.Hide();
     }
 }
コード例 #5
0
        private void button_Click_1(object sender, RoutedEventArgs e)
        {
            double ov   = -1;
            double rv   = -1;
            int    time = -1;

            try {
                if (double.TryParse(textBox.Text, out ov) && double.TryParse(textBox1.Text, out rv) &&
                    int.TryParse(textBox4.Text, out time)
                    )
                {
                    if (!refresh())
                    {
                        return;
                    }

                    if (rv > ov)
                    {
                        MessageBox.Show("Requested value must not be higher than the object's value!");
                        return;
                    }

                    //make sure unique IDs are used when creating things

                    SqlCommand cmd = new SqlCommand("SELECT max(id) FROM LOANS");
                    cmd.Connection = cn;
                    int newID = (int)cmd.ExecuteScalar() + 1;

                    string o = ov.ToString().Replace(",", ".");
                    string r = rv.ToString().Replace(",", ".");

                    try {
                        double juro         = juromensalfunc(ov, rv); //finds index too
                        double monthlyvalue = calcularmensal(ov, rv, juro);
                        string mo           = monthlyvalue.ToString().Replace(",", ".");

                        try {
                            if (logintype == "admin")
                            {
                                cmd            = new SqlCommand("EXEC ManagerInsertLoan " + newID + ", " + cid + ", " + aid + ", " + o + ", " + r + ", " + index + ", " + time + ", " + mo);
                                cmd.Connection = cn;
                                cmd.ExecuteNonQuery();
                            }
                            else
                            {
                                cmd            = new SqlCommand("EXEC EmployeeInsertLoan " + newID + ", " + cid + ", " + aid + ", " + o + ", " + r + ", " + index + ", " + time + ", " + mo);
                                cmd.Connection = cn;
                                cmd.ExecuteNonQuery();

                                MessageBox.Show("Your loan is now pending for approval.");
                            };
                            Loans window = new Loans();
                            window.Show();
                            this.Hide();
                        }
                        catch (SqlException) { MessageBox.Show("Error updating database: some values may be too big."); }
                    }
                    catch (OverflowException) { MessageBox.Show("Overflow in the monthly value calculation."); }
                }
                else
                {
                    MessageBox.Show("Some of the fields may contain non-numeric values.");
                }
            }
            catch (OverflowException) { MessageBox.Show("One or more numbers are too big."); }
        }