Esempio n. 1
0
        //private void listBoxPlace_SelectionChanged(object sender, SelectionChangedEventArgs e)
        //{
        //    if (listBoxPlace.SelectedIndex == 0)
        //    {
        //        //规章制度管理
        //        //_index = "0";
        //        dgList.ItemsSource = OfficeItemsSource.Where(r => r.RULETYPER == 0).ToList();
        //        //Image image = new Image();
        //        //image.Width = 100;
        //        //image.Height = 90;

        //    }
        //    else
        //    {
        //        //文件管理
        //        //_index = "1";
        //        dgList.ItemsSource = OfficeItemsSource.Where(r => r.RULETYPER == 1).ToList();
        //        //Image image = new Image();
        //        //image.Width = 100;
        //        //image.Height = 90;
        //    }
        //}

        private void rulsgrid_DoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (RegluateSelected.RULETYPER == 0)
            {
                RegluateSelected.RuleFiles = FileManageHelper.GetRuleFiles(RegluateSelected.GUID).ToList();
                RulesAndRegulationsDialog dialog = new RulesAndRegulationsDialog(RegluateSelected);
                dialog.WindowTitle     = "修规章制度管理";
                dialog.AfterSaveEvent += () =>
                {
                    InitData();
                };
                dialog.ShowDialog(this);
            }
            else
            {
                RegluateSelected.RuleFiles = FileManageHelper.GetRuleFiles(RegluateSelected.GUID).ToList();
                FileManagementDialog dialog = new FileManagementDialog(RegluateSelected);
                dialog.WindowTitle     = "修改文件管理";
                dialog.AfterSaveEvent += () =>
                {
                    InitData();
                };
                dialog.ShowDialog(this);
            }
        }
Esempio n. 2
0
        public void InitData()
        {
            //获取树形结构
            List <RegulationsTreeInfo> nodes = new List <RegulationsTreeInfo>();

            OfficeItemsSource = FileManageHelper.GetRegulationsInfo(CurrentActivity.Guid).ToList();
            //dgList.ItemsSource = OfficeItemsSource;
            if (OfficeItemsSource == null || OfficeItemsSource.Count() == 0)
            {
                btnSave.IsEnabled = true;
            }
            //dgList.ItemsSource = OfficeItemsSource.Where(r => r.RULETYPER == this.listBoxPlace.SelectedIndex).ToList();
        }
Esempio n. 3
0
        /// <summary>
        /// 删除操作(支持批量删除)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                bool isdeleteOk = true;
                List <RegulationsInfo> checkFreq = (dgList.ItemsSource as List <RegulationsInfo>).Where(p => p.IsChecked == true).ToList();
                if (checkFreq.Count == 0)
                {
                    MessageBox.Show("请选择要删除的数据!"); return;
                }

                if (checkFreq.Count() > 0)
                {
                    foreach (RegulationsInfo item in checkFreq)
                    {
                        PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.RuleAndFileManage.I_CO_IA_RuleAndFile>
                            (channel =>
                        {
                            List <RuleFile> fileRules = item.RuleFiles;
                            //删除附件列表
                            if (fileRules != null && fileRules.Count() > 0)
                            {
                                bool monitorResult = channel.DeleteRulesFileMainID(item.GUID);//删除附件
                                if (monitorResult == false)
                                {
                                    return;
                                }
                                foreach (RuleFile file in fileRules)
                                {
                                    //删除客户端缓存的附件
                                    string savePath = FileManageHelper.GetPath() + file.FILEFORM.ToString();
                                    string xpsPath  = savePath.Substring(0, savePath.LastIndexOf(".")).ToString() + ".xps";
                                    if (System.IO.File.Exists(savePath))
                                    {
                                        System.IO.File.Delete(savePath);
                                        System.IO.File.Delete(xpsPath);
                                    }
                                }
                            }
                            else
                            {
                                // 当前附件实体列表为空,从数据中查附件,然后删除本地缓存的附件
                                RuleFile[] getRuleFiles = FileManageHelper.GetRuleFiles(item.GUID);
                                if (getRuleFiles.Count() > 0)
                                {
                                    foreach (RuleFile file in getRuleFiles)
                                    {
                                        //删除客户端缓存的附件
                                        string savePath = FileManageHelper.GetPath() + file.FILEFORM.ToString();
                                        string xpsPath  = savePath.Substring(0, savePath.LastIndexOf(".")).ToString() + ".xps";
                                        if (System.IO.File.Exists(savePath))
                                        {
                                            System.IO.File.Delete(savePath);
                                            System.IO.File.Delete(xpsPath);
                                        }
                                    }
                                }
                            }
                            bool deleteRegulate = channel.DeleteRegulationsInfo(item.GUID);//删除主表
                            if (deleteRegulate == false)
                            {
                                isdeleteOk = false;
                            }
                        });
                        if (isdeleteOk == false)
                        {
                            break;//主表删除失败
                        }
                    }
                    if (isdeleteOk == true)
                    {
                        MessageBox.Show("删除成功!", "提示", MessageBoxButton.OK);
                        InitData();
                    }
                    else
                    {
                        MessageBox.Show("删除失败!", "提示", MessageBoxButton.OK);
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }