public ProgressForm(int facultyId) { this.FacultyId = facultyId; InitializeComponent(); using (Entity_DB.Model1 db = new Entity_DB.Model1()) { var sub = from s in db.Subjects join t in db.Teachers on s.Teacher_Id equals t.Id orderby s.Name select new { Id = s.Id, Name = s.Name + " ( " + t.Name + " )", }; comboBox1.DataSource = sub.ToList(); comboBox1.DisplayMember = "Name"; comboBox1.ValueMember = "Id"; var stud = from s in db.Students join g in db.Groups on s.Group_Id equals g.Id where g.Faculty_Id == this.FacultyId select new { Id = s.Id, Name = s.Name }; comboBox2.DataSource = stud.ToList(); comboBox2.DisplayMember = "Name"; comboBox2.ValueMember = "Id"; } }
private void loginButton_Click(object sender, EventArgs e) { if (loginBox.Text == "admin" && passwordBox.Text == "admin") { DeveloperMode DM = new DeveloperMode(); DM.Show(); this.Hide(); } else { using (Entity_DB.Model1 db = new Entity_DB.Model1()) { var reg = db.Users .Where(z => z.Login == loginBox.Text && z.Password == passwordBox.Text) .Select(z => z.Faculty_Id) .ToList(); if (reg.Count > 0) { Entity_DB.decanMode DecMode = new Entity_DB.decanMode(reg.First().Value); DecMode.Show(); this.Hide(); } else { MessageBox.Show("Неверный логин или пароль"); } } } }
public GroupeForm() { InitializeComponent(); db = new Entity_DB.Model1(); var spec = from s in db.Specialty select new { Id = s.Id, Name = s.Name }; comboBox1.DataSource = spec.ToList(); comboBox1.DisplayMember = "Name"; comboBox1.ValueMember = "Id"; var cour = from c in db.Courses select new { Id = c.Id, Name = c.Name }; comboBox2.DataSource = cour.ToList(); comboBox2.DisplayMember = "Name"; comboBox2.ValueMember = "Id"; }
public StudentForm() { InitializeComponent(); using (Entity_DB.Model1 db = new Entity_DB.Model1()) { var groups = from g in db.Groups join s in db.Specialty on g.Specialty_Id equals s.Id select new { Id = g.Id, Name = s.Name + " - " + g.Year, }; comboBox1.DataSource = groups.ToList(); comboBox1.DisplayMember = "Name"; comboBox1.ValueMember = "Id"; } }