private void button1_Click(object sender, EventArgs e) { BloodDataContext D = new BloodDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=F:\C# projects\finalProject\Blood Donation\Blood.mdf;Integrated Security=True;Connect Timeout=30"); string s = textBox1.Text; if (textBox1.Text != "" && textBox2.Text != "") { if (s[0] == '$') { try { var y = from b in D.AdminInfos where b.Username.Equals(textBox1.Text) select b; if ((y.FirstOrDefault().Password == textBox2.Text)) { Admin admin = new Admin(this, textBox1.Text); admin.Show(); textBox1.Clear(); textBox2.Clear(); this.Hide(); } else { MessageBox.Show("Wrong Password"); } } catch (NullReferenceException) { MessageBox.Show("Wrong Username"); } catch (Exception) { MessageBox.Show("Fill your Username and Password"); } } else { try { var x = from a in D.DonorInfos where a.UserID == textBox1.Text select a; if (x.FirstOrDefault().Password == textBox2.Text) { Donor donor = new Donor(this, textBox2.Text); donor.Show(); textBox1.Clear(); textBox2.Clear(); this.Hide(); } else { MessageBox.Show("Wrong Password"); } } catch (NullReferenceException) { MessageBox.Show("Wrong UserId"); } catch (Exception) { MessageBox.Show("Fill your Username and Password"); } } } else { MessageBox.Show("Fill your Username and Password"); } }
public UpdateDonor(Donor Dono, int d) { InitializeComponent(); this.d = d; this.donor = Dono; }
public Requests(Donor don, int x) { this.s = x; this.don = don; InitializeComponent(); }