public UpdateCriminal() { InitializeComponent(); JailManagementDataContext dc = new JailManagementDataContext(); Array id = dc.Criminals.Select(c => c.Criminal_id).Distinct().ToArray(); AutoCompleteStringCollection autoCompleteData = new AutoCompleteStringCollection(); foreach (string c in id) { autoCompleteData.Add(c); } textBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource; textBox1.AutoCompleteCustomSource = autoCompleteData; }
public Complain() { InitializeComponent(); JailManagementDataContext dc = new JailManagementDataContext(); Array names = dc.Complains.Select(c => c.Full_Name).Distinct().ToArray(); AutoCompleteStringCollection autoCompleteData = new AutoCompleteStringCollection(); foreach (string c in names) { autoCompleteData.Add(c); } textBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource; textBox1.AutoCompleteCustomSource = autoCompleteData; }
private void button1_Click(object sender, EventArgs e) { JailManagementDataContext dc = new JailManagementDataContext(); String userid = textBox1.Text; String password = textBox2.Text; Employee emp = dc.Employees.SingleOrDefault(x => x.Password == password & x.User_Id == userid); if (emp == null) { MessageBox.Show("Invalid UserName or Password"); } else { if (emp.Designation == "Police") { this.Hide(); PoliceView a = new PoliceView(); a.Show(); } else if (emp.Designation == "Jailer") { this.Hide(); JailerView a = new JailerView(); a.Show(); } else if (emp.Designation == "Doctor") { this.Hide(); DctorView a = new DctorView(); a.Show(); } else if (emp.Designation == "Admin") { this.Hide(); Admin a = new Admin(); a.Show(); } } }