예제 #1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            if (checkBox3.Checked)
            {
                Enrollee.plan = true;
            }
            else
            {
                Enrollee.plan = false;
            }
            String fullname = textBox1.Text;
            String ssn      = textBox2.Text;
            String bAddress = textBox3.Text;
            String mAddress = textBox4.Text;
            String username = textBox5.Text;
            String password = textBox6.Text;
            string pin      = PINTextBox.Text;

            DBMng.insertIntoPrimaryEnrollee(plantype, fullname, username, password, mAddress, bAddress, ssn, pin);

            int id;

            id = DBMng.validateEnrollee(username, password);
            if (DBMng.getPlanTypeEnrollee(id) == "basic")
            {
                DBMng.updateDeductible(id, 250);
            }

            this.Hide();
            EnrolleeHomePage newEnrolleeInfo = new EnrolleeHomePage(id);

            newEnrolleeInfo.ShowDialog();
        }
        public static void changePlan(int id)
        {
            int             planid = 0;
            MySqlConnection mycon  = connectOutOfSIUE();
            MySqlDataReader rd;

            mycon.Open();
            string       query = "select plan$id from primaryEnrollee where id=" + id;
            MySqlCommand cmd   = new MySqlCommand();

            cmd.Connection  = mycon;
            cmd.CommandText = query;
            cmd.Prepare();
            rd = cmd.ExecuteReader();
            while (rd.Read())
            {
                planid = rd.GetInt32(0);
            }

            string type = "";

            query           = "select type from plan where id=" + planid;
            cmd.CommandText = query;
            cmd.Prepare();
            rd.Close();
            rd = cmd.ExecuteReader();
            while (rd.Read())
            {
                type = rd.GetString(0);
            }

            if (type == "basic")
            {
                query = "update plan set type = 'extended' where id=" + planid;
            }
            else
            {
                query = "update plan set type = 'basic' where id=" + planid;
            }
            rd.Close();
            cmd.CommandText = query;
            cmd.Prepare();
            cmd.ExecuteNonQuery();
            mycon.Close();
            if (type == "basic")
            {
                DBMng.updateDeductible(id, 250);
            }
            else
            {
                DBMng.updateDeductible(id, 0);
            }
        }
예제 #3
0
        public string payBill(Bills bill)
        {
            int    id         = bill.getBillId();
            int    enrid      = bill.getEnrolleeId();
            double deductible = Convert.ToDouble(DBMng.getDeductible(enrid));

            if (deductible > bill.getAmount())
            {
                DBMng.updateDeductible(enrid, Convert.ToInt32(deductible - bill.getAmount()));
                DBMng.updateIsPaid(id);
            }
            else
            {
                DBMng.updateDeductible(enrid, 0);
                DBMng.updateIsPaid(id);
            }
            return("Bill has been paid.");
        }