private void BtCusBack_Click(object sender, EventArgs e) { FormHome f = new FormHome(); f.Show(); this.Hide(); }
private void BtLog_Click(object sender, EventArgs e) { if (TxtLogName.Text == "" || TxtLogPass.Text == "") { MessageBox.Show("Enter UserName and Password"); return; } else { var result = db.Users.Where(p => p.UserName == TxtLogName.Text && p.Pass == TxtLogPass.Text).SingleOrDefault(); if (result == null) { MessageBox.Show("Your Account doesn't exist"); TxtLogName.Clear(); TxtLogPass.Clear(); } else { this.Hide(); MessageBox.Show("Log in successfully"); Medium.IdSto = result.ID; Medium.Active = true; FormHome f = new FormHome(); f.Show(); } } }
private void BtSupBack_Click(object sender, EventArgs e) { if (Medium.FormPro == true) { this.Hide(); FormProducts p = new FormProducts(); p.Show(); return; } FormHome f = new FormHome(); f.Show(); this.Hide(); }
private void BtnRes_Click(object sender, EventArgs e) { if (TxtResName.Text == null || TxtResUser.Text == null || TxtResPass1.Text == null || TxtResPass2.Text == null) { MessageBox.Show("Fill in information"); } else { int ID = Convert.ToInt32(TxtResName.Text); var result = db.Storekeepers.Where(p => p.ID == ID).SingleOrDefault(); if (result == null) { MessageBox.Show("Yours Id doesn't exist"); TxtResName.Clear(); } else { var result1 = db.Users.Where(p => p.UserName == TxtResUser.Text).SingleOrDefault(); if (result1 != null) { MessageBox.Show("UserName existed, Enter difference Username"); TxtResUser.Clear(); } else { if (TxtResPass1.Text != TxtResPass2.Text) { MessageBox.Show("Password isn't correct"); TxtResPass2.Clear(); } else { User user = new User(); user.UserName = TxtResUser.Text; user.Pass = TxtResPass1.Text; user.ID = Convert.ToInt32(TxtResName.Text); db.Users.Add(user); db.SaveChanges(); this.Hide(); MessageBox.Show("Registration successfully"); FormHome f = new FormHome(); f.Show(); } } } } }