예제 #1
0
        void Logon()
        {
            MWDataManager.clsDataAccess _dbMan = new MWDataManager.clsDataAccess();
            _dbMan.ConnectionString = ConfigurationSettings.AppSettings["SQLConnectionStr"];

            _dbMan.SqlStatement = "select * from tbl_Users " +
                                  "where UserID = '" + UsernameTxt.Text + "' and password = '******'";
            _dbMan.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement;
            _dbMan.queryReturnType    = MWDataManager.ReturnType.DataTable;
            _dbMan.ExecuteInstruction();
            DataTable SubA = _dbMan.ResultsDataTable;

            if (SubA.Rows.Count > 0)
            {
                SplashScreen Mainfrm;
                Mainfrm             = (SplashScreen)this.FindForm();
                Mainfrm.WindowState = FormWindowState.Minimized;
                //alertControl1.Show(Mainfrm, "Notification", "Record Saved Successfuly.");

                Classes.MainScreen MainScreen = new Classes.MainScreen();
                this.Hide();
                this.Close();
                //Classes.MainScreen Spla = new Classes.MainScreen();
                //SplashScreen.WindowState = FormWindowState.Minimized;
                MainScreen.labName.Text     = UsernameTxt.Text;
                MainScreen.LocalIndLbl.Text = "N";

                //SplashScreen Splash = new SplashScreen();
                //Splash.WindowState = FormWindowState.Minimized;

                //Application.Run(new Classes.MainScreen());
                //this.Hide();

                MainScreen.ShowDialog();
            }
            else
            {
                MessageBox.Show("User not found. Please try again.", "Login Failed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                LogonBtn.Enabled = false;
            }
        }
예제 #2
0
        public void LogonProc()
        {
            //if (ConnLoc == "N")
            //{
            label1.Visible      = false;
            label4.Visible      = false;
            UsernameTxt.Visible = false;
            PasswordTxt.Visible = false;
            LogonBtn.Visible    = false;
            CloseBtn.Visible    = false;

            MWDataManager.clsDataAccess _dbMan = new MWDataManager.clsDataAccess();
            _dbMan.ConnectionString = ConfigurationSettings.AppSettings["SQLConnectionStr"];

            _dbMan.SqlStatement = "select * from tbl_Users " +
                                  "where UserID = '" + Environment.UserName + "'";
            _dbMan.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement;
            _dbMan.queryReturnType    = MWDataManager.ReturnType.DataTable;
            _dbMan.ExecuteInstruction();
            DataTable SubA = _dbMan.ResultsDataTable;

            if (SubA.Rows.Count > 0)
            {
                this.Hide();
                Classes.MainScreen MainScreen = new Classes.MainScreen();
                this.Hide();
                //  this.Close();
                MainScreen.labName.Text     = Environment.UserName;
                MainScreen.LocalIndLbl.Text = "N";
                MainScreen.ShowDialog(this);
                this.Close();
            }
            else
            {
                label1.Visible      = true;
                label4.Visible      = true;
                UsernameTxt.Visible = true;
                PasswordTxt.Visible = true;
                LogonBtn.Visible    = true;
                CloseBtn.Visible    = true;

                progressPanel1.Visible = false;
                //MessageBox.Show("User not found. Please try again.", "Login Failed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                //LogonBtn.Enabled = true;
            }

            //}
            //else
            //{

            //    string[] lines = System.IO.File.ReadAllLines(@"C:\Mineware.Systems.HarmonyMinewasteLocalDataFiles\WriteLines.txt");

            //    // Display the file contents by using a foreach loop.

            //    foreach (string line in lines)
            //    {
            //        // Use a tab to indent each line of the file.

            //        if (line == Environment.UserName)
            //        {
            //            string UserExists = "true";

            //            Classes.MainScreen MainScreen = new Classes.MainScreen();
            //            //this.Hide();
            //            MainScreen.labName.Text = clsUserInfo.UserName;
            //            MainScreen.LocalIndLbl.Text = "Y";
            //            MainScreen.ShowDialog();
            //            //this.Close();

            //        }
            //    }


            //}
        }