示例#1
0
        private void btnCancelar_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult d = MessageBox.Show("Deseja realmente sair?", "Aviso", MessageBoxButtons.YesNo);
                if (d.ToString() == "Yes")
                {
                    frmLogin f = new frmLogin();
                    this.Close();
                }
            }
            catch
            {

            }
        }
示例#2
0
        static void Main()
        {
            string error = "";
            DataSet config = cargarArchivoConfiguracion(ref error);
            if (error == "")
            {
                string server = config.Tables[0].Rows[0]["Server"].ToString();
                string port = config.Tables[0].Rows[0]["Port"].ToString();
                string database = config.Tables[0].Rows[0]["DataBase"].ToString();
                string user = config.Tables[0].Rows[0]["Usuario"].ToString();
                string pass = config.Tables[0].Rows[0]["Password"].ToString();

                string cadenaConexion = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)" +
                                        "(HOST=" + server + ")(PORT=" + port + ")))(CONNECT_DATA=(SERVER=DEDICATED)" +
                                        "(SERVICE_NAME=" + database + ")));User Id=" + user +
                                        ";Password="******";";

                AccesoDatosOracle conexion = new AccesoDatosOracle(cadenaConexion);
                if (conexion.IsError == false)
                {
                    Application.EnableVisualStyles();
                     Application.SetCompatibleTextRenderingDefault(false);

                     frmLogin ofrmLogin = new frmLogin(conexion);
                     ofrmLogin.ShowDialog();
                     if (ofrmLogin.Aceptar)
                     {
                         oUsuarioLogueado = ofrmLogin.oUsuarioL;
                         Application.Run(new frmPrincipal(oUsuarioLogueado, conexion));
                     }
                 }
                 else
                 {
                     MessageBox.Show("Error conectando, detalles:" +
                                     conexion.ErrorDescripcion, "Error");
                 }
                }
                else
                {
                    MessageBox.Show(error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
        }
示例#3
0
        static void run()
        {
            frmLogin frmLogin = new frmLogin();
            frmMain frmMain = new frmMain(); ;
            Thread thread = new Thread(frmMain.KhoiTaoUserControl);
            thread.Start();

            if (frmLogin.ShowDialog() == DialogResult.OK)
            {

                frmMain.NhanVien = frmLogin.NhanVien;
                //try
                //{
                Application.Run(frmMain);
                //}
                //catch (Exception) {}
            }
            else
            {
                return;
            }
        }
 private void btnDangnhap_ItemClick(object sender, ItemClickEventArgs e)
 {
     frmLogin Login = new frmLogin();
     Login.Show();
     this.DialogResult = DialogResult.OK;
 }