Ejemplo n.º 1
0
 private void _modelAuth_LoadUserComplete(object sender, LoadUserOperationEventArgs e)
 {
     try
     {
         if (e.HasError)
         {
             MessageCustomize.Show("Main: " + e.Error.Message + "-" + e.Error.StackTrace);
             ErrorProcess();
         }
         else
         {
             if (e.LoginOp.User.Identity.Name == string.Empty)
             {
                 CallDialog.Show(this, ViewTypes.LoginView, c =>
                 {
                     if (c == MessageBoxResult.OK)
                     {
                         _modelAuth.LoadUserAsync();
                     }
                 });
             }
             else
             {
                 _itemLogin = e.LoginOp.User as LoginUser;
                 ReloadData();
             }
         }
     }
     catch (Exception ex)
     {
         MessageCustomize.Show(ex.Message);
         ErrorProcess();
     }
 }
Ejemplo n.º 2
0
 private void _modelAuth_LogoutComplete(object sender, LogoutOperationEventArgs e)
 {
     try
     {
         if (e.HasError)
         {
             MessageCustomize.Show(e.Error.Message);
             ErrorProcess();
         }
         else
         {
             SystemConfig.UserID      = -1;
             SystemConfig.UserName    = string.Empty;
             SystemConfig.UserGroupID = -1;
             if (SetFocus != null)
             {
                 SetFocus(0, null);
             }
             CallDialog.Show(this, ViewTypes.LoginView, c =>
             {
                 if (c == MessageBoxResult.OK)
                 {
                     _modelAuth.LoadUserAsync();
                 }
             });
         }
     }
     catch (Exception ex)
     {
         MessageCustomize.Show(ex.Message);
         ErrorProcess();
     }
 }
Ejemplo n.º 3
0
        private void _modelAuth_LoadUserComplete(object sender, LoadUserOperationEventArgs e)
        {
            try
            {
                if (e.HasError)
                {
                    MessageCustomize.Show("Main: " + e.Error.Message + "-" + e.Error.StackTrace);
                    ErrorProcess();
                }
                else
                {
                    if (e.LoginOp.User.Identity.Name == string.Empty)
                    {
                        CallDialog.Show(this, ViewTypes.LoginView, c =>
                        {
                            if (c == MessageBoxResult.OK)
                            {
                                _modelAuth.LoadUserAsync();
                            }
                        });
                    }
                    else
                    {
                        LoginUser ItemLogin = e.LoginOp.User as LoginUser;

                        SystemConfig.UserID      = ItemLogin.UserID;
                        SystemConfig.UserName    = ItemLogin.Name;
                        SystemConfig.DisplayName = ItemLogin.LastName + " " + ItemLogin.FirstName;
                        SystemConfig.UserType    = ItemLogin.UserType;
                        SystemConfig.CurrentDate = DateTime.Now;
                        if (ItemLogin.Settings.ContainsKey(KeySetting.Theme))
                        {
                            SystemConfig.Theme = ItemLogin.Settings[KeySetting.Theme];
                        }
                        if (ItemLogin.Settings.ContainsKey(KeySetting.PagingSize))
                        {
                            SystemConfig.PagingSize = Convert.ToInt32(ItemLogin.Settings[KeySetting.PagingSize]);
                        }
                        ListAuth = null;

                        if (SetFocus != null)
                        {
                            SetFocus(2, null);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageCustomize.Show(ex.Message);
                ErrorProcess();
            }
        }
Ejemplo n.º 4
0
        private void OnMenuItemCommand(string menuName)
        {
            try
            {
                switch (menuName)
                {
                case "Exit":
                    MessageCustomize.Show("Bạn muốn thoát ra ?", "THOÁT", MessageBoxButton.OKCancel, MessageImage.Question, c =>
                    {
                        if (c == MessageBoxResult.OK)
                        {
                            if (SetFocus != null)
                            {
                                SetFocus(0, null);
                            }
                            _modelAuth.LogoutAsync();
                        }
                    });

                    break;

                case ViewTypes.ChangePasswordView: CallDialog.Show(this, ViewTypes.ChangePasswordView, null);
                    break;

                case ViewTypes.UserSettingView: CallDialog.Show(this, ViewTypes.UserSettingView, c =>
                    {
                        if (c == MessageBoxResult.OK)
                        {
                            MessageCustomize.Show("Bạn muốn thay đổi giao diện ?", "THIẾT LẬP", MessageBoxButton.OKCancel, MessageImage.Question, d =>
                            {
                                if (d == MessageBoxResult.OK)
                                {
                                    if (SetFocus != null)
                                    {
                                        SetFocus(0, null);
                                        SetFocus(2, null);
                                    }
                                }
                            });
                        }
                    });
                    break;

                default: AppMessages.ChangeMenuItemMessage.Send(menuName);
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageCustomize.Show(ex.Message);
            }
        }
Ejemplo n.º 5
0
 private void OnParentClickCommand()
 {
     try
     {
         CallDialog.Show(this, ViewTypes.EditChooseClassView, c =>
         {
             if (c == MessageBoxResult.OK)
             {
                 ParentName = ItemParent.TenLop;
             }
         });
     }
     catch (Exception ex)
     {
         MessageCustomize.Show(ex.Message);
     }
 }
Ejemplo n.º 6
0
 private void OnMonHocClickCommand()
 {
     try
     {
         CallDialog.Show(this, ViewTypes.EditChooseSubjectView, c =>
         {
             if (c == MessageBoxResult.OK)
             {
                 MonHoc = ItemMonHoc.TenMonHoc;
             }
         });
     }
     catch (Exception ex)
     {
         MessageCustomize.Show(ex.Message);
     }
 }
Ejemplo n.º 7
0
 private void OnAddClickCommand()
 {
     try
     {
         SelectedItem = null;
         CallDialog.Show(this, ViewTypes.EditDepartmentView, c =>
         {
             if (c == MessageBoxResult.OK)
             {
                 ReloadData();
             }
         });
     }
     catch (Exception ex)
     {
         MessageCustomize.Show(ex.Message);
     }
 }
Ejemplo n.º 8
0
 private void OnUploadClickCommand()
 {
     try
     {
         CallDialog.Show(this, ViewTypes.UploadSubjectView, c =>
         {
             if (c == MessageBoxResult.OK)
             {
                 _listData = null;
                 _modelTrain.GetListSubjectAsync();
             }
         });
     }
     catch (Exception ex)
     {
         MessageCustomize.Show(ex.Message);
     }
 }
Ejemplo n.º 9
0
        private void OnMenuItemCommand(string menuName)
        {
            try
            {
                switch (menuName)
                {
                case "Exit":
                    _modelAuth.LogoutAsync();
                    break;

                case "ChangePasswordView": CallDialog.Show(this, ViewTypes.ChangePasswordView, null);
                    break;

                default: AppMessages.ChangeMenuItemMessage.Send(menuName);
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageCustomize.Show(ex.Message);
            }
        }
Ejemplo n.º 10
0
 private void OnEditClickCommand()
 {
     try
     {
         if (SelectedItem != null)
         {
             CallDialog.Show(this, ViewTypes.EditDepartmentView, c =>
             {
                 if (c == MessageBoxResult.OK)
                 {
                     ReloadData();
                 }
             });
         }
         else
         {
             MessageCustomize.Show("Bạn chưa chọn khoa");
         }
     }
     catch (Exception ex)
     {
         MessageCustomize.Show(ex.Message);
     }
 }