private void loginbtm_Click(object sender, EventArgs e) { IMSDBContext context = new IMSDBContext(); var obj = context.UserInfoes.FirstOrDefault(u => u.UserName.Equals(txtuser.Text) && u.Password.Equals(txtpass.Text)); if (obj == null) { MessageBox.Show(this, "Invalid Username anad Password"); return; } var up = new UserProfile() { ID = obj.ID, Name = obj.Name, UserName = obj.UserName, UserTypeID = obj.UserTypeID }; Loginhelper.UserProfile = up; if (obj.UserTypeID == (int)EnumCollection.UserTypeEnum.Admin) { Admin am = new Admin(); am.Show(); } else if (obj.UserTypeID == (int)EnumCollection.UserTypeEnum.Employee) { Employee am = new Employee(); am.Show(); } this.Hide(); }
private void InventoryManage_Load(object sender, EventArgs e) { IMSDBContext context = new IMSDBContext(); dgvProduct.AutoGenerateColumns = false; dgvProduct.DataSource = context.Products.ToList(); dgvProduct.Refresh(); }