Beispiel #1
0
        private void frmLogin_Load(object sender, EventArgs e)
        {
            FormBorderStyle = FormBorderStyle.None;
            Region          = Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 50, 50));

            DBResource newConnection = new DBResource();

            if (newConnection.IsAvailable(newConnection.connectionString.ToString()))
            {
                cmbRole.DataSource    = usersdata.getRole(0);
                cmbRole.DisplayMember = "role";
                cmbRole.ValueMember   = "role";
            }
        }
Beispiel #2
0
        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);
            }
        }