예제 #1
0
        private void lblSqlServer_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            frmSqlLogin fSqlLogin = new frmSqlLogin();

            fSqlLogin.ShowDialog();
            fSqlLogin.Close();
            fSqlLogin.Dispose();
            fSqlLogin = null;
        }
예제 #2
0
 private void mnuDBLogin_Click(object sender, EventArgs e)
 {
     frmSqlLogin frm = new frmSqlLogin();
     if (frm.ShowDialog() == DialogResult.Cancel)
     {
         frm.Close();
         frm = null;
         return;
     }
     else
     {
         while (!frm.Success)
         {
             frm.Close();
             frm.ShowDialog();
         }
     }
     frm.Close();
     frm = null;
     frmMain_Load(this, null);
 }
예제 #3
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            if (File.Exists(Application.StartupPath + "\\scheduler.config"))
            {
                DataSet ds = new DataSet();
                ds.ReadXml(Application.StartupPath + "\\scheduler.config", XmlReadMode.ReadSchema);

                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        Common.FontName = (string) ds.Tables[0].Rows[0][0];
                        Common.FontSize = (float) Convert.ToDouble(ds.Tables[0].Rows[0][1].ToString());

                        SetNavBarStyle();
                    }
                }
            }

            bool boolSuccess = false;
            Visible = false;
            Refresh();

            frmSplash fSplash = null;
            try
            {
                fSplash = new frmSplash();
                frmUserLogin fLogin = new frmUserLogin();
                fSplash.Show();
                fSplash.Refresh();
                Thread.Sleep(100);

                boolSuccess = DoDataConnect();
                if (boolSuccess)
                {
                    WindowState = FormWindowState.Maximized;
                    //Global.SBarMain = Me.sbarMain

                    //Dispose the Splash Screen
                    fSplash.Close();
                    fSplash.Dispose();

                    navBar.Refresh();
                    Refresh();

                    //Open the Login Dialog
                    Text = "Kurdyla Scheduler (" + Common.GetShortVersionInfo() + ")";
                    if (fLogin.ShowDialog() == DialogResult.OK)
                    {
                        sPnlDate.Text = DateTime.Now.ToString();
                        Visible = true;
                        tmrMain.Enabled = true;

                        //Admin can vie/add/modify user
                        if (Common.LogonType == 0 || Common.LogonType == 2)
                        {
                            navBarGroup3.Visible = false;
                            mnuItemUser.Visible = false;
                        }
                        if (Common.LogonType == 2)
                        {
                            navBarGroup4.Visible = false;  // read-only user can't access Reports
                            tbtnDelete.Enabled = false;
                            tbtnNew.Enabled = false;
                            tbtnDuplicate.Enabled = false;

                        }
                        Refresh();
                        Common.LockWindow(Handle);

                        //Set the Status Bar
                        sPnlLogon.Text = "Logon User : "******"Server : " + Common.SqlServer;

                        //Open default Client Page at Startup
                        nBarClient_LinkClicked(null, null);
                        //nBarProgram_LinkClicked(null, null);
                        //navBarItem2_LinkClicked(null, null);
                        //navBarReportBillingInfo_LinkClicked(null, null);
                        Common.UnLockWindow();
                        Refresh();

                        return;
                    }
                    else
                    {
                        tmrMain.Enabled = false;
                        Application.Exit();
                    }
                }
            }
            finally
            {
                if (!boolSuccess)
                {
                    fSplash.Close();
                    fSplash.Dispose();
                    frmSqlLogin fLogin = new frmSqlLogin();
                    if (fLogin.ShowDialog() == DialogResult.Cancel)
                    {
                        fLogin.Close();
                        fLogin.Dispose();
                        fLogin = null;
                        Application.Exit();
                    }
                    else
                    {
                        while (fLogin.Success == false)
                        {
                            fLogin.Close();
                            fLogin.ShowDialog();
                        }
                    }
                    if (fLogin != null)
                    {
                        fLogin.Close();
                        fLogin.Dispose();
                        frmMain_Load(this, null);
                    }
                }

                Visible = true;
            }
        }
예제 #4
0
 private void lblSqlServer_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
 {
     frmSqlLogin fSqlLogin=new frmSqlLogin();
     fSqlLogin.ShowDialog();
     fSqlLogin.Close();
     fSqlLogin.Dispose();
     fSqlLogin=null;
 }