private void Back_Click(object sender, EventArgs e) { this.Hide(); ResouceManagement resouceManagement = new ResouceManagement(); resouceManagement.Show(); }
private void UpdateBtn_Click(object sender, EventArgs e) { using (var db = new Session1Entities()) { var query = db.Resources.Where(x => x.resId == IDs).FirstOrDefault(); query.remainingQuantity = (int)quantity.Value; if (skills.Visible == false) { try { db.SaveChanges(); MessageBox.Show("Successful!"); this.Hide(); ResouceManagement resouceManagement = new ResouceManagement(); resouceManagement.Show(); } catch (Exception ES) { MessageBox.Show(ES.ToString()); } } else { var query2 = db.Resource_Allocation.Where(x => x.resIdFK == IDs).ToList(); foreach (var item in query2) { db.Resource_Allocation.Remove(item); } for (int i = 0; i < skills.CheckedItems.Count; i++) { Resource_Allocation resource_Allocation = new Resource_Allocation(); resource_Allocation.resIdFK = IDs; resource_Allocation.skillIdFK = i + 1; db.Resource_Allocation.Add(resource_Allocation); } try { db.SaveChanges(); MessageBox.Show("Successful!"); this.Hide(); ResouceManagement resouceManagement = new ResouceManagement(); resouceManagement.Show(); } catch (Exception es) { MessageBox.Show(es.ToString()); } } } }
private void LoginBtn_Click(object sender, EventArgs e) { using (var db = new Session1Entities()) { var query = db.Users.Where(x => x.userId == UID.Text && x.userPw == Pass.Text).FirstOrDefault(); if (query != null) { this.Hide(); ResouceManagement resouceManagement = new ResouceManagement(); resouceManagement.ShowDialog(); } else { MessageBox.Show("Invalid User!"); } } }