Beispiel #1
0
        async Task Delete()
        {
            if (_info.Usage == WfFormUsage.Read)
            {
                Kit.Warn("禁止删除表单!");
                return;
            }

            // 管理时始终可删除
            if (_info.Usage == WfFormUsage.Edit &&
                (_info.AtvDef == null || (!_info.AtvDef.CanDelete && _info.AtvDef.Type != WfdAtvType.Start)))
            {
                Kit.Warn("您无权删除当前表单!请回退或发送到其他用户进行删除。");
                return;
            }

            if (!await Kit.Confirm("确认要删除当前表单吗?删除后表单将不可恢复!"))
            {
                return;
            }

            if (await _info.FormWin.Delete())
            {
                if (!_info.PrcInst.IsAdded)
                {
                    if (!await AtCm.Delete(_info.PrcInst, false))
                    {
                        Kit.Warn("表单已删除,未找到待删除的流程实例!");
                    }
                }
                _info.CloseWin();
            }
        }
Beispiel #2
0
        async void DelRpt(Rpt rpt)
        {
            if (rpt.IsAdded && !rpt.IsChanged)
            {
                _fv.Data = null;
                return;
            }

            if (!await Kit.Confirm($"确认要删除报表[{rpt.Name}]吗?"))
            {
                Kit.Msg("已取消删除!");
                return;
            }

            if (rpt.IsAdded)
            {
                _fv.Data = null;
            }
            else if (await AtCm.DelByID <Rpt>(rpt.ID))
            {
                _fv.Data = null;
                LoadAll();
                AtCm.PromptForUpdateModel();
            }
        }
Beispiel #3
0
        async void OnImport(object sender, RoutedEventArgs e)
        {
            if (_info.IsDirty && !await Kit.Confirm("当前模板已修改,导入新模板会丢失修改内容,继续导入吗?"))
            {
                return;
            }

            FileOpenPicker picker = new FileOpenPicker();

            picker.FileTypeFilter.Add(".xml");
            StorageFile sf = await picker.PickSingleFileAsync();

            if (sf != null)
            {
                try
                {
                    using (var stream = await sf.OpenStreamForReadAsync())
                        using (var reader = new StreamReader(stream))
                        {
                            await _info.ImportTemplate(reader.ReadToEnd());
                        }
                }
                catch (Exception ex)
                {
                    throw new Exception(string.Format("导入报表模板时异常:{0}", ex.Message));
                }
            }
        }
Beispiel #4
0
        async void DelParams(Params p_par)
        {
            if (!await Kit.Confirm("确认要删除吗?"))
            {
                Kit.Msg("已取消删除!");
                return;
            }


            if (p_par.IsAdded)
            {
                _fv.Data = null;
                return;
            }

            int cnt = await AtCm.GetScalar <int>("参数-用户设置数", new { ParamID = p_par.ID });

            if (cnt > 0)
            {
                if (!await Kit.Confirm("该参数已存在用户设置,确认要删除吗?"))
                {
                    return;
                }
            }

            if (await AtCm.Delete(p_par))
            {
                LoadLast();
                _fv.Data = null;
                DeleteDataVer();
            }
        }
Beispiel #5
0
        async void DelMenuRow(Menu p_row)
        {
            if (!await Kit.Confirm("确认要删除吗?"))
            {
                Kit.Msg("已取消删除!");
                return;
            }

            if (p_row.IsAdded)
            {
                _fv.Data = _tv.SelectedItem;
                return;
            }

            if (await AtCm.Delete(p_row))
            {
                long id    = p_row.ID;
                Row  tvRow = (from tr in (Table)_tv.Data
                              where tr.ID == id
                              select tr).FirstOrDefault();
                if (tvRow != null)
                {
                    _tv.DeleteItem(tvRow);
                }
                _fv.Data = _tv.SelectedItem;
                AtCm.PromptForUpdateModel();
            }
        }
Beispiel #6
0
 async void OnClearLocalFile(object sender, RoutedEventArgs e)
 {
     if (await Kit.Confirm("清除缓存后再次用到时需要重新下载,建议存储空间充足时不必清除。\r\n确认要清除吗?"))
     {
         Kit.ClearCacheFiles();
         Kit.Msg("清除完毕!");
     }
 }
Beispiel #7
0
 async void OnFinish(object sender, Mi e)
 {
     if (await Kit.Confirm("任务结束(完成)后将不可修改,确认完成吗?"))
     {
         _info.NextRecvs.FinishedAtv.IsSelected = true;
         Close(true);
     }
 }
Beispiel #8
0
 protected override Task <bool> OnClosing(bool p_result)
 {
     if (_fv.Row.IsChanged)
     {
         return(Kit.Confirm("数据未保存,要放弃修改吗?"));
     }
     return(Task.FromResult(true));
 }
Beispiel #9
0
 async void OnLocalDel(object sender, Mi e)
 {
     if (await Kit.Confirm("确认要删除码?"))
     {
         if (await AtState.Delete((ClientLog)_fv1.Data))
         {
             _fv1.Data = null;
         }
     }
 }
Beispiel #10
0
 async void OnClicked1(object sender, RoutedEventArgs e)
 {
     if (await Kit.Confirm("确认要删除所有数据吗?"))
     {
         Kit.Msg("Yes");
     }
     else
     {
         Kit.Msg("No");
     }
 }
Beispiel #11
0
        async void OnDelUser(object sender, Mi e)
        {
            if (!await Kit.Confirm($"确认要删除[{e.Row.Str("name")}]吗?"))
            {
                Kit.Msg("已取消删除!");
                return;
            }

            if (await AtCm.DeleteBySvc(e.Data.To <User>()))
            {
                LoadAll();
            }
        }
Beispiel #12
0
        async void OnDelPrv(object sender, Mi e)
        {
            var prv = e.Data.To <Prv>();

            if (!await Kit.Confirm($"确认要删除[{prv.ID}]吗?"))
            {
                Kit.Msg("已取消删除!");
                return;
            }

            if (await AtCm.Delete(prv))
            {
                LoadAll();
            }
        }
Beispiel #13
0
        protected override async Task <bool> OnClosing(bool p_result)
        {
            if (!_saved)
            {
                var html = await _wv.InvokeScriptAsync("getHtml", null);

                if (_host.CurrentHtml == html)
                {
                    return(true);
                }

                return(await Kit.Confirm("关闭将丢失已修改的内容,确认要关闭?"));
            }
            return(true);
        }
Beispiel #14
0
        async void OnDelContext(object sender, Mi e)
        {
            var p_prc = e.Data.To <WfdPrc>();

            if (!await Kit.Confirm($"确认要删除流程模板[{p_prc.Name}]吗?"))
            {
                Kit.Msg("已取消删除!");
                return;
            }

            if (await AtCm.Delete(p_prc))
            {
                LoadAll();
            }
        }
Beispiel #15
0
        /// <summary>
        /// 打开文件
        /// <para>预览图片、播放音视频</para>
        /// <para>其他文件类型提示下载</para>
        /// </summary>
        public async Task OpenFile()
        {
            if (State != FileItemState.None || string.IsNullOrEmpty(ID))
            {
                return;
            }

            switch (FileType)
            {
            case FileItemType.Image:
                await new ImageFileView().ShowDlg(_owner, this);
                break;

            case FileItemType.Video:
                //Grid grid = (Grid)GetTemplateChild("ContentGrid");
                //if (grid != null
                //    && !(grid.Children[grid.Children.Count - 1] is MediaPlayerElement))
                //{
                //    var mediaPlayer = new MediaPlayerElement();
                //    mediaPlayer.AutoPlay = true;

                //    var player = mediaPlayer.MediaPlayer;
                //    if (player == null)
                //    {
                //        player = new Windows.Media.Playback.MediaPlayer();
                //        mediaPlayer.SetMediaPlayer(player);
                //    }

                //    mediaPlayer.Height = ActualHeight;
                //    grid.Children.Add(mediaPlayer);
                //    mediaPlayer.Source = MediaSource.CreateFromUri(new Uri($"{Kit.Stub.ServerUrl}/fsm/{ID}"));
                //}
                Kit.Warn("wasm版未实现MediaPlayerElement");
                break;

            case FileItemType.Sound:
                Kit.Warn("wasm版未实现MediaPlayerElement");
                break;

            default:
                if (await Kit.Confirm($"要下载《{Title}》吗?"))
                {
                    DownloadFile();
                }
                break;
            }
            _owner.OnOpenedFile(this);
        }
Beispiel #16
0
        async void OnDelPost(object sender, Mi e)
        {
            Post post = (Post)_fv.Data;

            if (!await Kit.Confirm($"确认要删除[{post.Title}]吗?"))
            {
                Kit.Msg("已取消删除!");
                return;
            }

            if (await AtPublish.Delete(post))
            {
                LoadAll();
                _fv.Data        = null;
                _lvKeyword.Data = null;
                _lvAlbum.Data   = null;
            }
        }
Beispiel #17
0
        async void OnItemClick(object sender, ItemClickArgs e)
        {
            Rpt rpt = _fv.Data.To <Rpt>();

            if (rpt != null && rpt.IsChanged)
            {
                if (!await Kit.Confirm("数据已修改,确认要放弃修改吗?"))
                {
                    return;
                }

                rpt.RejectChanges();
            }

            _fv.Data = await AtCm.First <Rpt>("报表-ID", new { id = e.Data.To <Rpt>().ID });

            SelectTab("编辑");
        }
Beispiel #18
0
        async void OnDel(object sender, Mi e)
        {
            var key = e.Data.To <Keyword>();

            if (await IsUsed(key.ID))
            {
                return;
            }

            if (!await Kit.Confirm($"确认要删除[{key.ID}]吗?"))
            {
                Kit.Msg("已取消删除!");
                return;
            }

            if (await AtPublish.Delete(key))
            {
                LoadAll();
            }
        }
Beispiel #19
0
        async void OnDel(object sender, Mi e)
        {
            var album = e.Data.To <Album>();

            if (await IsUsed(album.ID))
            {
                return;
            }

            if (!await Kit.Confirm($"确认要删除[{album.Name}]吗?"))
            {
                Kit.Msg("已取消删除!");
                return;
            }

            if (await AtPublish.Delete(album))
            {
                LoadAll();
            }
        }
Beispiel #20
0
 async void DeleteFiles(IEnumerable <Row> p_rows)
 {
     if (!await Kit.Confirm("确认要删除吗?"))
     {
         Kit.Msg("已取消删除!");
     }
     else if (await _fileMgr.Delete(p_rows))
     {
         // 不删除实际文件,其他位置可能已引用!
         //foreach (var row in p_rows)
         //{
         //    if (!row.Bool("IsFolder"))
         //    {
         //        // 删除文件
         //        var fi = GetFileItem(row);
         //        if (fi != null)
         //            await fi.Delete();
         //    }
         //}
         LoadData();
     }
 }
Beispiel #21
0
        /// <summary>
        /// 提示需要更新模型
        /// </summary>
        /// <param name="p_msg">提示消息</param>
        public static void PromptForUpdateModel(string p_msg = null)
        {
            var notify = new NotifyInfo();

            notify.Message      = string.IsNullOrEmpty(p_msg) ? "需要更新模型才能生效" : p_msg + ",需要更新模型才能生效";
            notify.DelaySeconds = 5;
            notify.Link         = "更新模型";
            notify.LinkCallback = async(e) =>
            {
                if (await Kit.Confirm("确认要更新模型吗?"))
                {
                    if (await new UnaryRpc("cm", "ModelMgr.更新模型").Call <bool>())
                    {
                        Kit.Msg("更新模型成功,请重启应用!");
                    }
                    else
                    {
                        Kit.Warn("更新模型失败!");
                    }
                }
            };
            Kit.RunAsync(() => SysVisual.NotifyList.Add(notify));
        }
Beispiel #22
0
        async void DelOption(Option p_option)
        {
            if (!await Kit.Confirm("确认要删除吗?"))
            {
                Kit.Msg("已取消删除!");
                return;
            }

            if (p_option.IsAdded)
            {
                _fv.Data = null;
                return;
            }

            if (await AtCm.Delete(p_option))
            {
                LoadCategory();
                _lv.Data = await AtCm.Query <Option>("选项-分类选项", new { Category = p_option.Category });

                _fv.Data = null;
                AtCm.PromptForUpdateModel();
            }
        }
Beispiel #23
0
        async void OnDel(object sender, Mi e)
        {
            if (_lvDb.SelectedRow.Str("name") == "model")
            {
                Kit.Warn("模型库禁止删除数据!");
                return;
            }

            if (!await Kit.Confirm($"确认要删除这{_lvData.SelectedCount}行吗?"))
            {
                return;
            }

            var db      = GetDb();
            var tblName = _lvTbl.SelectedRow.Str(0);
            var pk      = db.GetScalar <string>($"select name from pragma_table_info('{tblName}') where pk=1");

            if (string.IsNullOrEmpty(pk))
            {
                Kit.Warn("该表无主键!");
                return;
            }

            List <Dict> ls = new List <Dict>();

            foreach (var row in _lvData.SelectedRows)
            {
                ls.Add(new Dict {
                    { pk, row[pk] }
                });
            }
            if (db.BatchExecute($"delete from '{tblName}' where {pk}=@{pk}", ls) > 0)
            {
                _lvData.DeleteSelection();
            }
        }
Beispiel #24
0
        async void OnDelRole(object sender, Mi e)
        {
            if (e.Row.ID < 1000)
            {
                Kit.Msg("系统角色无法删除!");
                return;
            }

            if (!await Kit.Confirm($"确认要删除[{e.Row.Str("name")}]吗?"))
            {
                Kit.Msg("已取消删除!");
                return;
            }

            if (await AtCm.DeleteRole(e.Row.ID))
            {
                Kit.Msg("删除成功!");
                LoadAll();
            }
            else
            {
                Kit.Warn("删除失败!");
            }
        }
Beispiel #25
0
        async Task Rollback()
        {
            // 活动执行者多于一人时,不允许进行回退
            if (_info.AtvInst.InstCount > 1)
            {
                Kit.Msg("该活动执行者多于一人,不允许回退!");
                return;
            }

            // 获得前一活动实例
            var pre = await _info.AtvInst.GetRollbackAtv();

            if (pre == null)
            {
                Kit.Msg("该活动不允许回退!");
                return;
            }

            if (!await Kit.Confirm("确认要回退吗?"))
            {
                return;
            }

            DateTime time       = Kit.Now;
            var      newAtvInst = new WfiAtv(
                ID: await AtCm.NewID(),
                PrciID: _info.PrcInst.ID,
                AtvdID: pre.AtvdID,
                Status: WfiAtvStatus.活动,
                InstCount: 1,
                Ctime: time,
                Mtime: time);

            // 创建迁移实例
            var newTrs = await _info.CreateAtvTrs(pre.AtvdID, newAtvInst.ID, time, true);

            // 当前活动完成状态
            _info.AtvInst.Finished();

            // 当前工作项置成完成状态
            _info.WorkItem.Finished();

            Dict dict = new Dict();

            dict["name"] = await GetSender();

            long userId = await AtCm.GetScalar <long>("流程-获取用户ID", dict);

            var newItem = await WfiItem.Create(newAtvInst.ID, time, false, userId, null, true);

            List <object> ls = new List <object>();

            if (_info.AtvInst.IsChanged)
            {
                ls.Add(_info.AtvInst);
            }
            ls.Add(_info.WorkItem);
            ls.Add(newAtvInst);
            ls.Add(newItem);
            ls.Add(newTrs);

            if (await AtCm.BatchSave(ls, false))
            {
                Kit.Msg("回退成功!");
                _info.CloseWin();
            }
            else
            {
                Kit.Msg("回退失败!");
            }
        }