private async void OnSelectedProject(object sender, RowEventArgs e)
        {
            DataRow row = (gProjects.ItemsSource as DataTable).Rows[e.RowHandle];

            if (row == null)
            {
                return;
            }


            Services.SetInformation("MinYOB", row["MinYOB"]);
            Services.SetInformation("ProjectNo", row["ProjectNo"]);
            Services.SetInformation("ProjectName", row["ProjectNo"]);
            Services.SetInformation("MaxYOB", row["MaxYOB"]);
            Services.SetInformation("AcceptGender", row["AcceptGender"]);
            Services.SetInformation("MonthICMA", row["MonthICMA"]);

            Services.SetInformation("CityHandle", row["CityHandle"]);
            var homePage = new TabbedPage();

            var _RespondentProfileListPage = new RespondentProfileListPage(Services, row["ProjectID"].ToString());

            homePage.Children.Add(_RespondentProfileListPage);
            homePage.Children.Add(new QuotaControlPage(Services, row["ProjectID"].ToString()));


            homePage.CurrentPageChanged += (object obj, EventArgs evt) =>
            {
                var i = homePage.Children.IndexOf(homePage.CurrentPage);
                if (i == 0)
                {
                    (homePage.CurrentPage as RespondentProfileListPage).Process();
                }
                if (i == 1)
                {
                    (homePage.CurrentPage as QuotaControlPage).Process();
                }
            };

            Application.Current.MainPage = new NavigationPage(homePage);
        }
        public async void btnLogin_Clicked(object sender, EventArgs args)
        {
            UserDialogs.Instance.ShowLoading("Đang đăng nhập...");

            var query = DataAccess.DataQuery.Create("Security", "ws_Session_AuthenticateFromMobile", new
            {
                Username     = txtUsername.Text.Trim(),
                PasswordHash = DependencyService.Get <IMd5HashExtensions>().GetMd5Hash(txtPassword.Text.Trim()),
                FacID        = "1"
            });

            var ds = Services.Execute(query);

            if (DependencyService.Get <IDataSetExtension>().IsNull(ds) == true)
            {
                UserDialogs.Instance.HideLoading();
                await DisplayAlert("Lỗi đăng nhập", Services.LastError, "Thử lại");

                return;
            }

            if (ds.Tables[0].Rows.Count == 0)
            {
                UserDialogs.Instance.HideLoading();
                await DisplayAlert("Lỗi phân quyền", "Bạn chưa được phân quyền dự án", "Thử lại");

                return;
            }

            if (ds.Tables[0].Rows[0][0].ToString().ToUpper() != "OK")
            {
                UserDialogs.Instance.HideLoading();
                await DisplayAlert("Lỗi đăng nhập", ds.Tables[0].Rows[0][0].ToString().ToUpper(), "Thử lại");

                return;
            }

            Services.SetInformation("UserID", ds.Tables[0].Rows[0]["UserID"].ToString());

            if (chkRememberPassword.Checked == true)
            {
                await Save(txtUsername.Text.Trim(), txtPassword.Text.Trim());
            }
            else
            {
                await Save("", "");
            }

            //if(Authenticated!=null)
            //    {
            //      Authenticated(this, null);
            //    }

            if (ds.Tables[0].Rows.Count == 1)
            {
                //await DisplayAlert("Dự án", string.Format("Bạn đang thực hiện dự án {0}",ds.Tables[0].Rows[0]["ProjectName"].ToString()), "Ok");
                Services.SetInformation("MinYOB", ds.Tables[0].Rows[0]["MinYOB"]);
                Services.SetInformation("ProjectNo", ds.Tables[0].Rows[0]["ProjectNo"]);
                Services.SetInformation("ProjectName", ds.Tables[0].Rows[0]["ProjectNo"]);
                Services.SetInformation("MaxYOB", ds.Tables[0].Rows[0]["MaxYOB"]);
                Services.SetInformation("AcceptGender", ds.Tables[0].Rows[0]["AcceptGender"]);
                Services.SetInformation("MonthICMA", ds.Tables[0].Rows[0]["MonthICMA"]);
                Services.SetInformation("CityHandle", ds.Tables[0].Rows[0]["CityHandle"]);
                var row = ds.Tables[0].Rows[0];


                var homePage = new TabbedPage();

                var _RespondentProfileListPage = new RespondentProfileListPage(Services, row["ProjectID"].ToString());

                homePage.Children.Add(_RespondentProfileListPage);
                homePage.Children.Add(new QuotaControlPage(Services, row["ProjectID"].ToString()));


                homePage.CurrentPageChanged += (object obj, EventArgs evt) =>
                {
                    var i = homePage.Children.IndexOf(homePage.CurrentPage);
                    if (i == 0)
                    {
                        (homePage.CurrentPage as RespondentProfileListPage).Process();
                    }
                    if (i == 1)
                    {
                        (homePage.CurrentPage as QuotaControlPage).Process();
                    }
                };

                Application.Current.MainPage = new NavigationPage(homePage);
            }
            else
            {
                var page = new ProjectListPage(Services, ds.Tables[0]);
                Application.Current.MainPage = new NavigationPage(page);
            }
            UserDialogs.Instance.HideLoading();
        }