예제 #1
0
        /// <summary>
        /// Scripter : YONGTOK KIM
        /// SCRIPTED DATE : 17 Jan 2012
        /// MOVE TO MAIN WINDOW AFTER LOGIN
        /// </summary>

        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // Login
            LogIn login = new LogIn();

            // success to login
            if (login.ShowDialog() == true)
                new MainWindow().ShowDialog();

            Shutdown();
        }
예제 #2
0
        // Check whether db connect
        private void DbConnectCheck()
        {
            StringBuilder errorMessages = new StringBuilder();
            try
            {
                if (!dbLogin)
                {

                    // Check user privilege
                    secdivDataContext db = new secdivDataContext();

                    if (db.DatabaseExists() == true)
                    {
                        LogIn login = new LogIn(db.DatabaseExists());
                        // Toggle upload and office button

                        if (login.ShowDialog() == true)
                            dbLogin = true;
                    }
                    else
                        MessageBox.Show("Database couldn't find!!");
                }
            }
            catch (SqlException ex)
            {
                for (int i = 0; i < ex.Errors.Count; i++)
                {
                    errorMessages.Append("Index #" + i + "\n" +
                        "Message: " + ex.Errors[i].Message + "\n" +
                        "LineNumber: " + ex.Errors[i].LineNumber + "\n" +
                        "Source: " + ex.Errors[i].Source + "\n" +
                        "Procedure: " + ex.Errors[i].Procedure + "\n");

                }
                MessageBox.Show(errorMessages.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }