示例#1
0
        private void User_Right_Insert()
        {
            try
            {
                if (c_change)
                {
                    User_RightsController _User_RightsController = new User_RightsController();

                    List <User_RightsInfo> _lstRight = new List <User_RightsInfo>();

                    foreach (User_FunctionsInfo item in c_arrFunction)
                    {
                        if (item.authcode != 0)
                        {
                            User_RightsInfo _User_RightsInfo = ConvertToUser_RightsInfo(item, c_UsersInfo.User_Id);
                            _User_RightsInfo.User_Name = c_UsersInfo.User_Name;
                            _lstRight.Add(_User_RightsInfo);
                        }
                    }
                    if (_lstRight.Count > 0)
                    {
                        MessageBoxResult result1 = NoteBox.Show("Bạn có muốn cập nhật hay không?", "", NoteBoxLevel.Question);
                        if (result1 == MessageBoxResult.Yes)
                        {
                            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;

                            _User_RightsController.User_Rights_DelByUser(c_UsersInfo.User_Name);
                            _User_RightsController.User_Rights_Insert_Barth(_lstRight);

                            Mouse.OverrideCursor = null;

                            c_ok = 1;
                            NoteBox.Show("Cập nhật dữ liệu thành công", "", NoteBoxLevel.Note);
                            this.Close();
                        }
                    }
                    else
                    {
                        Mouse.OverrideCursor = null;
                        NoteBox.Show("Bạn chưa đặt quyền cho chức năng nào", "", NoteBoxLevel.Error);
                    }
                }
                else
                {
                    Mouse.OverrideCursor = null;
                    NoteBox.Show("Bạn chưa thực hiện thay đổi quyền nào", "", NoteBoxLevel.Error);
                }
            }
            catch (Exception ex)
            {
                Mouse.OverrideCursor = null;
                ErrorLog.log.Error(ex.ToString());
                NoteBox.Show("Cập nhật dữ liệu không thành công", "Lỗi", NoteBoxLevel.Error);
            }
        }
示例#2
0
        private void User_Right_Insert()
        {
            try
            {
                if (c_change)
                {
                    User_RightsController _User_RightsController = new User_RightsController();

                    ArrayList arrRight = new ArrayList();
                    foreach (User_FunctionsInfo item in c_arrFunction)
                    {
                        if (item.right != "000000")
                        {
                            User_RightsInfo _User_RightsInfo = ConvertToUser_RightsInfo(item, c_UsersInfo.User_Id);
                            arrRight.Add(_User_RightsInfo);
                        }
                    }
                    if (arrRight.Count > 0)
                    {
                        MessageBoxResult result1 = NoteBox.Show("Bạn có muốn sửa thông tin này hay không?", "Thông báo", NoteBoxLevel.Question);
                        if (result1 == MessageBoxResult.Yes)
                        {
                            _User_RightsController.User_Rights_DelByUser(c_UsersInfo.User_Name);
                            _User_RightsController.User_Rights_Insert_Barth(arrRight, c_UsersInfo.User_Name);
                            User_Controller _usC0n = new User_Controller();
                            _usC0n.User_Change_SetRight(c_UsersInfo.User_Id);
                            NoteBox.Show("Cập nhật dữ liệu thành công");
                            this.Close();
                        }
                    }
                    else
                    {
                        NoteBox.Show("Bạn chưa đặt quyền cho chức năng nào", "Thông báo", NoteBoxLevel.Error);
                    }
                }
                else
                {
                    NoteBox.Show("Bạn chưa thực hiện thay đổi quyền nào", "Thông báo", NoteBoxLevel.Error);
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
                NoteBox.Show("Cập nhật dữ liệu không thành công", "Lỗi", NoteBoxLevel.Error);
            }
        }