static void Main() { //frmLogin objfrmLogin = new frmLogin(); //objfrmLogin.ShowDialog(); frmMain objfrmLogin = new frmMain(); objfrmLogin.ShowDialog(); }
private void btnLogin_Click_1(object sender, EventArgs e) { //for encryption connection string //string conn = "Server=LAPTOP124\\devteam;Database=OCMS;Integrated Security = false;User ID=usermedicoms;Password=m3d!c0ms"; //conn = clsUtility.Encrypt(conn.ToString()); //conn = clsUtility.Decrypt(conn.ToString()); //string conn = "Server=devteamsvr001;Database=OCMS;Integrated Security = false;User ID=mpiuser;Password=itdbtw3n+y12"; //conn = clsUtility.Encrypt(conn.ToString()); UsersBusiness usersbusiness = new UsersBusiness(); var user = new UsersModel(); //clsGlobal.userGlbl = textUsername.Text; //TO Do, Add Role user.usercode = textUsername.Text; user.userpass = clsUtility.Encrypt(textPassword.Text); if (usersbusiness.validateUserInfo(user) == true) { if (Class.clsGlobal.lblrole == "Nurse") { this.Hide(); this.Close(); frmMain objfrmMain = new frmMain(); objfrmMain.ShowDialog(); //patientMasterListToolStripMenuItem_Click(sender, e); } else { this.Hide(); this.Close(); frmMain objfrmMain = new frmMain(); objfrmMain.ShowDialog(); } } else { MessageBox.Show("Invalid Usercode!", "OCMS", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void btnLogin_Click_2(object sender, EventArgs e) { //for encryption connection string //string conn = "Server=devteamsvr001;Database=dbMedicomsDenormalize;Integrated Security = false;User ID=mpiuser;Password=itdbtw3n+y12"; //conn = clsUtility.Encrypt(conn.ToString()); //conn = clsUtility.Decrypt(conn.ToString()); //string conn = "Server=devteamsvr001;Database=OCMS;Integrated Security = false;User ID=mpiuser;Password=itdbtw3n+y12"; //conn = clsUtility.Encrypt(conn.ToString()); //string test = "Medicard!1"; //test = clsUtility.Encrypt(test.ToString()); DBResource newConnection = new DBResource(); if (newConnection.IsAvailable(newConnection.connectionString.ToString())) { Cursor.Current = Cursors.AppStarting; UsersBusiness usersbusiness = new UsersBusiness(); var user = new UsersModel(); //clsGlobal.userGlbl = textUsername.Text; //TO Do, Add Role user.usercode = textUsername.Text; user.userpass = clsUtility.Encrypt(textPassword.Text); user.role = cmbRole.Text; Class.clsGlobal.lblrole = cmbRole.Text; if (usersbusiness.validateUserInfo(user) == true) { this.Hide(); frmMain objfrmMain = new frmMain(); objfrmMain.Closed += (s, args) => this.Close(); objfrmMain.ShowDialog(); //if (Class.clsGlobal.lblrole == "Nurse") //{ // this.Hide(); // this.Close(); // frmMain objfrmMain = new frmMain(); // objfrmMain.ShowDialog(); // //patientMasterListToolStripMenuItem_Click(sender, e); //} //else //{ // this.Hide(); // frmMain objfrmMain = new frmMain(); // objfrmMain.Closed += (s, args) => this.Close(); // objfrmMain.ShowDialog(); //} } else { MessageBox.Show("Kindly check login privilege, username and password!", "OCMS", MessageBoxButtons.OK, MessageBoxIcon.Warning); } Cursor.Current = Cursors.Default; } else { MessageBox.Show("Please check your database connection!", "OCMS", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }