Ejemplo n.º 1
0
        private void OnDeleteContextMenuClick(object sender, RoutedEventArgs e)
        {
            var fse = mouseElement.DataContext as FileSystemEntity;

            if (fse == null)
            {
                return;
            }

            if (!CustomMessageBox.Ask(string.Format("您确定要删除{0}[{1}]吗?该操作不可恢复,请谨慎操作!", EnumHelper.GetName(fse.Type.GetType(), fse.Type), fse.Name)))
            {
                return;
            }
            BusyIndicator1.IsBusy      = true;
            BusyIndicator1.BusyContent = "正在执行...";
            if (fse.Type == FileSystemEntityType.Folder)
            {
                docContext.DeleteFolder(fse.FolderId, AuthenticateStatus.CurrentUser.UserId, obj =>
                {
                    BusyIndicator1.IsBusy = false;
                    if (Utility.Utility.CheckInvokeOperation(obj))
                    {
                        if (obj.Value == -2)
                        {
                            CustomMessageBox.Show("当前文件夹不为空,不能删除!");
                        }
                        else if (obj.Value > 0)
                        {
                            OpenFolder(FolderId);
                        }
                        else
                        {
                            CustomMessageBox.Alert("删除文件夹失败,错误码:" + obj.Value);
                        }
                    }
                }, null);
            }
            else
            {
                docContext.DeleteFile(fse.FileId, fse.FileRevision, obj =>
                {
                    BusyIndicator1.IsBusy = false;
                    if (Utility.Utility.CheckInvokeOperation(obj))
                    {
                        if (obj.Value == -2)
                        {
                            CustomMessageBox.Show("没有找到要删除的文件信息!");
                        }
                        else if (obj.Value > 0)
                        {
                            OpenFolder(FolderId);
                        }
                        else
                        {
                            CustomMessageBox.Alert("删除文件失败,错误码:" + obj.Value);
                        }
                    }
                }, null);
            }
        }
Ejemplo n.º 2
0
        //点击删除文件按钮
        private void OnDeleteFileButtonClick(object sender, RoutedEventArgs e)
        {
            if (UploadedFilesList.SelectedItems.Count < 1)
            {
                return;
            }
            var wfile = UploadedFilesList.SelectedItem as WorkflowFileInfo;

            if (wfile != null && wfile.DocumentInfo != null)
            {
                var doc        = wfile.DocumentInfo;
                var removeItem =
                    ArchiveFlow.Files.FirstOrDefault(o => o.DocumentInfo.FileName != null && o.DocumentInfo.UniqeName == doc.UniqeName);
                if (removeItem != null)
                {
                    ArchiveFlow.Files.Remove(removeItem);
                }
                if (doc.Identity > 0 && CustomMessageBox.Ask(string.Format("确定要删除文件{0}吗", doc.FileName)))
                {
                    docContext.DeleteFile(doc.UniqeName, doc.Revision);
                }
                UploadedFilesList.ItemsSource = null;
                UploadedFilesList.ItemsSource = ArchiveFlow.Files;
            }
        }
Ejemplo n.º 3
0
        private void OnDeleteFlowButtonClick(object sender, MouseButtonEventArgs e)
        {
            var img = sender as Image;

            if (img == null)
            {
                return;
            }
            var flow = img.DataContext as ArchiveWorkflow;

            if (flow != null && CustomMessageBox.Ask(string.Format("确定要删除流程[{0}]吗?该操作会将相应文件同时删除!", flow.FlowTitle)))
            {
                flowContext.DeleteArchiveWorkFlow(flow.FlowId, obj =>
                {
                    if (Utility.Utility.CheckInvokeOperation(obj))
                    {
                        if (obj.Value > 0)
                        {
                            LoadArchiveWorkflow(AuditStatus.Draft);
                        }
                        else
                        {
                            CustomMessageBox.Show("删除流程失败,请与管理员联系!");
                        }
                    }
                }, null);
            }
        }
Ejemplo n.º 4
0
 private void OnDeleteUseRoelButtonClick(object sender, RoutedEventArgs e)
 {
     if (UserRolesList.SelectedItem != null && CustomMessageBox.Ask("确定要删除该用户的角色吗?"))
     {
         SelectedRoles.Remove(UserRolesList.SelectedItem as UserRoleRel);
         UserRolesList.ItemsSource = null;
         UserRolesList.ItemsSource = SelectedRoles;
     }
 }
 private void OnDeleteRoleButtonClick(object sender, RoutedEventArgs e)
 {
     if (SysRoleGrid.SelectedItem != null && CustomMessageBox.Ask("确定要删除该角色吗?"))
     {
         var role = SysRoleGrid.SelectedItem as SystemRole;
         if (role != null)
         {
             roleContext.DeleteRole(role, (obj) => LoadSystemRoles(SysRolePager.PageIndex + 1), null);
         }
     }
 }
Ejemplo n.º 6
0
 private void OnDeleteUserButtonClick(object sender, RoutedEventArgs e)
 {
     if (SysUserGrid.SelectedItem != null && CustomMessageBox.Ask("确定要删除该用户吗?"))
     {
         var user = SysUserGrid.SelectedItem as SystemUser;
         if (user != null)
         {
             userContext.DeleteUser(user, (obj) => LoadSystemUsers(SysUserPager.PageIndex + 1), null);
         }
     }
 }
 private void OnDeleteButtonClick(object sender, RoutedEventArgs e)
 {
     if (FileInfo == null)
     {
         return;
     }
     if (CustomMessageBox.Ask(string.Format("您确定要删除文件[{0}]吗", FileInfo.FileName)) && _fileDeletedEventHandler != null)
     {
         _fileDeletedEventHandler(this, null);
     }
 }
Ejemplo n.º 8
0
        private void OnCreateFolderButtonClick(object sender, RoutedEventArgs e)
        {
            var orgId = OrganizationTreeView.SelectedValue as String;

            if (!string.IsNullOrEmpty(orgId))
            {
                var    source = FileEntityListBox.ItemsSource as List <FileSystemEntity> ?? new List <FileSystemEntity>();
                string strFolderName;
                while (true)
                {
                    strFolderName = CustomMessageBox.Prompt("请输入文件夹名称");
                    if (string.IsNullOrEmpty(strFolderName))
                    {
                        return;
                    }
                    if (source.Any(o => o.Name == strFolderName && o.Type == FileSystemEntityType.Folder))
                    {
                        if (CustomMessageBox.Ask("文件夹名重复,是否重新指定?"))
                        {
                            continue;
                        }
                        return;
                    }
                    break;
                }
                var folder = new DocumentFolder
                {
                    FolderId       = 0,
                    ParentId       = FolderId,
                    Name           = strFolderName,
                    CreatedBy      = AuthenticateStatus.CurrentUser.UserId,
                    CreateTime     = DateTime.Now,
                    OrganizationId = orgId,
                    Status         = ActiveStatus.Active
                };
                BusyIndicator1.IsBusy      = true;
                BusyIndicator1.BusyContent = "正在创建文件夹...";
                documentContext.CreateFolder(folder, obj =>
                {
                    BusyIndicator1.IsBusy = false;
                    if (Utility.Utility.CheckInvokeOperation(obj))
                    {
                        OpenFolder(FolderId);
                    }
                }, null);
            }
        }
Ejemplo n.º 9
0
        private void OnInputFolderNameOk(object sender, EventArgs e)
        {
            var prompt = sender as PromptWindow;

            if (prompt != null)
            {
                prompt.OnOk -= OnInputFolderNameOk;
                string strFolderName = prompt.InputText;
                if (string.IsNullOrEmpty(strFolderName))
                {
                    return;
                }
                var source = FileBrowseListBox.ItemsSource as List <FileSystemEntity> ?? new List <FileSystemEntity>();
                if (source.Any(o => o.Name == strFolderName && o.Type == FileSystemEntityType.Folder))
                {
                    if (CustomMessageBox.Ask("文件夹名重复,是否重新指定?"))
                    {
                        OnCreateFolderButtonClick(null, null);
                    }
                }
                else
                {
                    var folder = new DocumentFolder
                    {
                        FolderId       = 0,
                        ParentId       = FolderId < 0 ? 0 : FolderId,
                        Name           = strFolderName,
                        CreatedBy      = AuthenticateStatus.CurrentUser.UserId,
                        CreateTime     = DateTime.Now,
                        OrganizationId = null,
                        Status         = ActiveStatus.Active
                    };
                    BusyIndicator1.IsBusy      = true;
                    BusyIndicator1.BusyContent = "正在创建文件夹...";
                    docContext.CreateFolder(folder, obj =>
                    {
                        BusyIndicator1.IsBusy = false;
                        if (Utility.Utility.CheckInvokeOperation(obj))
                        {
                            OpenFolder(FolderId);
                        }
                    }, null);
                }
                prompt.Close();
            }
        }
Ejemplo n.º 10
0
        private void OnDeleteRecordButtonClick(object sender, RoutedEventArgs e)
        {
            if (!CustomMessageBox.Ask("您确定要删除该文档发布记录吗?该操作不可恢复!"))
            {
                return;
            }
            var btn = sender as Button;

            if (btn != null && btn.DataContext != null)
            {
                var dr = btn.DataContext as DocumentRelease;
                if (dr != null)
                {
                    docContext.RemoveDocumentRelease(dr, obj => LoadReleaseHistory(), null);
                }
            }
        }
Ejemplo n.º 11
0
 //注销事件
 private void OnLogoutButtonClick(object sender, RoutedEventArgs e)
 {
     if (!CustomMessageBox.Ask("确定要退出系统吗?"))
     {
         return;
     }
     if (Application.Current.IsRunningOutOfBrowser)
     {
         Application.Current.MainWindow.Close();
     }
     else
     {
         ContentFrame.Navigate(new Uri("", UriKind.Relative));
         AuthenticateStatus.CurrentUser = null;
         Content = new Login();
     }
 }