Пример #1
0
 /// <summary>
 /// Checks the login.
 /// </summary>
 private void Logining()
 {
     //Loai user
     string loai = string.Empty;
     BLL_USERS bllusr = new BLL_USERS();
     if (bllusr.checkLogin(out loai, this.txtEmail.Text, this.txtPassword.Password) == 1)
     {
         var currentView = SystemNavigationManager.GetForCurrentView();
         //hide back button on title
         currentView.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
         //Kiểm tra loại user
         if (loai == "Admin") //loại là admin
         {
             Frame.Navigate(typeof(AdminPage));
         }
         else //Loại là user
         {
             Frame.Navigate(typeof(MainPage));
         }
     }
     else
     {
         var dialog = new MessageDialog("Sai email và mật khẩu đăng nhập","Xảy ra lỗi khi đăng nhập");
         dialog.ShowAsync();         
     }
 }
        private async void createNewAccount()
        {
            if (this.txtEmail.Text != "" && this.txtPassword.Password != "" &&
                this.txtRePassword.Password != "" && this.txtFirstName.Text != "" && this.txtLastName.Text != "")
            {
                if (this.txtPassword.Password != txtRePassword.Password)
                {

                }
                else //Create
                {
                    BLL_USERS bll = new BLL_USERS();
                    if (bll.insertUser(new USERS(
                        this.txtEmail.Text,
                        this.txtFirstName.Text,
                        this.txtLastName.Text,
                        this.txtPassword.Password,
                        "User",
                        false)) == 1)
                    {
                        //Hiển thị thông báo
                        //// Get a toast XML template
                        //XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText01);

                        //// Fill in the text elements
                        //XmlNodeList stringElements = toastXml.GetElementsByTagName("text");
                        //for (int i = 0; i < stringElements.Length; i++)
                        //{
                        //    stringElements[i].AppendChild(toastXml.CreateTextNode("Đăng ký thành công"));
                        //}

                        //// Create the toast and attach event listeners
                        //ToastNotification toast = new ToastNotification(toastXml);

                        //// Show the toast. Be sure to specify the AppUserModelId on your application's shortcut!
                        //ToastNotificationManager.CreateToastNotifier().Show(toast);
                        var dialog = new MessageDialog("Đăng ký thành công");
                        dialog.ShowAsync();
                        //Chuyển page
                        Frame frame = Window.Current.Content as Frame;
                        var currentView = SystemNavigationManager.GetForCurrentView();
                        //hide back button on title
                        currentView.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
                        frame.Navigate(typeof(Login));
                    }
                    else
                    {

                    }
                }
            }
        }
Пример #3
0
 private async System.Threading.Tasks.Task Deleting()
 {
     BLL_USERS blluser = new BLL_USERS();
     if (blluser.deleteUser(selectedUser.email) == 0)
     {
         var dialog = new MessageDialog("Đã xóa " + selectedUser.email);
         await dialog.ShowAsync();
     }
     else if (blluser.deleteUser(selectedUser.email) == 1)
     {
         var dialog = new MessageDialog("Có lỗi hoạt không tìm thấy user");
         await dialog.ShowAsync();
     }
     else
     {
         var dialog = new MessageDialog("Không thể xóa tài khoản Admin");
         await dialog.ShowAsync();
     }
 }
Пример #4
0
 private async void CommandHander(IUICommand command)
 {
     var commandLabel = command.Label;
     switch (commandLabel)
     {
         case "Yes":
             {
                 await Deleting();
                 BLL_USERS blluser = new BLL_USERS();
                 this.DataContext = blluser.getUser();
             }                   
             break;
         case "No":
             break;
     }
 }
Пример #5
0
 private void Page_Loading(FrameworkElement sender, object args)
 {
     BLL_USERS blluser = new BLL_USERS();
     this.DataContext = blluser.getUser();
 }