Exemplo n.º 1
0
        private void Previous_button_Click(object sender, EventArgs e)
        {
            Donar_Profile dp = new Donar_Profile();

            this.Hide();
            dp.Show();
        }
Exemplo n.º 2
0
        private void Donar_login_button_Click(object sender, EventArgs e)
        {
            string useremail    = User_email_textbox.Text;
            string userpassword = User_password_textBox.Text;

            if (useremail.Equals(""))
            {
                MessageBox.Show("please enter your Email.");
            }
            else if (userpassword.Equals(""))
            {
                MessageBox.Show("please enter your Password.");
            }
            else
            {
                string query = "select * from Donars where Email = '" + useremail + "' AND Password = '******'";
                objDBAccess.readDatathroughAdapter(query, dtUsers);
                if (dtUsers.Rows.Count == 1)
                {
                    id                   = dtUsers.Rows[0]["ID"].ToString();
                    name                 = dtUsers.Rows[0]["Name"].ToString();
                    email                = dtUsers.Rows[0]["Email"].ToString();
                    password             = dtUsers.Rows[0]["Password"].ToString();
                    phn_num              = dtUsers.Rows[0]["Phone_number"].ToString();
                    dob                  = dtUsers.Rows[0]["Date_of_Birthday"].ToString();
                    age                  = dtUsers.Rows[0]["Age"].ToString();
                    occupation           = dtUsers.Rows[0]["Occupation"].ToString();
                    gender               = dtUsers.Rows[0]["Gender"].ToString();
                    address              = dtUsers.Rows[0]["Address"].ToString();
                    fake_name            = dtUsers.Rows[0]["Fake_name"].ToString();
                    current_balance      = dtUsers.Rows[0]["Current_Balance"].ToString();
                    total_donated_amount = dtUsers.Rows[0]["Total_donated_amount"].ToString();
                    //MessageBox.Show("login Successfully");
                    objDBAccess.closeConn();
                    Donar_Profile hf = new Donar_Profile();
                    this.Hide();
                    hf.Show();
                }
                else
                {
                    query = "select * from Receivers where Email = '" + useremail + "' AND Password = '******'";
                    objDBAccess.readDatathroughAdapter(query, dtUsers);
                    if (dtUsers.Rows.Count == 1)
                    {
                        id                          = dtUsers.Rows[0]["ID"].ToString();
                        name                        = dtUsers.Rows[0]["Name"].ToString();
                        email                       = dtUsers.Rows[0]["Email"].ToString();
                        password                    = dtUsers.Rows[0]["Password"].ToString();
                        phn_num                     = dtUsers.Rows[0]["Phone_number"].ToString();
                        dob                         = dtUsers.Rows[0]["Date_of_Birth"].ToString();
                        age                         = dtUsers.Rows[0]["Age"].ToString();
                        occupation                  = dtUsers.Rows[0]["Occupation"].ToString();
                        gender                      = dtUsers.Rows[0]["Gender"].ToString();
                        present_address             = dtUsers.Rows[0]["Present_address"].ToString();
                        permanent_address           = dtUsers.Rows[0]["Permanent_address"].ToString();
                        nid                         = dtUsers.Rows[0]["NID"].ToString();
                        marital_status              = dtUsers.Rows[0]["Marital_status"].ToString();
                        religion                    = dtUsers.Rows[0]["Religion"].ToString();
                        reference_person_name       = dtUsers.Rows[0]["Reference_person_name"].ToString();
                        reference_person_phn_number = dtUsers.Rows[0]["Reference_person_phone_number"].ToString();
                        organization_type           = dtUsers.Rows[0]["Organization_type"].ToString();
                        //MessageBox.Show("login Successfully");
                        objDBAccess.closeConn();
                        Receiver_Profile_form rpf = new Receiver_Profile_form();
                        this.Hide();
                        rpf.Show();
                    }
                    else
                    {
                        MessageBox.Show("Invalid information. Provide correct email and password");
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void Donate_button_Click(object sender, EventArgs e)
        {
            if (Receiver_names_comboBox.Text.Equals(""))
            {
                MessageBox.Show("Please select a receiver.");
            }
            else
            {
                if (Double.Parse(need_amounts) == 0)
                {
                    MessageBox.Show("This person's request has been full fill. Don't need more money");
                }
                else
                {
                    if (Double.Parse(UserLogin.current_balance) > 0)
                    {
                        DialogResult dialogResult = MessageBox.Show("Do you want to donate it ?", "You have " + UserLogin.current_balance + " money stroed in your balance", MessageBoxButtons.YesNo);
                        if (dialogResult == DialogResult.Yes)
                        {
                            /* this.Refresh();
                             * if (Double.Parse(need_amounts) == 0)
                             * {
                             *   MessageBox.Show("This person's request has been full fill. Don't need more money");
                             *
                             * }
                             * else */
                            if (Double.Parse(need_amounts) >= Double.Parse(UserLogin.current_balance))
                            {
                                g_amount = Double.Parse(got_amounts) + Double.Parse(UserLogin.current_balance);
                                n_amount = (Double.Parse(need_amounts) - Double.Parse(UserLogin.current_balance));

                                cs_amount           = Double.Parse(current_stored_amount) - Double.Parse(UserLogin.current_balance);
                                td_donation         = Double.Parse(total_delivered_donation) + Double.Parse(UserLogin.current_balance);
                                donarUser_c_balance = 0.00;
                            }
                            else
                            {
                                g_amount            = Double.Parse(got_amounts) + Double.Parse(need_amounts);
                                donarUser_c_balance = Double.Parse(UserLogin.current_balance) - Double.Parse(need_amounts);

                                cs_amount   = Double.Parse(current_stored_amount) - Double.Parse(need_amounts);
                                td_donation = Double.Parse(total_delivered_donation) + Double.Parse(need_amounts);
                                n_amount    = 0.00;
                            }
                            //MessageBox.Show(receiver_id);
                            string query11 = "UPDATE Receiver_requests SET Amount_need = '" + n_amount + "', Amount_got = '" + g_amount + "' WHERE rid = '" + receiver_id + "' ";
                            objDBAccess.readDatathroughAdapter(query11, dtUsers);

                            string query12 = "UPDATE System_account SET  Total_delivered_donation = '" + td_donation + "', Current_stored_amount = '" + cs_amount + "' WHERE Account_name = 'SYSTEM'; ";
                            objDBAccess.readDatathroughAdapter(query12, dtUsers);

                            string query13 = "UPDATE Donars SET Current_Balance = '" + donarUser_c_balance + "' WHERE ID = '" + UserLogin.id + "'; ";
                            objDBAccess.readDatathroughAdapter(query13, dtUsers);
                            this.Refresh();
                            MessageBox.Show("Thanks for your donation, your donation transfer successfully.");
                            Donar_Profile dp = new Donar_Profile();
                            this.Hide();
                            dp.Refresh();
                            //dp.Show();
                            UserLogin l = new UserLogin();
                            l.Show();
                        }
                        else
                        {
                            MessageBox.Show("Thankyou for your service.");
                        }
                    }
                    else if (Double.Parse(UserLogin.current_balance) == 0)
                    {
                        Donar_Amount da = new Donar_Amount();
                        da.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Somthing Error!!!");
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void Donar_amountConfirm_ok_button_Click(object sender, EventArgs e)
        {
            MessageBox.Show("You select " + Receiver_List.receiver_name + " for donation.");
            double donated_amount = Double.Parse(Enter_amount_textBox.Text);

            if (Double.Parse(Receiver_List.need_amounts) == 0)
            {
                MessageBox.Show("This person's request has been full fill. Don't need more money");
                Receiver_List.cs_amount           = Double.Parse(Receiver_List.current_stored_amount) + donated_amount;
                Receiver_List.tr_donation         = Double.Parse(Receiver_List.total_received_donation) + donated_amount;
                Receiver_List.donarUser_c_balance = Double.Parse(UserLogin.current_balance) + donated_amount;
                donar_total_donated_amount        = Double.Parse(UserLogin.total_donated_amount) + donated_amount;
            }
            else if (Double.Parse(Receiver_List.need_amounts) >= donated_amount)
            {
                Receiver_List.g_amount = Double.Parse(Receiver_List.got_amounts) + donated_amount;
                Receiver_List.n_amount = (Double.Parse(Receiver_List.need_amounts) - donated_amount);

                Receiver_List.tr_donation = Double.Parse(Receiver_List.total_received_donation) + donated_amount;
                Receiver_List.td_donation = Double.Parse(Receiver_List.total_delivered_donation) + donated_amount;

                donar_total_donated_amount = Double.Parse(UserLogin.total_donated_amount) + donated_amount;
            }
            else
            {
                Receiver_List.g_amount = Double.Parse(Receiver_List.got_amounts) + Double.Parse(Receiver_List.need_amounts);


                Receiver_List.donarUser_c_balance = Double.Parse(UserLogin.current_balance) + (donated_amount - Double.Parse(Receiver_List.need_amounts));
                donar_total_donated_amount        = Double.Parse(UserLogin.total_donated_amount) + donated_amount;

                Receiver_List.cs_amount   = Double.Parse(Receiver_List.current_stored_amount) + (donated_amount - Double.Parse(Receiver_List.need_amounts));
                Receiver_List.td_donation = Double.Parse(Receiver_List.total_delivered_donation) + Double.Parse(Receiver_List.need_amounts);
                Receiver_List.tr_donation = Double.Parse(Receiver_List.total_received_donation) + donated_amount;

                Receiver_List.n_amount = 0.00;
            }

            string query21 = "UPDATE Receiver_requests SET Amount_need = '" + Receiver_List.n_amount + "', Amount_got = '" + Receiver_List.g_amount + "' WHERE rid = '" + Receiver_List.receiver_id + "' ";

            objDBAccess.readDatathroughAdapter(query21, dtUsers);

            string query22 = "UPDATE System_account SET Total_received_donation = '" + Receiver_List.tr_donation + "' , Total_delivered_donation = '" + Receiver_List.td_donation + "', Current_stored_amount = '" + Receiver_List.cs_amount + "' WHERE Account_name = 'SYSTEM'; ";

            objDBAccess.readDatathroughAdapter(query22, dtUsers);

            string query23 = "UPDATE Donars SET Total_donated_amount = '" + donar_total_donated_amount + "',Current_Balance = '" + Receiver_List.donarUser_c_balance + "' WHERE ID = '" + UserLogin.id + "'; ";

            objDBAccess.readDatathroughAdapter(query23, dtUsers);

            MessageBox.Show("Thanks for your donation, your donation transfer successfully.");


            Donar_Profile dp = new Donar_Profile();

            this.Hide();
            dp.Refresh();
            UserLogin l = new UserLogin();

            l.Show();
            //dp.Show();
        }