Exemplo n.º 1
0
        public accounts(string username1, string password1)
        {
            db = new DBAccess();
            username = username1;
            password = password1;
            InitializeComponent();
               DataTable dt=db.select_allaccountid(username, password);
               foreach (DataRow dr in dt.Rows)
               {
               comboBox1.Items.Add(dr[1].ToString() + ":" + dr[0].ToString());

               }
               user_id = db.select_userid(username, password);
        }
Exemplo n.º 2
0
        public accounts(string username1, string password1)
        {
            db       = new DBAccess();
            username = username1;
            password = password1;
            InitializeComponent();
            DataTable dt = db.select_allaccountid(username, password);

            foreach (DataRow dr in dt.Rows)
            {
                comboBox1.Items.Add(dr[1].ToString() + ":" + dr[0].ToString());
            }
            user_id = db.select_userid(username, password);
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            user_id = db.select_userid(username, password);
            try
            {
                Form1 fm = new Form1(user_id, int.Parse(comboBox1.SelectedItem.ToString().Split(':')[1].Trim()));

                fm.Show();
                this.Hide();
                fm.AddOwnedForm(this);
            }
            catch
            {
            }
        }
Exemplo n.º 4
0
 private void edituserbutton_Click(object sender, EventArgs e)
 {
     if (passwordtb.Text.Length < 5 || passwordtb.Text.Length > 15)
     {
         label3.Text    = "Passwords must be between 5 and 15 characters";
         label3.Visible = true;
     }
     else if (phonetb.Text.Length != 10 || phonetb.Text.Contains('-'))
     {
         label3.Text    = "Phone Number must be 10 digits long and no - ";
         label3.Visible = true;
     }
     else if (!emailtb.Text.Contains('@') || !emailtb.Text.Contains('.'))
     {
         label3.Text    = "invaild email ";
         label3.Visible = true;
     }
     else if (lnametb.Text.Length == 0 || fnametb.Text.Length == 0)
     {
         label3.Text    = "Inval First Name or Last Name";
         label3.Visible = true;
     }
     else
     {
         try
         {
             db.insert_user(usernametb.Text, passwordtb.Text, phonetb.Text, emailtb.Text, lnametb.Text, fnametb.Text);
             db.insert_answers(textBox1.Text, comboBox1.SelectedIndex, db.select_userid(usernametb.Text, passwordtb.Text));
             this.Close();
         }
         catch
         {
             label3.Text    = "Please pick a new username";
             label3.Visible = true;
         }
     }
 }