public void Login()
        {
            T_SystemUser user = new T_SystemUser();

            using (UserDetail _userdetails = new UserDetail())
            {
                if (!string.IsNullOrWhiteSpace(txtUsername.Text) && !string.IsNullOrWhiteSpace(txtPassword.Text))
                {
                    user.Username          = txtUsername.Text;
                    user.EncryptedPassword = EncryptedPassword;
                    if (_userdetails.Login(user, ref ReturnMsg))
                    {
                        pnlLogin.Hide();
                        SystemProperties.ShowMessage.MessageInformation(ReturnMsg, "Login");
                        GetAccessRight(true);
                        tsOffline.Text      = "Online";
                        tsOffline.ForeColor = Color.Green;
                        tsUser.Text         = !string.IsNullOrWhiteSpace(UserInfo.DisplayName)?UserInfo.DisplayName:UserInfo.CompleteName;
                        tsTimeIN.Text       = UserInfo.TimeIn.ToString("MMM. dd, yyyy  |  HH:mm:ss tt");
                        tsPosition.Text     = UserInfo.JobTitle;
                        mtLogin.Enabled     = !(mtLogout.Enabled = true);
                        using (GetAPI getapi = new GetAPI())
                        {
                            getapi.CheckInternetConnection();
                        }
                        GetActiveSemester();
                    }
                    else
                    {
                        foreach (Form frm in this.MdiChildren)
                        {
                            if (!frm.Focused)
                            {
                                frm.Close();
                            }
                        }
                        tsOffline.ForeColor = Color.Red;
                        tsOffline.Text      = "Offline";
                        tsUser.Text         = "";
                        tsTimeIN.Text       = "";
                        tsPosition.Text     = "";
                        pnlLogin.Show();
                        GetAccessRight(false);
                        mtLogin.Enabled = !(mtLogout.Enabled = false);
                        SystemProperties.ShowMessage.MessageError(ReturnMsg, "Login");
                    }
                }
                else
                {
                    SystemProperties.ShowMessage.MessageError(string.Format("Please check your input below " + Environment.NewLine + Environment.NewLine + "Username" + Environment.NewLine + "Password"), SystemSetup.SystemName);
                }
            }
        }
        async void timer1_Tick(object sender, EventArgs e)
        {
            tsDateTime.Text = UserDetail.CurrDate().ToString("MMM. dd, yyyy |  HH:mm:ss tt");
            await Task.Run(() =>
            {
                string Internet   = string.Format(@"{0}\WifiInternetAccess.png", SystemSetup.ImagePath).Replace("\\", @"\");
                string NoInternet = string.Format(@"{0}\WifiNoInternetAccess.png", SystemSetup.ImagePath).Replace("\\", @"\");

                using (GetAPI getapi = new GetAPI())
                {
                    if (this.InvokeRequired)
                    {
                        this.Invoke((MethodInvoker) delegate
                        {
                            wifiPic.Image               = getapi.CheckInternetConnection() ? Image.FromFile(Internet) : Image.FromFile(NoInternet);//"Internet access":"No internet access";
                            lblInternetStatus.Text      = getapi.CheckInternetConnection() ? "Internet access" : "No internet access";
                            lblInternetStatus.ForeColor = getapi.CheckInternetConnection() ? Color.ForestGreen : Color.Red;
                        });
                    }
                }
            });
        }