Exemplo n.º 1
0
        /// <summary>
        /// Đăng nhập vào phần mềm
        /// </summary>
        public void DangNhap()
        {
            this.Hide();
            try
            {
                GlobalSettings.ConnectToDatabase();

                frmDangNhap frm = new frmDangNhap();
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    LoadGiaoDien();

                    this.Show();

                    timer.Start();
                }
            }
            catch
            {
                Reconnect();
            }
        }
 private void frmDangNhap_Load(object sender, EventArgs e)
 {
     try
     {
         if (!GlobalSettings.ConnectToDatabase())
         {
             MessageBox.Show("Không thể kết nối đến cơ sở dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             ReconnectDB();
         }
         else
         {
             LoadDuLieuChuongTrinh();
             KiemTraInsertMayTram();
             LoadDefaultValue();
             KiemTraVaCopyFileLaucherNew();
         }
     }
     catch (Exception ex)
     {
         O2S_Common.Logging.LogSystem.Error(ex);
     }
 }