private void button1_Click(object sender, EventArgs e) { ORMDataContext db = new ORMDataContext(); User_info u1 = new User_info(); if (textBox1.ReadOnly == false) { u1.First_name = textBox1.Text; u1.Last_name = textBox2.Text; u1.E_mail = textBox4.Text; u1.Password = textBox3.Text; u1.DOB = textBox5.Text; u1.Account_type = "user"; db.User_infos.InsertOnSubmit(u1); db.SubmitChanges(); MessageBox.Show("Data inserted successfully"); } else { User_info u2 = db.User_infos.SingleOrDefault(); u2.First_name = textBox1.Text; u2.Last_name = textBox2.Text; u2.E_mail = textBox3.Text; u2.Password = textBox4.Text; u2.DOB = textBox5.Text; db.SubmitChanges(); MessageBox.Show("Record updated"); } }
private void Account_normal_page_Load(object sender, EventArgs e) { ORMDataContext o1 = new ORMDataContext(); User_info u1 = new User_info(); label2.Text = Login.login_name; label6.Text = Login.login_name; var query = (from User_info in o1.User_infos where User_info.First_name == Login.login_name select User_info.E_mail).Single(); label7.Text = query.ToString(); var query1 = (from User_info in o1.User_infos where User_info.First_name == Login.login_name select User_info.DOB).Single(); label8.Text = query1.ToString(); }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == null || textBox2.Text == null || textBox3.Text == null || textBox4.Text == null || textBox5.Text == null) { MessageBox.Show("Please fill up the form properly"); } else if (textBox4.Text.Equals(textBox5.Text)) { ORMDataContext db = new ORMDataContext(); User_info u1 = new User_info(); u1.First_name = textBox1.Text; u1.Last_name = textBox2.Text; u1.E_mail = textBox3.Text; u1.Password = textBox5.Text; u1.DOB = dateTimePicker1.Text; db.User_infos.InsertOnSubmit(u1); db.SubmitChanges(); MessageBox.Show("Account created successfully"); } else { MessageBox.Show("Password mismatch"); } }
partial void DeleteUser_info(User_info instance);
partial void UpdateUser_info(User_info instance);
partial void InsertUser_info(User_info instance);