///
        ///
        /// Xử lý thông tin và mật khẩu
        ///
        ///
        private void Dang_nhap_button_Click(object sender, EventArgs e)
        {
            bool       check = false;
            QuanLyTV   cmd   = new QuanLyTV();
            TaiKhoanNV x     = new TaiKhoanNV();
            var        ds    = from tmp in cmd.TaiKhoanNVs select tmp;

            foreach (var item in ds)
            {
                // MessageBox.Show("đâsd");
                if (item.TenDN == User_name.Text && item.MatKhau == Pass_word.Text)
                {
                    check = true;
                    HoSo nv = cmd.HoSoes.SingleOrDefault(p => p.MaNV == item.MaNV);
                    if (nv.BoPhan == "Thủ thư")
                    {
                        QLDG.QLDG qldg = new QLDG.QLDG();
                        qldg.NV = nv.MaNV;
                        this.Hide();
                        qldg.ShowDialog();
                        this.Show();
                    }
                    else if (nv.BoPhan == "Thủ kho")
                    {
                        QuanLyKho.QuanLyKho qlk = new QuanLyKho.QuanLyKho();
                        qlk.Mathukho = nv.MaNV;
                        this.Hide();
                        qlk.ShowDialog();
                        this.Show();
                    }
                    else if (nv.BoPhan == "Thủ trưởng")
                    {
                        FormThuTruong.ThuTruong boss = new FormThuTruong.ThuTruong();
                        boss.NV = nv.MaNV;
                        this.Hide();
                        boss.ShowDialog();
                        this.Show();
                    }
                    else if (nv.BoPhan == "Thủ quỹ")
                    {
                        WindowsFormsApp4.ThuQuy quy1 = new WindowsFormsApp4.ThuQuy();
                        quy1.NV = nv.MaNV;
                        this.Hide();
                        quy1.ShowDialog();
                        this.Show();
                    }
                }
            }

            if (!check)
            {
                MessageBox.Show("Sai mật khẩu hoặc tên đăng nhập", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                User_name.Text = "";
                Pass_word.Text = "";
                User_name.Focus();
            }
        }
        async void login_()
        {
            login.IsEnabled = false;
            if (User_name.Text == "" || User_name.Text == null)
            {
                DependencyService.Get <IMessage>().ShortAlert("Enter User Name !!");
                User_name.Focus();
                return;
            }
            if (pass_word.Text == "" || pass_word.Text == null)
            {
                DependencyService.Get <IMessage>().ShortAlert("Enter PassWord !!");
                pass_word.Focus();
                return;
            }
            var current = Connectivity.NetworkAccess;

            if (current == NetworkAccess.Internet)
            {
                if (CrossConnectivity.Current.IsConnected)
                {
                    try
                    {
                        App.user_name = "";
                        string tt      = "https://onlineexamination.a2hosted.com/OnlineExamination/get_user2.php?User_name=" + User_name.Text + " &User_pass="******"&tok=" + App.tok;
                        var    content = await App.con.GetStringAsync(tt);

                        // Temperatures5 obj = JsonConvert.DeserializeObject<Temperatures5>(content);
                        var tr = JsonConvert.DeserializeObject <IList <UserClass> >(content);


                        //   string json = App.con.GetStringAsync(tt).Result;
                        // var tr = JsonConvert.DeserializeObject<IList<UserClass>>(json);
                        if (tr is null)
                        {
                            DependencyService.Get <IMessage>().ShortAlert("User Name or Password Is Incorrect");
                            login.IsEnabled = true;
                            return;
                        }
                        if (tr.Count == 0)
                        {
                            DependencyService.Get <IMessage>().ShortAlert("User Name or Password Is Incorrect");
                            login.IsEnabled = true;
                            return;
                        }

                        App.user_name = User_name.Text;
                        ObservableCollection <UserClass> trends = new ObservableCollection <UserClass>(tr);
                        int fin = 0;
                        dt_course.Rows.Clear();
                        dt_user.Rows.Clear();

                        int User_kind = 0;
                        for (int i = 0; i < trends.Count; i++)
                        {
                            if (trends[i].Courses == null)
                            {
                                fin = 0;
                            }
                            else
                            {
                                fin = 1;
                            }
                            dt_user.Rows.Add(trends[i].Id, trends[i].UserName, trends[i].UserKind, trends[i].UserNickname);
                            fin       = trends[i].Fin;
                            User_kind = trends[i].UserKind;
                            if (trends[i].Courses != null)
                            {
                                foreach (var a in trends[i].Courses)
                                {
                                    dt_course.Rows.Add(a.CourseId, a.UserId, a.CourseName, a.Fin);
                                    //if (a.Exams != null)
                                    //{
                                    //    foreach (var b in a.Exams)
                                    //    {
                                    //        dt_exam.Rows.Add(b.Id, b.Dat, b.Tim, b.Des, b.Hor, b.Mark, b.Stat, b.CoursesId);
                                    //    }
                                    //}
                                }
                            }
                        }


                        //IList<string> List_tok = new List<string>();
                        //if (App.tok  != "") { List_tok.Add(App.tok); }
                        //if (List_tok.Count > 0) { App.firebase_send_noti(List_tok, "Welcome"); }

                        if (User_kind == 2)
                        {
                            await Shell.Current.Navigation.PushAsync(new AdminPage());
                        }
                        if (User_kind == 1)
                        {
                            await Shell.Current.Navigation.PushAsync(new Course());
                        }
                        if (User_kind == 0)
                        {
                            await Shell.Current.Navigation.PushAsync(new ExamView_s());
                        }
                    }
                    catch (Exception ee)
                    {
                        string tt = ee.Message;
                        DisplayAlert("", tt, "ok");
                    }
                }
                else
                {
                    DependencyService.Get <IMessage>().ShortAlert("تأكد من الاتصال بالانترنت");
                }
            }
            else
            {
                DependencyService.Get <IMessage>().ShortAlert("تأكد من الاتصال بالانترنت");
            }
            login.IsEnabled = true;
        }