private void button3_Click(object sender, EventArgs e) { n = new Users(); n = Users.Single("Select * from users WHERE contact = '" + contactTxt.Text + "' AND password = '******'"); loginBtn.Visible = false; if (contactTxt.Text == "" || passwordTxt.Text == "") { MessageBox.Show("Insert login credentials"); loginBtn.Visible = true; return; } try { Helper.contact = n.Contact; } catch { MessageBox.Show("Invalid login credentials"); loginBtn.Visible = true; return; } if (String.IsNullOrEmpty(Helper.contact)) { MessageBox.Show("Access denied contact undefined"); loginBtn.Visible = true; } else { Helper.UserID = n.Id; Helper.UserImage = n.Image; Helper.UserName = n.Name; Helper.Level = n.Level; Helper.Department = n.Department; string active = n.Active; if (active == "No") { MessageBox.Show("Your login status is not active ,Please contact admin "); loginBtn.Visible = true; return; } // Helper.Log(Helper.UserName, "Log in "); Helper.CompanyID = Company.List().First().Id; Helper.NPI = Company.List().First().Npi; using (ProcessWindow form = new ProcessWindow()) { DialogResult dr = form.ShowDialog(); if (dr == DialogResult.OK) { if (Helper.Level == "5") { AdministrationForm frm = new AdministrationForm(); frm.Show(); this.Hide(); Helper.Log(Helper.UserName, "Administration login" + DateTime.Now); } else { if (Helper.Department == "Medical Equipment") { MedicalForm frm = new MedicalForm(); frm.Show(); this.Hide(); Helper.Log(Helper.UserName, "Logging in to DME" + DateTime.Now); } if (Helper.Department == "Payroll") { HrmForm f = new HrmForm(); f.Show(); this.Hide(); Helper.Log(Helper.UserName, "Logging in to Pay roll and Human Resource" + DateTime.Now); } } } else { MessageBox.Show("System did not download required information"); } } loginBtn.Visible = true; } }
private void button1_Click(object sender, EventArgs e) { MedicalForm frm = new MedicalForm(); frm.Show(); }