diff --git a/CloudBuilder.AI.Gui/AiBookEnquiryPage.Designer.cs b/CloudBuilder.AI.Gui/AiBookEnquiryPage.Designer.cs
new file mode 100644
index 0000000..33fd1fb
--- /dev/null
+++ b/CloudBuilder.AI.Gui/AiBookEnquiryPage.Designer.cs
@@ -0,0 +1,398 @@
+namespace CloudBuilder.AI.Gui
+{
+ partial class AiBookEnquiryPage
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle();
+ DataGridViewCellStyle dataGridViewCellStyle4 = new DataGridViewCellStyle();
+ mainPanel = new TableLayoutPanel();
+ topPanel = new TableLayoutPanel();
+ titleLabel = new Krypton.Toolkit.KryptonLabel();
+ titleTxt = new Krypton.Toolkit.KryptonTextBox();
+ searchPanel = new TableLayoutPanel();
+ searchBut = new Krypton.Toolkit.KryptonButton();
+ resetBut = new Krypton.Toolkit.KryptonButton();
+ createBut = new Krypton.Toolkit.KryptonButton();
+ contextPanel = new TableLayoutPanel();
+ dataGv = new Krypton.Toolkit.KryptonDataGridView();
+ gridViewPagination = new CloudBuilder.Gui.GridViewPagination();
+ bottomPanel = new TableLayoutPanel();
+ operationPanel = new TableLayoutPanel();
+ viewBut = new Krypton.Toolkit.KryptonButton();
+ amendBut = new Krypton.Toolkit.KryptonButton();
+ deleteBut = new Krypton.Toolkit.KryptonButton();
+ dialogPanel = new TableLayoutPanel();
+ okBut = new Krypton.Toolkit.KryptonButton();
+ cancelBut = new Krypton.Toolkit.KryptonButton();
+ authorLabel = new Krypton.Toolkit.KryptonLabel();
+ authorTxt = new Krypton.Toolkit.KryptonTextBox();
+ titleCol = new Krypton.Toolkit.KryptonDataGridViewTextBoxColumn();
+ authorCol = new Krypton.Toolkit.KryptonDataGridViewTextBoxColumn();
+ mainPanel.SuspendLayout();
+ topPanel.SuspendLayout();
+ searchPanel.SuspendLayout();
+ contextPanel.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)dataGv).BeginInit();
+ bottomPanel.SuspendLayout();
+ operationPanel.SuspendLayout();
+ dialogPanel.SuspendLayout();
+ SuspendLayout();
+ //
+ // mainPanel
+ //
+ mainPanel.ColumnCount = 1;
+ mainPanel.ColumnStyles.Add(new ColumnStyle());
+ mainPanel.Controls.Add(topPanel, 0, 0);
+ mainPanel.Controls.Add(contextPanel, 0, 1);
+ mainPanel.Controls.Add(bottomPanel, 0, 2);
+ mainPanel.Dock = DockStyle.Fill;
+ mainPanel.Location = new Point(0, 0);
+ mainPanel.Name = "mainPanel";
+ mainPanel.RowCount = 3;
+ mainPanel.RowStyles.Add(new RowStyle());
+ mainPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
+ mainPanel.RowStyles.Add(new RowStyle());
+ mainPanel.Size = new Size(1024, 800);
+ mainPanel.TabIndex = 0;
+ //
+ // topPanel
+ //
+ topPanel.AutoSize = true;
+ topPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ topPanel.ColumnCount = 7;
+ topPanel.ColumnStyles.Add(new ColumnStyle());
+ topPanel.ColumnStyles.Add(new ColumnStyle());
+ topPanel.ColumnStyles.Add(new ColumnStyle());
+ topPanel.ColumnStyles.Add(new ColumnStyle());
+ topPanel.ColumnStyles.Add(new ColumnStyle());
+ topPanel.ColumnStyles.Add(new ColumnStyle());
+ topPanel.ColumnStyles.Add(new ColumnStyle());
+ topPanel.Controls.Add(titleLabel, 0, 0);
+ topPanel.Controls.Add(titleTxt, 1, 0);
+ topPanel.Controls.Add(searchPanel, 6, 0);
+ topPanel.Controls.Add(authorLabel, 2, 0);
+ topPanel.Controls.Add(authorTxt, 3, 0);
+ topPanel.Dock = DockStyle.Fill;
+ topPanel.Location = new Point(3, 3);
+ topPanel.Name = "topPanel";
+ topPanel.RowCount = 1;
+ topPanel.RowStyles.Add(new RowStyle());
+ topPanel.Size = new Size(1018, 31);
+ topPanel.TabIndex = 0;
+ //
+ // titleLabel
+ //
+ titleLabel.Location = new Point(3, 3);
+ titleLabel.Name = "titleLabel";
+ titleLabel.Size = new Size(39, 20);
+ titleLabel.TabIndex = 999;
+ titleLabel.Values.Text = "书名:";
+ //
+ // titleTxt
+ //
+ titleTxt.Location = new Point(48, 3);
+ titleTxt.Name = "titleTxt";
+ titleTxt.Size = new Size(200, 23);
+ titleTxt.TabIndex = 0;
+ //
+ // searchPanel
+ //
+ searchPanel.AutoSize = true;
+ searchPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ searchPanel.ColumnCount = 3;
+ searchPanel.ColumnStyles.Add(new ColumnStyle());
+ searchPanel.ColumnStyles.Add(new ColumnStyle());
+ searchPanel.ColumnStyles.Add(new ColumnStyle());
+ searchPanel.Controls.Add(searchBut, 0, 0);
+ searchPanel.Controls.Add(resetBut, 1, 0);
+ searchPanel.Controls.Add(createBut, 2, 0);
+ searchPanel.Location = new Point(562, 0);
+ searchPanel.Margin = new Padding(60, 0, 0, 0);
+ searchPanel.Name = "searchPanel";
+ searchPanel.RowCount = 1;
+ searchPanel.RowStyles.Add(new RowStyle());
+ searchPanel.Size = new Size(288, 31);
+ searchPanel.TabIndex = 999;
+ //
+ // searchBut
+ //
+ searchBut.Location = new Point(3, 3);
+ searchBut.Name = "searchBut";
+ searchBut.Size = new Size(90, 25);
+ searchBut.TabIndex = 0;
+ searchBut.Values.Image = Properties.Resources.search_16;
+ searchBut.Values.Text = "查询(&S)";
+ searchBut.Click += searchBut_Click;
+ //
+ // resetBut
+ //
+ resetBut.Location = new Point(99, 3);
+ resetBut.Name = "resetBut";
+ resetBut.Size = new Size(90, 25);
+ resetBut.TabIndex = 0;
+ resetBut.Values.Image = Properties.Resources.reset_16;
+ resetBut.Values.Text = "重置(&R)";
+ resetBut.Click += resetBut_Click;
+ //
+ // createBut
+ //
+ createBut.Location = new Point(195, 3);
+ createBut.Name = "createBut";
+ createBut.Size = new Size(90, 25);
+ createBut.TabIndex = 0;
+ createBut.Values.Image = Properties.Resources.create_16;
+ createBut.Values.Text = "新增(&C)";
+ createBut.Click += createBut_Click;
+ //
+ // contextPanel
+ //
+ contextPanel.ColumnCount = 1;
+ contextPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
+ contextPanel.Controls.Add(dataGv, 0, 0);
+ contextPanel.Controls.Add(gridViewPagination, 0, 1);
+ contextPanel.Dock = DockStyle.Fill;
+ contextPanel.Location = new Point(3, 40);
+ contextPanel.Name = "contextPanel";
+ contextPanel.RowCount = 2;
+ contextPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
+ contextPanel.RowStyles.Add(new RowStyle());
+ contextPanel.Size = new Size(1018, 683);
+ contextPanel.TabIndex = 999;
+ //
+ // dataGv
+ //
+ dataGv.AllowUserToAddRows = false;
+ dataGv.AllowUserToDeleteRows = false;
+ dataGv.BorderStyle = BorderStyle.None;
+ dataGv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGv.Columns.AddRange(new DataGridViewColumn[] { titleCol, authorCol });
+ dataGv.Dock = DockStyle.Fill;
+ dataGv.Location = new Point(3, 3);
+ dataGv.Name = "dataGv";
+ dataGv.Size = new Size(1012, 647);
+ dataGv.TabIndex = 0;
+ dataGv.CellDoubleClick += dataGv_CellDoubleClick;
+ //
+ // gridViewPagination
+ //
+ gridViewPagination.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ gridViewPagination.CurrentPage = 0;
+ gridViewPagination.Dock = DockStyle.Fill;
+ gridViewPagination.Limit = 20;
+ gridViewPagination.Location = new Point(0, 653);
+ gridViewPagination.Margin = new Padding(0);
+ gridViewPagination.Name = "gridViewPagination";
+ gridViewPagination.Page = 0;
+ gridViewPagination.Size = new Size(1018, 30);
+ gridViewPagination.TabIndex = 999;
+ gridViewPagination.Total = 0;
+ //
+ // bottomPanel
+ //
+ bottomPanel.AutoSize = true;
+ bottomPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ bottomPanel.ColumnCount = 2;
+ bottomPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
+ bottomPanel.ColumnStyles.Add(new ColumnStyle());
+ bottomPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F));
+ bottomPanel.Controls.Add(operationPanel, 0, 0);
+ bottomPanel.Controls.Add(dialogPanel, 2, 1);
+ bottomPanel.Dock = DockStyle.Fill;
+ bottomPanel.Location = new Point(3, 729);
+ bottomPanel.Name = "bottomPanel";
+ bottomPanel.RowCount = 2;
+ bottomPanel.RowStyles.Add(new RowStyle());
+ bottomPanel.RowStyles.Add(new RowStyle());
+ bottomPanel.Size = new Size(1018, 68);
+ bottomPanel.TabIndex = 999;
+ //
+ // operationPanel
+ //
+ operationPanel.AutoSize = true;
+ operationPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ operationPanel.ColumnCount = 3;
+ operationPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
+ operationPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 101F));
+ operationPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
+ operationPanel.Controls.Add(viewBut, 0, 0);
+ operationPanel.Controls.Add(amendBut, 1, 0);
+ operationPanel.Controls.Add(deleteBut, 2, 0);
+ operationPanel.Location = new Point(0, 0);
+ operationPanel.Margin = new Padding(0);
+ operationPanel.Name = "operationPanel";
+ operationPanel.RowCount = 1;
+ operationPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
+ operationPanel.Size = new Size(293, 31);
+ operationPanel.TabIndex = 0;
+ //
+ // viewBut
+ //
+ viewBut.Location = new Point(3, 3);
+ viewBut.Name = "viewBut";
+ viewBut.Size = new Size(90, 25);
+ viewBut.TabIndex = 0;
+ viewBut.Values.Image = Properties.Resources.view_16;
+ viewBut.Values.Text = "查看(&V)";
+ viewBut.Click += viewBut_Click;
+ //
+ // amendBut
+ //
+ amendBut.Location = new Point(99, 3);
+ amendBut.Name = "amendBut";
+ amendBut.Size = new Size(90, 25);
+ amendBut.TabIndex = 0;
+ amendBut.Values.Image = Properties.Resources.amend_16;
+ amendBut.Values.Text = "修改(&A)";
+ amendBut.Click += amendBut_Click;
+ //
+ // deleteBut
+ //
+ deleteBut.Location = new Point(200, 3);
+ deleteBut.Name = "deleteBut";
+ deleteBut.Size = new Size(90, 25);
+ deleteBut.TabIndex = 0;
+ deleteBut.Values.Image = Properties.Resources.delete_16;
+ deleteBut.Values.Text = "删除(&D)";
+ deleteBut.Click += deleteBut_Click;
+ //
+ // dialogPanel
+ //
+ dialogPanel.AutoSize = true;
+ dialogPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ dialogPanel.ColumnCount = 2;
+ dialogPanel.ColumnStyles.Add(new ColumnStyle());
+ dialogPanel.ColumnStyles.Add(new ColumnStyle());
+ dialogPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F));
+ dialogPanel.Controls.Add(okBut, 0, 0);
+ dialogPanel.Controls.Add(cancelBut, 1, 0);
+ dialogPanel.Dock = DockStyle.Fill;
+ dialogPanel.Location = new Point(823, 34);
+ dialogPanel.Name = "dialogPanel";
+ dialogPanel.RowCount = 1;
+ dialogPanel.RowStyles.Add(new RowStyle());
+ dialogPanel.Size = new Size(192, 31);
+ dialogPanel.TabIndex = 1;
+ //
+ // okBut
+ //
+ okBut.Location = new Point(3, 3);
+ okBut.Name = "okBut";
+ okBut.Size = new Size(90, 25);
+ okBut.TabIndex = 0;
+ okBut.Values.Image = Properties.Resources.ok_16;
+ okBut.Values.Text = "确定(&O)";
+ okBut.Click += okBut_Click;
+ //
+ // cancelBut
+ //
+ cancelBut.Location = new Point(99, 3);
+ cancelBut.Name = "cancelBut";
+ cancelBut.Size = new Size(90, 25);
+ cancelBut.TabIndex = 0;
+ cancelBut.Values.Image = Properties.Resources.close_16;
+ cancelBut.Values.Text = "取消(&C)";
+ cancelBut.Click += cancelBut_Click;
+ //
+ // authorLabel
+ //
+ authorLabel.Location = new Point(254, 3);
+ authorLabel.Name = "authorLabel";
+ authorLabel.Size = new Size(39, 20);
+ authorLabel.TabIndex = 999;
+ authorLabel.Values.Text = "作者:";
+ //
+ // authorTxt
+ //
+ authorTxt.Location = new Point(299, 3);
+ authorTxt.Name = "authorTxt";
+ authorTxt.Size = new Size(200, 23);
+ authorTxt.TabIndex = 0;
+ //
+ // titleCol
+ //
+ titleCol.DataPropertyName = "Title";
+ titleCol.DefaultCellStyle = dataGridViewCellStyle3;
+ titleCol.HeaderText = "书名";
+ titleCol.Name = "titleCol";
+ titleCol.Width = 260;
+ //
+ // authorCol
+ //
+ authorCol.DataPropertyName = "Author";
+ authorCol.DefaultCellStyle = dataGridViewCellStyle4;
+ authorCol.HeaderText = "作者";
+ authorCol.Name = "authorCol";
+ authorCol.Width = 160;
+ //
+ // AiBookEnquiryPage
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(mainPanel);
+ Name = "AiBookEnquiryPage";
+ mainPanel.ResumeLayout(false);
+ mainPanel.PerformLayout();
+ topPanel.ResumeLayout(false);
+ topPanel.PerformLayout();
+ searchPanel.ResumeLayout(false);
+ contextPanel.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)dataGv).EndInit();
+ bottomPanel.ResumeLayout(false);
+ bottomPanel.PerformLayout();
+ operationPanel.ResumeLayout(false);
+ dialogPanel.ResumeLayout(false);
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private TableLayoutPanel mainPanel;
+ private TableLayoutPanel topPanel;
+ private TableLayoutPanel searchPanel;
+ private Krypton.Toolkit.KryptonButton searchBut;
+ private Krypton.Toolkit.KryptonButton resetBut;
+ private Krypton.Toolkit.KryptonButton createBut;
+ private TableLayoutPanel contextPanel;
+ private TableLayoutPanel bottomPanel;
+ private TableLayoutPanel operationPanel;
+ private Krypton.Toolkit.KryptonButton viewBut;
+ private Krypton.Toolkit.KryptonButton amendBut;
+ private Krypton.Toolkit.KryptonButton deleteBut;
+ private Krypton.Toolkit.KryptonLabel titleLabel;
+ private Krypton.Toolkit.KryptonTextBox titleTxt;
+ private Krypton.Toolkit.KryptonDataGridView dataGv;
+ private TableLayoutPanel dialogPanel;
+ private Krypton.Toolkit.KryptonButton okBut;
+ private Krypton.Toolkit.KryptonButton cancelBut;
+ private CloudBuilder.Gui.GridViewPagination gridViewPagination;
+ private Krypton.Toolkit.KryptonLabel authorLabel;
+ private Krypton.Toolkit.KryptonTextBox authorTxt;
+ private Krypton.Toolkit.KryptonDataGridViewTextBoxColumn titleCol;
+ private Krypton.Toolkit.KryptonDataGridViewTextBoxColumn authorCol;
+ }
+}
\ No newline at end of file
diff --git a/CloudBuilder.AI.Gui/AiBookEnquiryPage.cs b/CloudBuilder.AI.Gui/AiBookEnquiryPage.cs
new file mode 100644
index 0000000..a012146
--- /dev/null
+++ b/CloudBuilder.AI.Gui/AiBookEnquiryPage.cs
@@ -0,0 +1,397 @@
+using CloudBuilder.AI.Entity;
+using CloudBuilder.AI.Linkup;
+using CloudBuilder.AI.Policy;
+using CloudBuilder.AI.SearchCriteria;
+using CloudBuilder.Core.Report;
+using CloudBuilder.Core.Service;
+using CloudBuilder.Gui;
+using CloudBuilder.Request.AI;
+using CloudBuilder.Security.Linkup;
+using CloudBuilder.Security.Policy;
+using Krypton.Toolkit;
+using Microsoft.AspNetCore.Authorization;
+using System.Data;
+
+
+namespace CloudBuilder.AI.Gui
+{
+ public partial class AiBookEnquiryPage : AbstractPage
+ {
+ private AiBookEntity[] aiBooks = null!;
+ private AiBookSearchCriteria searchCriteria = null!;
+ private BindingContextAttributeProvider provider;
+ private AiBookRequest aiBookRequest;
+ private SecurityMessagePolicy securityMessagePolicy;
+
+ //初始化Page,注入容器内,不要在此做任何事情
+ public AiBookEnquiryPage()
+ {
+ InitializeComponent();
+ }
+
+ ///
+ /// 第一次加载时执行,只执行一次
+ ///
+ public override void FunctionLoaded()
+ {
+ try
+ {
+ base.FunctionLoaded();
+ //初始化容器-------------------------------------
+ aiBookRequest = ServiceHelper.GetTypeService();
+ securityMessagePolicy = ServiceHelper.GetTypeService()!;
+
+ //界面初始化
+ InitGui();
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ ///
+ /// 每次从别的界面进入时执行,不包括下面的界面切换,发生在FunctionLoaded之后
+ /// 这个是有参数传入,常用于查询界面进入到操作界面发生
+ ///
+ ///
+ public override void FunctionActivated(object param)
+ {
+ base.FunctionActivated(param);
+ titleTxt.Focus();
+ }
+ ///
+ /// 当Page被选中时执行,用于Tab导航的切换,没有参数变化,跟FunctionActivated有区别
+ ///
+ public override void FunctionSelected()
+ {
+ this.ParentAbstractForm.AcceptButton = this.searchBut;
+ if (!IsDialog)
+ this.ParentAbstractForm.CancelButton = this.resetBut;
+ else
+ this.ParentAbstractForm.CancelButton = this.cancelBut;
+
+ titleTxt.Focus();
+ }
+ ///
+ /// 控件的初始化
+ ///
+ private void InitGui()
+ {
+ //DataGridView初始化不要自动生成列,且允许重排列名操作
+ dataGv.InitColumn(true, true);
+ //初始化绑定设置
+ InitBindingContext();
+ //设置显示模式
+ SetDisplayMode(true);
+
+ InitGridViewPagination();
+ }
+ ///
+ /// DataGridView分页控件初始化
+ ///
+ private void InitGridViewPagination()
+ {
+ searchCriteria = new AiBookSearchCriteria();
+ gridViewPagination.SetLimit(searchCriteria.limit);
+ gridViewPagination.OnPaginationChanged += Search;
+ gridViewPagination.OnPrint += Print;
+ }
+
+ ///
+ /// 打印当前查询结果
+ ///
+ private void Print()
+ {
+ TemplateHeader[] headers = dataGv.GetTemplateHeaders();
+
+ //打印Excel
+ new DataToExcelHelper(null).PrintExcel(this.Parent.Text, this.Parent.Text, null, headers, aiBooks);
+ }
+
+ ///
+ /// 有特殊要求的UI控件初始化设置,使用guiOperateHelper管理
+ ///
+ private void InitBindingContext()
+ {
+ InitPermission();
+
+ guiOperateHelper = new GuiOperateHelper();
+ }
+
+ private void InitPermission()
+ {
+ viewBut.Set(AIPermissionPolicy.AiBook, Operate.Find);
+ createBut.Set(AIPermissionPolicy.AiBook, Operate.Insert);
+ amendBut.Set(AIPermissionPolicy.AiBook, Operate.Update);
+ deleteBut.Set(AIPermissionPolicy.AiBook, Operate.Delete);
+ }
+
+ private void SetDisplayMode(bool enable)
+ {
+ guiOperateHelper.EnableControls(true, this.searchPanel, this.bottomPanel);
+ guiOperateHelper.EnableControls(false, dataGv);
+
+ if (aiBooks != null)
+ guiOperateHelper.EnableControls(enable, viewBut, amendBut, deleteBut);
+ else
+ guiOperateHelper.EnableControls(false, viewBut, amendBut, deleteBut);
+
+ //如果是弹出的窗口,不显示
+ createBut.Visible = !IsDialog;
+ dialogPanel.Visible = IsDialog;
+ operationPanel.Visible = !IsDialog;
+
+ this.titleTxt.Focus();
+ }
+
+ private void searchBut_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ Search();
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ ///
+ /// 与Web同步写法
+ ///
+ ///
+ private AiBookSearchCriteria PackSearchCriteria()
+ {
+ searchCriteria = new AiBookSearchCriteria();
+ searchCriteria.limit = gridViewPagination.Limit;
+ searchCriteria.page = gridViewPagination.CurrentPage;
+
+ List filters = new List();
+
+ SearchFilter filter = new SearchFilter();
+ filter.Column = AiBookEntity.DB_TITLE;
+ filter.Type = SearchFilterTypePolicy.TEXT;
+ filter.Operator = SearchFilterOperatorPolicy.CN_CONTAIN;
+ filter.Value = titleTxt.GetValue();
+ filters.Add(filter);
+
+ filter.Column = AiBookEntity.DB_AUTHOR;
+ filter.Type = SearchFilterTypePolicy.TEXT;
+ filter.Operator = SearchFilterOperatorPolicy.CN_CONTAIN;
+ filter.Value = titleTxt.GetValue();
+ filters.Add(filter);
+
+ searchCriteria.Filter = filters.ToArray();
+
+ return searchCriteria;
+ }
+
+ private void Search()
+ {
+ try
+ {
+ var data = aiBookRequest.FindBySearchCriteria(PackSearchCriteria());
+
+ if (data != null) aiBooks = data.Datas;
+
+ gridViewPagination.SetTotal(data.Total);
+
+ if (aiBooks == null || aiBooks.Length == 0)
+ {
+ ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_WS_RECORD_NOT_FOUND));
+ guiOperateHelper.ResetControls(this.dataGv);
+ return;
+ }
+
+ dataGv.SetDataSource(aiBooks);
+
+ SetDisplayMode(true);
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ private void resetBut_Click(object sender, EventArgs e)
+ {
+ guiOperateHelper.ResetControls(this.mainPanel);
+
+ SetDisplayMode(false);
+
+ }
+
+ private void createBut_Click(object sender, EventArgs e)
+ {
+ DisplayPage(GuiDisplayMode.Create, null);
+ }
+
+ private void DisplayPage(GuiDisplayMode mode, string guid)
+ {
+ AiBookOperationLinkup linkupData = new AiBookOperationLinkup();
+ linkupData.DisplayMode = Convert.ToInt32(mode);
+ linkupData.Guid = guid;
+
+ this.DisplayAbstractPage(typeof(AiBookOperationPage).Name, linkupData);
+ }
+
+ private void viewBut_Click(object sender, EventArgs e)
+ {
+ if (dataGv.RowCount <= 0 || dataGv.SelectedCells.Count <= 0)
+ {
+ ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_WS_RECORD_NOT_FOUND));
+ return;
+ }
+
+ AiBookEntity data = dataGv.GetRowData(dataGv.SelectedCells[0].RowIndex);
+
+ DisplayPage(GuiDisplayMode.View, data.Guid);
+ }
+
+ private void amendBut_Click(object sender, EventArgs e)
+ {
+ if (dataGv.RowCount <= 0 || dataGv.SelectedCells.Count <= 0)
+ {
+ ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_WS_RECORD_NOT_FOUND));
+ return;
+ }
+
+ AiBookEntity data = dataGv.GetRowData(dataGv.SelectedCells[0].RowIndex);
+
+ DisplayPage(GuiDisplayMode.Amend, data.Guid);
+ }
+
+ private void deleteBut_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ Delete();
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ private void Delete()
+ {
+ if (dataGv.RowCount <= 0 || dataGv.SelectedCells.Count <= 0)
+ {
+ ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_WS_RECORD_NOT_FOUND));
+ return;
+ }
+
+ if (DialogResult.Yes != ShowMessageBox.ShowOption(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_CONFIRM_DEL_NULL), securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_DELETE))) return;
+
+ AiBookEntity[] datas = dataGv.GetSelectedCellsData();
+
+ aiBookRequest.Deletes(datas.Select(x => x.Guid).ToArray());
+
+ ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_SUCCEED_DELETED_NULL));
+
+ Search();
+ }
+
+ private void okBut_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (dataGv.RowCount <= 0 || dataGv.SelectedCells.Count <= 0) return;
+ AiBookEntity[] datas = dataGv.GetSelectedCellsData();
+
+ this.ParentAbstractForm.OutputData = datas;
+ this.ParentAbstractForm.DialogResult = DialogResult.OK;
+ this.ParentAbstractForm.Close();
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ private void cancelBut_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ this.ParentAbstractForm.DialogResult = DialogResult.Cancel;
+ this.ParentAbstractForm.Close();
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ private void dataGv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
+ {
+ try
+ {
+ if (IsDialog)
+ okBut_Click(null, null);
+ else
+ viewBut_Click(null, null);
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+ }
+}
diff --git a/CloudBuilder.AI.Gui/AiBookEnquiryPage.resx b/CloudBuilder.AI.Gui/AiBookEnquiryPage.resx
new file mode 100644
index 0000000..71a3bac
--- /dev/null
+++ b/CloudBuilder.AI.Gui/AiBookEnquiryPage.resx
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
\ No newline at end of file
diff --git a/CloudBuilder.AI.Gui/AiBookOperationPage.Designer.cs b/CloudBuilder.AI.Gui/AiBookOperationPage.Designer.cs
new file mode 100644
index 0000000..dd64d4b
--- /dev/null
+++ b/CloudBuilder.AI.Gui/AiBookOperationPage.Designer.cs
@@ -0,0 +1,908 @@
+using DocumentFormat.OpenXml.Spreadsheet;
+using DocumentFormat.OpenXml.Wordprocessing;
+
+namespace CloudBuilder.AI.Gui
+{
+ partial class AiBookOperationPage
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();
+ DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();
+ DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle();
+ DataGridViewCellStyle dataGridViewCellStyle4 = new DataGridViewCellStyle();
+ contentPanel = new TableLayoutPanel();
+ tableLayoutPanel3 = new TableLayoutPanel();
+ tableLayoutPanel4 = new TableLayoutPanel();
+ kryptonHeader1 = new Krypton.Toolkit.KryptonHeader();
+ tabControl1 = new TabControl();
+ tabPage1 = new TabPage();
+ tableLayoutPanel5 = new TableLayoutPanel();
+ tableLayoutPanel1 = new TableLayoutPanel();
+ delBut = new Krypton.Toolkit.KryptonButton();
+ addBut = new Krypton.Toolkit.KryptonButton();
+ tableLayoutPanel6 = new TableLayoutPanel();
+ gridViewPagination = new CloudBuilder.Gui.GridViewPagination();
+ sentenceGv = new Krypton.Toolkit.KryptonDataGridView();
+ sentenceIndexCol = new DataGridViewTextBoxColumn();
+ dialogueIndcCol = new Krypton.Toolkit.KryptonDataGridViewCheckBoxColumn();
+ personNameCol = new Krypton.Toolkit.KryptonDataGridViewTextBoxColumn();
+ sentenceContentCol = new DataGridViewTextBoxColumn();
+ genderCol = new Krypton.Toolkit.KryptonDataGridViewTextBoxColumn();
+ sentimentCol = new Krypton.Toolkit.KryptonDataGridViewTextBoxColumn();
+ sentenceStatusCol = new Krypton.Toolkit.KryptonDataGridViewComboBoxColumn();
+ dataGv = new Krypton.Toolkit.KryptonDataGridView();
+ chapterIndexCol = new DataGridViewTextBoxColumn();
+ titleCol = new DataGridViewTextBoxColumn();
+ contentCol = new DataGridViewTextBoxColumn();
+ statusCol = new DataGridViewTextBoxColumn();
+ tabPage2 = new TabPage();
+ tableLayoutPanel2 = new TableLayoutPanel();
+ statusCombo = new Krypton.Toolkit.KryptonComboBox();
+ processBut = new Krypton.Toolkit.KryptonButton();
+ uploadBut = new Krypton.Toolkit.KryptonButton();
+ guidLabel = new Krypton.Toolkit.KryptonLabel();
+ bookTypeLabel = new Krypton.Toolkit.KryptonLabel();
+ guidTxt = new Krypton.Toolkit.KryptonTextBox();
+ titleLabel = new Krypton.Toolkit.KryptonLabel();
+ titleTxt = new Krypton.Toolkit.KryptonTextBox();
+ authorLabel = new Krypton.Toolkit.KryptonLabel();
+ descriptionLabel = new Krypton.Toolkit.KryptonLabel();
+ filePathLabel = new Krypton.Toolkit.KryptonLabel();
+ descriptionTxt = new Krypton.Toolkit.KryptonTextBox();
+ authorTxt = new Krypton.Toolkit.KryptonTextBox();
+ filePathTxt = new Krypton.Toolkit.KryptonTextBox();
+ statusLabel = new Krypton.Toolkit.KryptonLabel();
+ bookTypeTxt = new Krypton.Toolkit.KryptonTextBox();
+ kryptonPanel2 = new Krypton.Toolkit.KryptonPanel();
+ mainPanel = new TableLayoutPanel();
+ topPanel = new TableLayoutPanel();
+ searchPanel = new TableLayoutPanel();
+ createBut = new Krypton.Toolkit.KryptonButton();
+ resetBut = new Krypton.Toolkit.KryptonButton();
+ searchBut = new Krypton.Toolkit.KryptonButton();
+ guidSearchLabel = new Krypton.Toolkit.KryptonLabel();
+ guidSearchTxt = new Krypton.Toolkit.KryptonTextBox();
+ permissionNameSearchBut = new Krypton.Toolkit.ButtonSpecAny();
+ kryptonPanel1 = new Krypton.Toolkit.KryptonPanel();
+ bottomPanel = new TableLayoutPanel();
+ savePanel = new TableLayoutPanel();
+ cancelBut = new Krypton.Toolkit.KryptonButton();
+ saveBut = new Krypton.Toolkit.KryptonButton();
+ operationPanel = new TableLayoutPanel();
+ deleteBut = new Krypton.Toolkit.KryptonButton();
+ amendBut = new Krypton.Toolkit.KryptonButton();
+ contentPanel.SuspendLayout();
+ tableLayoutPanel3.SuspendLayout();
+ tableLayoutPanel4.SuspendLayout();
+ tabControl1.SuspendLayout();
+ tabPage1.SuspendLayout();
+ tableLayoutPanel5.SuspendLayout();
+ tableLayoutPanel1.SuspendLayout();
+ tableLayoutPanel6.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)sentenceGv).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)dataGv).BeginInit();
+ tableLayoutPanel2.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)statusCombo).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)kryptonPanel2).BeginInit();
+ mainPanel.SuspendLayout();
+ topPanel.SuspendLayout();
+ searchPanel.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)kryptonPanel1).BeginInit();
+ bottomPanel.SuspendLayout();
+ savePanel.SuspendLayout();
+ operationPanel.SuspendLayout();
+ SuspendLayout();
+ //
+ // contentPanel
+ //
+ contentPanel.ColumnCount = 1;
+ contentPanel.ColumnStyles.Add(new ColumnStyle());
+ contentPanel.Controls.Add(tableLayoutPanel3, 0, 2);
+ contentPanel.Controls.Add(tableLayoutPanel2, 0, 0);
+ contentPanel.Controls.Add(kryptonPanel2, 0, 1);
+ contentPanel.Dock = DockStyle.Fill;
+ contentPanel.Location = new Point(3, 51);
+ contentPanel.Name = "contentPanel";
+ contentPanel.RowCount = 3;
+ contentPanel.RowStyles.Add(new RowStyle());
+ contentPanel.RowStyles.Add(new RowStyle());
+ contentPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
+ contentPanel.Size = new Size(1018, 672);
+ contentPanel.TabIndex = 3;
+ //
+ // tableLayoutPanel3
+ //
+ tableLayoutPanel3.BackColor = SystemColors.Control;
+ tableLayoutPanel3.ColumnCount = 1;
+ tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle());
+ tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F));
+ tableLayoutPanel3.Controls.Add(tableLayoutPanel4, 0, 0);
+ tableLayoutPanel3.Dock = DockStyle.Fill;
+ tableLayoutPanel3.Location = new Point(3, 207);
+ tableLayoutPanel3.Name = "tableLayoutPanel3";
+ tableLayoutPanel3.RowCount = 1;
+ tableLayoutPanel3.RowStyles.Add(new RowStyle());
+ tableLayoutPanel3.Size = new Size(1018, 462);
+ tableLayoutPanel3.TabIndex = 2;
+ //
+ // tableLayoutPanel4
+ //
+ tableLayoutPanel4.ColumnCount = 1;
+ tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
+ tableLayoutPanel4.Controls.Add(kryptonHeader1, 0, 0);
+ tableLayoutPanel4.Controls.Add(tabControl1, 0, 1);
+ tableLayoutPanel4.Dock = DockStyle.Fill;
+ tableLayoutPanel4.Location = new Point(0, 0);
+ tableLayoutPanel4.Margin = new Padding(0);
+ tableLayoutPanel4.Name = "tableLayoutPanel4";
+ tableLayoutPanel4.RowCount = 2;
+ tableLayoutPanel4.RowStyles.Add(new RowStyle());
+ tableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
+ tableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
+ tableLayoutPanel4.Size = new Size(1018, 463);
+ tableLayoutPanel4.TabIndex = 1;
+ //
+ // kryptonHeader1
+ //
+ kryptonHeader1.Dock = DockStyle.Top;
+ kryptonHeader1.Location = new Point(0, 0);
+ kryptonHeader1.Margin = new Padding(0);
+ kryptonHeader1.Name = "kryptonHeader1";
+ kryptonHeader1.Size = new Size(1018, 31);
+ kryptonHeader1.TabIndex = 0;
+ kryptonHeader1.Values.Description = "";
+ kryptonHeader1.Values.Heading = "小说明细";
+ kryptonHeader1.Values.Image = null;
+ //
+ // tabControl1
+ //
+ tabControl1.Controls.Add(tabPage1);
+ tabControl1.Controls.Add(tabPage2);
+ tabControl1.Dock = DockStyle.Fill;
+ tabControl1.Location = new Point(3, 34);
+ tabControl1.Name = "tabControl1";
+ tabControl1.SelectedIndex = 0;
+ tabControl1.Size = new Size(1012, 426);
+ tabControl1.TabIndex = 1;
+ //
+ // tabPage1
+ //
+ tabPage1.Controls.Add(tableLayoutPanel5);
+ tabPage1.Location = new Point(4, 24);
+ tabPage1.Name = "tabPage1";
+ tabPage1.Padding = new Padding(3);
+ tabPage1.Size = new Size(1004, 398);
+ tabPage1.TabIndex = 0;
+ tabPage1.Text = "章节";
+ tabPage1.UseVisualStyleBackColor = true;
+ //
+ // tableLayoutPanel5
+ //
+ tableLayoutPanel5.ColumnCount = 1;
+ tableLayoutPanel5.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
+ tableLayoutPanel5.Controls.Add(tableLayoutPanel1, 0, 1);
+ tableLayoutPanel5.Controls.Add(tableLayoutPanel6, 0, 0);
+ tableLayoutPanel5.Dock = DockStyle.Fill;
+ tableLayoutPanel5.Location = new Point(3, 3);
+ tableLayoutPanel5.Name = "tableLayoutPanel5";
+ tableLayoutPanel5.RowCount = 2;
+ tableLayoutPanel5.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
+ tableLayoutPanel5.RowStyles.Add(new RowStyle());
+ tableLayoutPanel5.Size = new Size(998, 392);
+ tableLayoutPanel5.TabIndex = 0;
+ //
+ // tableLayoutPanel1
+ //
+ tableLayoutPanel1.AutoSize = true;
+ tableLayoutPanel1.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ tableLayoutPanel1.ColumnCount = 2;
+ tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle());
+ tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle());
+ tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F));
+ tableLayoutPanel1.Controls.Add(delBut, 1, 0);
+ tableLayoutPanel1.Controls.Add(addBut, 0, 0);
+ tableLayoutPanel1.Location = new Point(3, 358);
+ tableLayoutPanel1.Name = "tableLayoutPanel1";
+ tableLayoutPanel1.RowCount = 1;
+ tableLayoutPanel1.RowStyles.Add(new RowStyle());
+ tableLayoutPanel1.Size = new Size(92, 31);
+ tableLayoutPanel1.TabIndex = 0;
+ //
+ // delBut
+ //
+ delBut.Location = new Point(49, 3);
+ delBut.Name = "delBut";
+ delBut.Size = new Size(40, 25);
+ delBut.TabIndex = 2;
+ delBut.Values.Image = Properties.Resources.navigate_minus;
+ delBut.Values.Text = "";
+ delBut.Click += delBut_Click;
+ //
+ // addBut
+ //
+ addBut.Location = new Point(3, 3);
+ addBut.Name = "addBut";
+ addBut.Size = new Size(40, 25);
+ addBut.TabIndex = 1;
+ addBut.Values.Image = Properties.Resources.navigate_plus;
+ addBut.Values.Text = "";
+ addBut.Click += addBut_Click;
+ //
+ // tableLayoutPanel6
+ //
+ tableLayoutPanel6.ColumnCount = 2;
+ tableLayoutPanel6.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
+ tableLayoutPanel6.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
+ tableLayoutPanel6.Controls.Add(gridViewPagination, 0, 1);
+ tableLayoutPanel6.Controls.Add(sentenceGv, 1, 0);
+ tableLayoutPanel6.Controls.Add(dataGv, 0, 0);
+ tableLayoutPanel6.Dock = DockStyle.Fill;
+ tableLayoutPanel6.Location = new Point(3, 3);
+ tableLayoutPanel6.Name = "tableLayoutPanel6";
+ tableLayoutPanel6.RowCount = 2;
+ tableLayoutPanel6.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
+ tableLayoutPanel6.RowStyles.Add(new RowStyle());
+ tableLayoutPanel6.Size = new Size(992, 349);
+ tableLayoutPanel6.TabIndex = 1;
+ //
+ // gridViewPagination
+ //
+ gridViewPagination.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ gridViewPagination.CurrentPage = 0;
+ gridViewPagination.Dock = DockStyle.Fill;
+ gridViewPagination.Limit = 20;
+ gridViewPagination.Location = new Point(0, 319);
+ gridViewPagination.Margin = new Padding(0);
+ gridViewPagination.Name = "gridViewPagination";
+ gridViewPagination.Page = 0;
+ gridViewPagination.Size = new Size(496, 30);
+ gridViewPagination.TabIndex = 1000;
+ gridViewPagination.Total = 0;
+ //
+ // sentenceGv
+ //
+ sentenceGv.AllowUserToAddRows = false;
+ sentenceGv.AllowUserToDeleteRows = false;
+ sentenceGv.BorderStyle = BorderStyle.None;
+ sentenceGv.Columns.AddRange(new DataGridViewColumn[] { sentenceIndexCol, dialogueIndcCol, personNameCol, sentenceContentCol, genderCol, sentimentCol, sentenceStatusCol });
+ sentenceGv.Dock = DockStyle.Fill;
+ sentenceGv.Location = new Point(504, 0);
+ sentenceGv.Margin = new Padding(8, 0, 0, 0);
+ sentenceGv.Name = "sentenceGv";
+ tableLayoutPanel6.SetRowSpan(sentenceGv, 2);
+ sentenceGv.Size = new Size(488, 349);
+ sentenceGv.TabIndex = 4;
+ //
+ // sentenceIndexCol
+ //
+ sentenceIndexCol.DataPropertyName = "ParagraphIndex";
+ sentenceIndexCol.HeaderText = "序号";
+ sentenceIndexCol.Name = "sentenceIndexCol";
+ //
+ // dialogueIndcCol
+ //
+ dialogueIndcCol.DataPropertyName = "DialogueIndc";
+ dataGridViewCellStyle1.Alignment = DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle1.NullValue = false;
+ dialogueIndcCol.DefaultCellStyle = dataGridViewCellStyle1;
+ dialogueIndcCol.FalseValue = "Y";
+ dialogueIndcCol.HeaderText = "旁白?";
+ dialogueIndcCol.IndeterminateValue = null;
+ dialogueIndcCol.Name = "dialogueIndcCol";
+ dialogueIndcCol.TrueValue = "N";
+ //
+ // personNameCol
+ //
+ personNameCol.DataPropertyName = "PersonName";
+ personNameCol.DefaultCellStyle = dataGridViewCellStyle2;
+ personNameCol.HeaderText = "人名";
+ personNameCol.Name = "personNameCol";
+ personNameCol.Width = 100;
+ //
+ // sentenceContentCol
+ //
+ sentenceContentCol.DataPropertyName = "Content";
+ sentenceContentCol.HeaderText = "内容";
+ sentenceContentCol.Name = "sentenceContentCol";
+ sentenceContentCol.Width = 300;
+ //
+ // genderCol
+ //
+ genderCol.DataPropertyName = "Gender";
+ genderCol.DefaultCellStyle = dataGridViewCellStyle3;
+ genderCol.HeaderText = "性别";
+ genderCol.Name = "genderCol";
+ genderCol.Width = 100;
+ //
+ // sentimentCol
+ //
+ sentimentCol.DataPropertyName = "Sentiment";
+ sentimentCol.DefaultCellStyle = dataGridViewCellStyle4;
+ sentimentCol.HeaderText = "情感";
+ sentimentCol.Name = "sentimentCol";
+ sentimentCol.Width = 100;
+ //
+ // sentenceStatusCol
+ //
+ sentenceStatusCol.DataPropertyName = "Status";
+ sentenceStatusCol.DataSource = null;
+ sentenceStatusCol.DropDownWidth = 121;
+ sentenceStatusCol.HeaderText = "状态";
+ sentenceStatusCol.Name = "sentenceStatusCol";
+ sentenceStatusCol.Width = 100;
+ //
+ // dataGv
+ //
+ dataGv.AllowUserToAddRows = false;
+ dataGv.AllowUserToDeleteRows = false;
+ dataGv.BorderStyle = BorderStyle.None;
+ dataGv.Columns.AddRange(new DataGridViewColumn[] { chapterIndexCol, titleCol, contentCol, statusCol });
+ dataGv.Dock = DockStyle.Fill;
+ dataGv.Location = new Point(0, 0);
+ dataGv.Margin = new Padding(0);
+ dataGv.Name = "dataGv";
+ dataGv.Size = new Size(496, 319);
+ dataGv.TabIndex = 3;
+ dataGv.CellClick += dataGv_CellClick;
+ //
+ // chapterIndexCol
+ //
+ chapterIndexCol.DataPropertyName = "ChapterIndex";
+ chapterIndexCol.HeaderText = "序号";
+ chapterIndexCol.Name = "chapterIndexCol";
+ chapterIndexCol.Width = 80;
+ //
+ // titleCol
+ //
+ titleCol.DataPropertyName = "Title";
+ titleCol.HeaderText = "标题";
+ titleCol.Name = "titleCol";
+ titleCol.Width = 200;
+ //
+ // contentCol
+ //
+ contentCol.DataPropertyName = "Content";
+ contentCol.HeaderText = "内容";
+ contentCol.Name = "contentCol";
+ contentCol.Width = 160;
+ //
+ // statusCol
+ //
+ statusCol.DataPropertyName = "Status";
+ statusCol.HeaderText = "状态";
+ statusCol.Name = "statusCol";
+ statusCol.Width = 80;
+ //
+ // tabPage2
+ //
+ tabPage2.Location = new Point(4, 24);
+ tabPage2.Name = "tabPage2";
+ tabPage2.Padding = new Padding(3);
+ tabPage2.Size = new Size(1004, 398);
+ tabPage2.TabIndex = 1;
+ tabPage2.Text = "段落";
+ tabPage2.UseVisualStyleBackColor = true;
+ //
+ // tableLayoutPanel2
+ //
+ tableLayoutPanel2.AutoSize = true;
+ tableLayoutPanel2.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ tableLayoutPanel2.ColumnCount = 5;
+ tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle());
+ tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle());
+ tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle());
+ tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle());
+ tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F));
+ tableLayoutPanel2.Controls.Add(statusCombo, 3, 0);
+ tableLayoutPanel2.Controls.Add(processBut, 3, 3);
+ tableLayoutPanel2.Controls.Add(uploadBut, 2, 3);
+ tableLayoutPanel2.Controls.Add(guidLabel, 0, 0);
+ tableLayoutPanel2.Controls.Add(bookTypeLabel, 0, 4);
+ tableLayoutPanel2.Controls.Add(guidTxt, 1, 0);
+ tableLayoutPanel2.Controls.Add(titleLabel, 0, 1);
+ tableLayoutPanel2.Controls.Add(titleTxt, 1, 1);
+ tableLayoutPanel2.Controls.Add(authorLabel, 2, 1);
+ tableLayoutPanel2.Controls.Add(descriptionLabel, 0, 2);
+ tableLayoutPanel2.Controls.Add(filePathLabel, 0, 3);
+ tableLayoutPanel2.Controls.Add(descriptionTxt, 1, 2);
+ tableLayoutPanel2.Controls.Add(authorTxt, 3, 1);
+ tableLayoutPanel2.Controls.Add(filePathTxt, 1, 3);
+ tableLayoutPanel2.Controls.Add(statusLabel, 2, 0);
+ tableLayoutPanel2.Controls.Add(bookTypeTxt, 1, 4);
+ tableLayoutPanel2.Dock = DockStyle.Fill;
+ tableLayoutPanel2.Location = new Point(3, 3);
+ tableLayoutPanel2.Name = "tableLayoutPanel2";
+ tableLayoutPanel2.RowCount = 5;
+ tableLayoutPanel2.RowStyles.Add(new RowStyle());
+ tableLayoutPanel2.RowStyles.Add(new RowStyle());
+ tableLayoutPanel2.RowStyles.Add(new RowStyle());
+ tableLayoutPanel2.RowStyles.Add(new RowStyle());
+ tableLayoutPanel2.RowStyles.Add(new RowStyle());
+ tableLayoutPanel2.Size = new Size(1018, 187);
+ tableLayoutPanel2.TabIndex = 0;
+ //
+ // statusCombo
+ //
+ statusCombo.Dock = DockStyle.Fill;
+ statusCombo.DropDownStyle = ComboBoxStyle.DropDownList;
+ statusCombo.DropDownWidth = 300;
+ statusCombo.IntegralHeight = false;
+ statusCombo.Location = new Point(472, 3);
+ statusCombo.Name = "statusCombo";
+ statusCombo.Size = new Size(300, 22);
+ statusCombo.StateCommon.ComboBox.Content.TextH = Krypton.Toolkit.PaletteRelativeAlign.Near;
+ statusCombo.TabIndex = 5;
+ //
+ // processBut
+ //
+ processBut.Location = new Point(472, 130);
+ processBut.Name = "processBut";
+ processBut.Size = new Size(86, 25);
+ processBut.TabIndex = 2;
+ processBut.Values.Image = Properties.Resources.MoveNext;
+ processBut.Values.Text = "拆分章节";
+ processBut.Click += processBut_Click;
+ //
+ // uploadBut
+ //
+ uploadBut.Location = new Point(380, 130);
+ uploadBut.Name = "uploadBut";
+ uploadBut.Size = new Size(86, 25);
+ uploadBut.TabIndex = 2;
+ uploadBut.Values.Image = Properties.Resources.page_white_get;
+ uploadBut.Values.Text = "上传";
+ uploadBut.Click += uploadBut_Click;
+ //
+ // guidLabel
+ //
+ guidLabel.Location = new Point(3, 3);
+ guidLabel.Name = "guidLabel";
+ guidLabel.Size = new Size(65, 20);
+ guidLabel.TabIndex = 1;
+ guidLabel.Values.Text = "小说编号:";
+ //
+ // bookTypeLabel
+ //
+ bookTypeLabel.Location = new Point(3, 161);
+ bookTypeLabel.Name = "bookTypeLabel";
+ bookTypeLabel.Size = new Size(39, 20);
+ bookTypeLabel.TabIndex = 1;
+ bookTypeLabel.Values.Text = "类型:";
+ //
+ // guidTxt
+ //
+ guidTxt.Dock = DockStyle.Fill;
+ guidTxt.Location = new Point(74, 3);
+ guidTxt.MaxLength = 50;
+ guidTxt.Name = "guidTxt";
+ guidTxt.Size = new Size(300, 23);
+ guidTxt.TabIndex = 3;
+ //
+ // titleLabel
+ //
+ titleLabel.Location = new Point(3, 32);
+ titleLabel.Name = "titleLabel";
+ titleLabel.Size = new Size(39, 20);
+ titleLabel.TabIndex = 1;
+ titleLabel.Values.Text = "书名:";
+ //
+ // titleTxt
+ //
+ titleTxt.Dock = DockStyle.Fill;
+ titleTxt.Location = new Point(74, 32);
+ titleTxt.MaxLength = 500;
+ titleTxt.Name = "titleTxt";
+ titleTxt.Size = new Size(300, 23);
+ titleTxt.TabIndex = 3;
+ //
+ // authorLabel
+ //
+ authorLabel.Location = new Point(401, 32);
+ authorLabel.Margin = new Padding(24, 3, 3, 3);
+ authorLabel.Name = "authorLabel";
+ authorLabel.Size = new Size(39, 20);
+ authorLabel.TabIndex = 1;
+ authorLabel.Values.Text = "作者:";
+ //
+ // descriptionLabel
+ //
+ descriptionLabel.Location = new Point(3, 61);
+ descriptionLabel.Name = "descriptionLabel";
+ descriptionLabel.Size = new Size(39, 20);
+ descriptionLabel.TabIndex = 1;
+ descriptionLabel.Values.Text = "描述:";
+ //
+ // filePathLabel
+ //
+ filePathLabel.Location = new Point(3, 130);
+ filePathLabel.Name = "filePathLabel";
+ filePathLabel.Size = new Size(52, 20);
+ filePathLabel.TabIndex = 1;
+ filePathLabel.Values.Text = "文件名:";
+ //
+ // descriptionTxt
+ //
+ tableLayoutPanel2.SetColumnSpan(descriptionTxt, 3);
+ descriptionTxt.Dock = DockStyle.Fill;
+ descriptionTxt.Location = new Point(74, 61);
+ descriptionTxt.MaxLength = 500;
+ descriptionTxt.Multiline = true;
+ descriptionTxt.Name = "descriptionTxt";
+ descriptionTxt.Size = new Size(698, 63);
+ descriptionTxt.TabIndex = 3;
+ //
+ // authorTxt
+ //
+ authorTxt.Dock = DockStyle.Fill;
+ authorTxt.Location = new Point(472, 32);
+ authorTxt.MaxLength = 500;
+ authorTxt.Name = "authorTxt";
+ authorTxt.Size = new Size(300, 23);
+ authorTxt.TabIndex = 3;
+ //
+ // filePathTxt
+ //
+ filePathTxt.Location = new Point(74, 130);
+ filePathTxt.MaxLength = 50;
+ filePathTxt.Name = "filePathTxt";
+ filePathTxt.Size = new Size(300, 23);
+ filePathTxt.TabIndex = 3;
+ //
+ // statusLabel
+ //
+ statusLabel.Location = new Point(401, 3);
+ statusLabel.Margin = new Padding(24, 3, 3, 3);
+ statusLabel.Name = "statusLabel";
+ statusLabel.Size = new Size(39, 20);
+ statusLabel.TabIndex = 1;
+ statusLabel.Values.Text = "状态:";
+ //
+ // bookTypeTxt
+ //
+ bookTypeTxt.Location = new Point(74, 161);
+ bookTypeTxt.MaxLength = 50;
+ bookTypeTxt.Name = "bookTypeTxt";
+ bookTypeTxt.Size = new Size(300, 23);
+ bookTypeTxt.TabIndex = 3;
+ //
+ // kryptonPanel2
+ //
+ kryptonPanel2.Dock = DockStyle.Fill;
+ kryptonPanel2.Location = new Point(3, 196);
+ kryptonPanel2.Name = "kryptonPanel2";
+ kryptonPanel2.Size = new Size(1018, 5);
+ kryptonPanel2.TabIndex = 1;
+ //
+ // mainPanel
+ //
+ mainPanel.ColumnCount = 1;
+ mainPanel.ColumnStyles.Add(new ColumnStyle());
+ mainPanel.Controls.Add(topPanel, 0, 0);
+ mainPanel.Controls.Add(kryptonPanel1, 0, 1);
+ mainPanel.Controls.Add(bottomPanel, 0, 3);
+ mainPanel.Controls.Add(contentPanel, 0, 2);
+ mainPanel.Dock = DockStyle.Fill;
+ mainPanel.Location = new Point(0, 0);
+ mainPanel.Name = "mainPanel";
+ mainPanel.RowCount = 4;
+ mainPanel.RowStyles.Add(new RowStyle());
+ mainPanel.RowStyles.Add(new RowStyle());
+ mainPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
+ mainPanel.RowStyles.Add(new RowStyle());
+ mainPanel.Size = new Size(1024, 800);
+ mainPanel.TabIndex = 1;
+ //
+ // topPanel
+ //
+ topPanel.AutoSize = true;
+ topPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ topPanel.ColumnCount = 3;
+ topPanel.ColumnStyles.Add(new ColumnStyle());
+ topPanel.ColumnStyles.Add(new ColumnStyle());
+ topPanel.ColumnStyles.Add(new ColumnStyle());
+ topPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F));
+ topPanel.Controls.Add(searchPanel, 3, 0);
+ topPanel.Controls.Add(guidSearchLabel, 0, 0);
+ topPanel.Controls.Add(guidSearchTxt, 1, 0);
+ topPanel.Dock = DockStyle.Fill;
+ topPanel.Location = new Point(3, 3);
+ topPanel.Name = "topPanel";
+ topPanel.RowCount = 1;
+ topPanel.RowStyles.Add(new RowStyle());
+ topPanel.Size = new Size(1018, 31);
+ topPanel.TabIndex = 0;
+ //
+ // searchPanel
+ //
+ searchPanel.AutoSize = true;
+ searchPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ searchPanel.ColumnCount = 3;
+ searchPanel.ColumnStyles.Add(new ColumnStyle());
+ searchPanel.ColumnStyles.Add(new ColumnStyle());
+ searchPanel.ColumnStyles.Add(new ColumnStyle());
+ searchPanel.Controls.Add(createBut, 2, 0);
+ searchPanel.Controls.Add(resetBut, 1, 0);
+ searchPanel.Controls.Add(searchBut, 0, 0);
+ searchPanel.Location = new Point(437, 0);
+ searchPanel.Margin = new Padding(60, 0, 0, 0);
+ searchPanel.Name = "searchPanel";
+ searchPanel.RowCount = 1;
+ searchPanel.RowStyles.Add(new RowStyle());
+ searchPanel.Size = new Size(288, 31);
+ searchPanel.TabIndex = 0;
+ //
+ // createBut
+ //
+ createBut.Location = new Point(195, 3);
+ createBut.Name = "createBut";
+ createBut.Size = new Size(90, 25);
+ createBut.TabIndex = 3;
+ createBut.Values.Image = Properties.Resources.create_16;
+ createBut.Values.Text = "新增(&C)";
+ createBut.Click += createBut_Click;
+ //
+ // resetBut
+ //
+ resetBut.Location = new Point(99, 3);
+ resetBut.Name = "resetBut";
+ resetBut.Size = new Size(90, 25);
+ resetBut.TabIndex = 2;
+ resetBut.Values.Image = Properties.Resources.reset_16;
+ resetBut.Values.Text = "重置(&R)";
+ resetBut.Click += resetBut_Click;
+ //
+ // searchBut
+ //
+ searchBut.Location = new Point(3, 3);
+ searchBut.Name = "searchBut";
+ searchBut.Size = new Size(90, 25);
+ searchBut.TabIndex = 1;
+ searchBut.Values.Image = Properties.Resources.search_16;
+ searchBut.Values.Text = "查询(&S)";
+ searchBut.Click += searchBut_Click;
+ //
+ // guidSearchLabel
+ //
+ guidSearchLabel.Location = new Point(3, 3);
+ guidSearchLabel.Name = "guidSearchLabel";
+ guidSearchLabel.Size = new Size(65, 20);
+ guidSearchLabel.TabIndex = 1;
+ guidSearchLabel.Values.Text = "小说编号:";
+ //
+ // guidSearchTxt
+ //
+ guidSearchTxt.ButtonSpecs.Add(permissionNameSearchBut);
+ guidSearchTxt.Location = new Point(74, 3);
+ guidSearchTxt.Name = "guidSearchTxt";
+ guidSearchTxt.Size = new Size(300, 23);
+ guidSearchTxt.TabIndex = 2;
+ //
+ // permissionNameSearchBut
+ //
+ permissionNameSearchBut.Type = Krypton.Toolkit.PaletteButtonSpecStyle.WorkspaceMaximize;
+ permissionNameSearchBut.UniqueName = "3a322a66645f4aff808be4720c638ad8";
+ permissionNameSearchBut.Click += permissionNameSearchBut_Click;
+ //
+ // kryptonPanel1
+ //
+ kryptonPanel1.Dock = DockStyle.Fill;
+ kryptonPanel1.Location = new Point(3, 40);
+ kryptonPanel1.Name = "kryptonPanel1";
+ kryptonPanel1.Size = new Size(1018, 5);
+ kryptonPanel1.TabIndex = 1;
+ //
+ // bottomPanel
+ //
+ bottomPanel.AutoSize = true;
+ bottomPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ bottomPanel.ColumnCount = 1;
+ bottomPanel.ColumnStyles.Add(new ColumnStyle());
+ bottomPanel.Controls.Add(savePanel, 0, 0);
+ bottomPanel.Controls.Add(operationPanel, 0, 1);
+ bottomPanel.Location = new Point(0, 726);
+ bottomPanel.Margin = new Padding(0);
+ bottomPanel.Name = "bottomPanel";
+ bottomPanel.RowCount = 2;
+ bottomPanel.RowStyles.Add(new RowStyle());
+ bottomPanel.RowStyles.Add(new RowStyle());
+ bottomPanel.Size = new Size(198, 74);
+ bottomPanel.TabIndex = 2;
+ //
+ // savePanel
+ //
+ savePanel.AutoSize = true;
+ savePanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ savePanel.ColumnCount = 2;
+ savePanel.ColumnStyles.Add(new ColumnStyle());
+ savePanel.ColumnStyles.Add(new ColumnStyle());
+ savePanel.Controls.Add(cancelBut, 1, 0);
+ savePanel.Controls.Add(saveBut, 0, 0);
+ savePanel.Location = new Point(3, 3);
+ savePanel.Name = "savePanel";
+ savePanel.RowCount = 1;
+ savePanel.RowStyles.Add(new RowStyle());
+ savePanel.Size = new Size(192, 31);
+ savePanel.TabIndex = 0;
+ //
+ // cancelBut
+ //
+ cancelBut.Location = new Point(99, 3);
+ cancelBut.Name = "cancelBut";
+ cancelBut.Size = new Size(90, 25);
+ cancelBut.TabIndex = 2;
+ cancelBut.Values.Image = Properties.Resources.cancel_16;
+ cancelBut.Values.Text = "取消(&L)";
+ cancelBut.Click += cancelBut_Click;
+ //
+ // saveBut
+ //
+ saveBut.Location = new Point(3, 3);
+ saveBut.Name = "saveBut";
+ saveBut.Size = new Size(90, 25);
+ saveBut.TabIndex = 1;
+ saveBut.Values.Image = Properties.Resources.save_16;
+ saveBut.Values.Text = "保存(&S)";
+ saveBut.Click += saveBut_Click;
+ //
+ // operationPanel
+ //
+ operationPanel.AutoSize = true;
+ operationPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ operationPanel.ColumnCount = 2;
+ operationPanel.ColumnStyles.Add(new ColumnStyle());
+ operationPanel.ColumnStyles.Add(new ColumnStyle());
+ operationPanel.Controls.Add(deleteBut, 1, 0);
+ operationPanel.Controls.Add(amendBut, 0, 0);
+ operationPanel.Location = new Point(3, 40);
+ operationPanel.Name = "operationPanel";
+ operationPanel.RowCount = 1;
+ operationPanel.RowStyles.Add(new RowStyle());
+ operationPanel.Size = new Size(192, 31);
+ operationPanel.TabIndex = 0;
+ //
+ // deleteBut
+ //
+ deleteBut.Location = new Point(99, 3);
+ deleteBut.Name = "deleteBut";
+ deleteBut.Size = new Size(90, 25);
+ deleteBut.TabIndex = 2;
+ deleteBut.Values.Image = Properties.Resources.delete_16;
+ deleteBut.Values.Text = "删除(&D)";
+ deleteBut.Click += deleteBut_Click;
+ //
+ // amendBut
+ //
+ amendBut.Location = new Point(3, 3);
+ amendBut.Name = "amendBut";
+ amendBut.Size = new Size(90, 25);
+ amendBut.TabIndex = 1;
+ amendBut.Values.Image = Properties.Resources.amend_16;
+ amendBut.Values.Text = "修改(&M)";
+ amendBut.Click += amendBut_Click;
+ //
+ // AiBookOperationPage
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(mainPanel);
+ Name = "AiBookOperationPage";
+ contentPanel.ResumeLayout(false);
+ contentPanel.PerformLayout();
+ tableLayoutPanel3.ResumeLayout(false);
+ tableLayoutPanel4.ResumeLayout(false);
+ tableLayoutPanel4.PerformLayout();
+ tabControl1.ResumeLayout(false);
+ tabPage1.ResumeLayout(false);
+ tableLayoutPanel5.ResumeLayout(false);
+ tableLayoutPanel5.PerformLayout();
+ tableLayoutPanel1.ResumeLayout(false);
+ tableLayoutPanel6.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)sentenceGv).EndInit();
+ ((System.ComponentModel.ISupportInitialize)dataGv).EndInit();
+ tableLayoutPanel2.ResumeLayout(false);
+ tableLayoutPanel2.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)statusCombo).EndInit();
+ ((System.ComponentModel.ISupportInitialize)kryptonPanel2).EndInit();
+ mainPanel.ResumeLayout(false);
+ mainPanel.PerformLayout();
+ topPanel.ResumeLayout(false);
+ topPanel.PerformLayout();
+ searchPanel.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)kryptonPanel1).EndInit();
+ bottomPanel.ResumeLayout(false);
+ bottomPanel.PerformLayout();
+ savePanel.ResumeLayout(false);
+ operationPanel.ResumeLayout(false);
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private TableLayoutPanel contentPanel;
+ private TableLayoutPanel tableLayoutPanel3;
+ private TableLayoutPanel tableLayoutPanel4;
+ private Krypton.Toolkit.KryptonHeader kryptonHeader1;
+ private TableLayoutPanel tableLayoutPanel2;
+ private Krypton.Toolkit.KryptonLabel guidLabel;
+ private Krypton.Toolkit.KryptonLabel descriptionLabel;
+ private Krypton.Toolkit.KryptonLabel bookTypeLabel;
+ private Krypton.Toolkit.KryptonTextBox guidTxt;
+ private Krypton.Toolkit.KryptonTextBox descriptionTxt;
+ private Krypton.Toolkit.KryptonPanel kryptonPanel2;
+ private TableLayoutPanel mainPanel;
+ private TableLayoutPanel topPanel;
+ private TableLayoutPanel searchPanel;
+ private Krypton.Toolkit.KryptonButton createBut;
+ private Krypton.Toolkit.KryptonButton resetBut;
+ private Krypton.Toolkit.KryptonButton searchBut;
+ private Krypton.Toolkit.KryptonLabel guidSearchLabel;
+ private Krypton.Toolkit.KryptonTextBox guidSearchTxt;
+ private Krypton.Toolkit.ButtonSpecAny permissionNameSearchBut;
+ private Krypton.Toolkit.KryptonPanel kryptonPanel1;
+ private TableLayoutPanel bottomPanel;
+ private TableLayoutPanel savePanel;
+ private Krypton.Toolkit.KryptonButton cancelBut;
+ private Krypton.Toolkit.KryptonButton saveBut;
+ private TableLayoutPanel operationPanel;
+ private Krypton.Toolkit.KryptonButton deleteBut;
+ private Krypton.Toolkit.KryptonButton amendBut;
+ private Krypton.Toolkit.KryptonLabel titleLabel;
+ private Krypton.Toolkit.KryptonTextBox titleTxt;
+ private Krypton.Toolkit.KryptonLabel authorLabel;
+ private Krypton.Toolkit.KryptonTextBox authorTxt;
+ private Krypton.Toolkit.KryptonLabel filePathLabel;
+ private Krypton.Toolkit.KryptonButton uploadBut;
+ private Krypton.Toolkit.KryptonTextBox filePathTxt;
+ private Krypton.Toolkit.KryptonLabel statusLabel;
+ private Krypton.Toolkit.KryptonComboBox statusCombo;
+ private TableLayoutPanel tableLayoutPanel1;
+ private Krypton.Toolkit.KryptonButton delBut;
+ private Krypton.Toolkit.KryptonButton addBut;
+ private TabControl tabControl1;
+ private TabPage tabPage1;
+ private TableLayoutPanel tableLayoutPanel5;
+ private TabPage tabPage2;
+ private Krypton.Toolkit.KryptonButton processBut;
+ private Krypton.Toolkit.KryptonDataGridView dataGv;
+ private TableLayoutPanel tableLayoutPanel6;
+ private Krypton.Toolkit.KryptonDataGridView sentenceGv;
+ private Krypton.Toolkit.KryptonTextBox bookTypeTxt;
+ private DataGridViewTextBoxColumn chapterIndexCol;
+ private DataGridViewTextBoxColumn titleCol;
+ private DataGridViewTextBoxColumn contentCol;
+ private DataGridViewTextBoxColumn statusCol;
+ private CloudBuilder.Gui.GridViewPagination gridViewPagination;
+ private DataGridViewTextBoxColumn sentenceIndexCol;
+ private Krypton.Toolkit.KryptonDataGridViewCheckBoxColumn dialogueIndcCol;
+ private Krypton.Toolkit.KryptonDataGridViewTextBoxColumn personNameCol;
+ private DataGridViewTextBoxColumn sentenceContentCol;
+ private Krypton.Toolkit.KryptonDataGridViewTextBoxColumn genderCol;
+ private Krypton.Toolkit.KryptonDataGridViewTextBoxColumn sentimentCol;
+ private Krypton.Toolkit.KryptonDataGridViewComboBoxColumn sentenceStatusCol;
+ }
+}
diff --git a/CloudBuilder.AI.Gui/AiBookOperationPage.cs b/CloudBuilder.AI.Gui/AiBookOperationPage.cs
new file mode 100644
index 0000000..9e0585d
--- /dev/null
+++ b/CloudBuilder.AI.Gui/AiBookOperationPage.cs
@@ -0,0 +1,764 @@
+using CloudBuilder.AI.Data;
+using CloudBuilder.AI.Entity;
+using CloudBuilder.AI.Gui.Request;
+using CloudBuilder.AI.Linkup;
+using CloudBuilder.AI.Policy;
+using CloudBuilder.AI.SearchCriteria;
+using CloudBuilder.Core.Service;
+using CloudBuilder.Gui;
+using CloudBuilder.Request.AI;
+using CloudBuilder.Request.Security;
+using CloudBuilder.Security.Data;
+using CloudBuilder.Security.Entity;
+using CloudBuilder.Security.Linkup;
+using CloudBuilder.Security.Policy;
+using DocumentFormat.OpenXml.Wordprocessing;
+using Krypton.Toolkit;
+using Microsoft.AspNetCore.Authorization;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Security.Permissions;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
+
+
+namespace CloudBuilder.AI.Gui
+{
+ public partial class AiBookOperationPage : AbstractPage
+ {
+ private SecurityMessagePolicy securityMessagePolicy = null!;
+ private BookStatusPolicy bookStatusPolicy = null!;
+ private AiBookRequest aiBookRequest = null!;
+ private AiSentenceRequest aiSentenceRequest = null!;
+ private AiChapterRequest aiChapterRequest = null!;
+ private AiBookEntity aiBookEntity = null!;
+ private AiBookData data = null!;
+ private DmsFileRequestHelper dmsFileRequestHelper;
+ private DmsFileRequest dmsFileRequest;
+ private AiChapterSearchCriteria searchCriteria;
+ public AiBookOperationPage()
+ {
+ InitializeComponent();
+ }
+
+
+ ///
+ /// 第一次加载时执行,只执行一次
+ ///
+ public override void FunctionLoaded()
+ {
+ try
+ {
+ base.FunctionLoaded();
+ //初始化容器-------------------------------------
+ aiBookRequest = ServiceHelper.GetTypeService();
+ aiChapterRequest = ServiceHelper.GetTypeService();
+ aiSentenceRequest = ServiceHelper.GetTypeService();
+ bookStatusPolicy = ServiceHelper.GetTypeService();
+ securityMessagePolicy = ServiceHelper.GetTypeService();
+ dmsFileRequest = ServiceHelper.GetTypeService();
+ dmsFileRequestHelper = new DmsFileRequestHelper();
+ //界面初始化
+ InitGui();
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+
+ private void InitGui()
+ {
+ InitBindingContext();
+
+ InitComBox();
+
+ InitDisplayMode();
+
+ InitGridViewPagination();
+
+ this.ParentAbstractForm.AcceptButton = this.searchBut;
+ this.ParentAbstractForm.CancelButton = this.resetBut;
+ }
+
+ private void InitComBox()
+ {
+ statusCombo.SetDataSource(bookStatusPolicy.GetDataSource(), true);
+ }
+ ///
+ /// DataGridView分页控件初始化
+ ///
+ private void InitGridViewPagination()
+ {
+ searchCriteria = new AiChapterSearchCriteria();
+ gridViewPagination.SetLimit(searchCriteria.limit);
+ gridViewPagination.OnPaginationChanged += SearchChapter;
+ }
+
+ ///
+ /// 有特殊要求的UI控件初始化设置,Init与Add配对后,使用guiOperateHelper管理
+ ///
+ private void InitBindingContext()
+ {
+ //需要绑定数据
+ guiBindingContext = new GuiBindingContext();
+
+ InitPermission();
+
+ guidTxt.Set(AiBookEntity.GUID, guidLabel.Text, EnumEditModeColor.ReadOnly);
+
+ descriptionTxt.Set(AiBookEntity.DESCRIPTION);
+ statusCombo.Set(AiBookEntity.STATUS, EnumEditModeColor.ReadOnly);
+ titleTxt.Set(AiBookEntity.TITLE, titleLabel.Text, EnumEditModeColor.Required);
+ authorTxt.Set(AiBookEntity.AUTHOR);
+ bookTypeTxt.Set(AiBookEntity.BOOK_TYPE);
+ filePathTxt.Set(AiBookData.FILE_NAME, EnumEditModeColor.ReadOnly);
+
+ dataGv.InitColumn(false, false);
+ sentenceGv.InitColumn(true, false);
+
+ guiOperateHelper = new GuiOperateHelper();
+ }
+
+ private void InitPermission()
+ {
+ createBut.Set(AIPermissionPolicy.AiBook, Operate.Insert);
+ amendBut.Set(AIPermissionPolicy.AiBook, Operate.Update);
+ deleteBut.Set(AIPermissionPolicy.AiBook, Operate.Delete);
+ }
+
+ ///
+ /// 每次从别的界面进入时执行,发生在FunctionLoaded之后
+ ///
+ ///
+ public override void FunctionActivated(object param)
+ {
+ try
+ {
+ if (param == null)
+ {
+ guidSearchTxt.Focus();
+ return;
+ }
+
+ InitDisplayMode();
+
+ AiBookOperationLinkup linkup = null;
+
+ if (param is AiBookOperationLinkup)
+ {
+ linkup = (AiBookOperationLinkup)param;
+ }
+
+ this.DisplayMode = (GuiDisplayMode)linkup.DisplayMode;
+
+ guidSearchTxt.Text = linkup.Guid;
+
+ if (this.DisplayMode == GuiDisplayMode.View)
+ {
+ Search();
+ }
+ else if (this.DisplayMode == GuiDisplayMode.Create)
+ {
+ Create();
+ }
+ else if (this.DisplayMode == GuiDisplayMode.Amend)
+ {
+ Search();
+ Amend();
+ }
+
+ guidSearchTxt.Focus();
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ public override void FunctionSelected()
+ {
+ this.ParentAbstractForm.AcceptButton = this.searchBut;
+ if (!IsDialog)
+ this.ParentAbstractForm.CancelButton = this.resetBut;
+ else
+ this.ParentAbstractForm.CancelButton = this.cancelBut;
+
+ guidSearchTxt.Focus();
+ }
+
+ public override bool FunctionDeactivating()
+ {
+ if (this.DisplayMode == GuiDisplayMode.View)
+ {
+ return true;
+ }
+ else
+ {
+ return CancelEditing();
+ }
+ }
+
+ private bool CancelEditing()
+ {
+ DialogResult result = ShowMessageBox.ShowOption(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_CONFIRM_CANCEL), securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_CONFIRM));
+
+ //从外部跳转(非mainKryptonNavigator),result第一次不生效?,所以再执行一次生效
+ if (result == DialogResult.Cancel)
+ {
+ result = ShowMessageBox.ShowOption(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_CONFIRM_CANCEL), securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_CONFIRM));
+ }
+
+ if (result == DialogResult.No)
+ {
+ return false;
+ }
+
+ Cancel();
+
+ return true;
+ }
+
+ private void InitDisplayMode()
+ {
+ this.DisplayMode = GuiDisplayMode.View;
+
+ SetDisplayMode();
+ }
+
+ private void SetDisplayMode()
+ {
+ if (this.DisplayMode == GuiDisplayMode.View)
+ {
+ savePanel.Visible = false;
+ operationPanel.Visible = true;
+
+ guiOperateHelper.EnableControls(true, topPanel);
+ guiOperateHelper.EnableControls(false, contentPanel);
+ //查詢有記錄時,修改等控件有效
+ if (aiBookEntity != null)
+ guiOperateHelper.EnableControls(true, bottomPanel, uploadBut, processBut, gridViewPagination);
+ else
+ guiOperateHelper.EnableControls(false, bottomPanel, uploadBut, processBut, gridViewPagination);
+ }
+ else if (this.DisplayMode == GuiDisplayMode.Amend || this.DisplayMode == GuiDisplayMode.Create)
+ {
+ savePanel.Visible = true;
+ operationPanel.Visible = false;
+
+ guiOperateHelper.EnableControls(false, topPanel, uploadBut, processBut, gridViewPagination);
+ guiOperateHelper.EnableControls(true, bottomPanel, contentPanel);
+
+ if (this.DisplayMode == GuiDisplayMode.Amend) guiOperateHelper.EnableControls(false, guidTxt);
+ }
+
+ }
+
+ private void PackUIToEntity()
+ {
+ guiBindingContext.DataPack();
+ }
+
+ private bool SaveValidate()
+ {
+ if (!guiOperateHelper.CheckValidate(this.contentPanel)) return false;
+
+ return true;
+ }
+
+ private void Search()
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(guidSearchTxt.Text)) return;
+
+ Reset();
+
+ data = aiBookRequest.FindByKey(guidSearchTxt.Text);
+
+ if (data == null || data.AiBook == null)
+ {
+ ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_WS_RECORD_NOT_FOUND));
+ }
+ else
+ {
+ aiBookEntity = data.AiBook;
+
+ PackEntityToUI();
+
+ SetDisplayMode();
+ }
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+
+ ///
+ /// 与Web同步写法
+ ///
+ ///
+ private AiChapterSearchCriteria PackSearchCriteria()
+ {
+ searchCriteria = new AiChapterSearchCriteria();
+ searchCriteria.limit = gridViewPagination.Limit;
+ searchCriteria.page = gridViewPagination.CurrentPage;
+ searchCriteria.orderby = AiChapterEntity.CHAPTER_INDEX;
+
+ List filters = new List();
+
+ SearchFilter filter = new SearchFilter();
+ filter.Column = AiChapterEntity.DB_BOOK_GUID;
+ filter.Type = SearchFilterTypePolicy.TEXT;
+ filter.Operator = SearchFilterOperatorPolicy.EQUAL_TO;
+ filter.Value = data.AiBook.Guid;
+ filters.Add(filter);
+
+
+ return searchCriteria;
+ }
+
+ private void SearchChapter()
+ {
+ try
+ {
+ var chapterResultData = aiChapterRequest.FindBySearchCriteria(PackSearchCriteria());
+
+ gridViewPagination.SetTotal(chapterResultData.Total);
+
+ dataGv.SetDataSource(chapterResultData.Datas);
+
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ private void Create()
+ {
+ this.DisplayMode = GuiDisplayMode.Create;
+
+ guiOperateHelper.ResetControls(this.mainPanel);
+
+ SetDisplayMode();
+
+ data = new AiBookData();
+ aiBookEntity = new AiBookEntity()
+ {
+ Status = BookStatusPolicy.DRAFT,
+ CreatedBy = string.Empty,
+ UpdatedBy = string.Empty,
+ CreatedDatetime = DateTime.Now,
+ UpdatedDatetime = DateTime.Now,
+ };
+ data.AiBook = aiBookEntity;
+
+ PackEntityToUI();
+
+ guidTxt.Focus();
+ }
+
+ private void Amend()
+ {
+ this.DisplayMode = GuiDisplayMode.Amend;
+
+ SetDisplayMode();
+ }
+
+ private void PackEntityToUI()
+ {
+ guiBindingContext.DataBind(data.AiBook, this);
+
+ filePathTxt.Text = data.FileName;
+
+ SearchChapter();
+ }
+
+ private void Reset()
+ {
+ this.DisplayMode = GuiDisplayMode.View;
+
+ aiBookEntity = null;
+
+ guiOperateHelper.ResetControls(this.contentPanel);
+
+ SetDisplayMode();
+
+ guidSearchTxt.Focus();
+ }
+
+ public void Cancel()
+ {
+ if (!string.IsNullOrEmpty(guidSearchTxt.Text))
+ Search();
+ else
+ Reset();
+
+ }
+
+
+ private void permissionNameSearchBut_Click(object sender, EventArgs e)
+ {
+ //try
+ //{
+ // AbstractForm dialog = GetAbstractDialog(typeof(AiBookEnquiryPage).Name);
+
+ // if (DialogResult.OK != dialog.ShowDialog()) return;
+
+ // permissionNameSearchTxt.Text = ((AiBookEntity[])dialog.OutputData)[0].PermissionName;
+
+ // Search();
+ //}
+ //catch (ValidatedException ex)
+ //{
+ // ShowMessageBox.ShowInfo(ex.Message);
+ //}
+ //catch (ServiceErrorException ex)
+ //{
+ // ShowMessageBox.ShowError(ex.Message);
+ //}
+ //catch (Exception ex)
+ //{
+ // ShowMessageBox.ShowError(ex.Message);
+ //}
+ }
+
+ private void searchBut_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(guidSearchTxt.Text))
+ {
+ ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_VALID_INPUT, GuiOperateHelper.GetLabelText(guidSearchLabel.Text)));
+ this.guidSearchTxt.Focus();
+ return;
+ }
+ this.DisplayMode = GuiDisplayMode.View;
+
+ Search();
+
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ private void resetBut_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ guiOperateHelper.ResetControls(this.topPanel);
+ Reset();
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ private void createBut_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ Create();
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ private void amendBut_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ Amend();
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ private void deleteBut_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (aiBookEntity == null)
+ {
+ ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_WS_RECORD_NOT_FOUND));
+ return;
+ }
+
+ if (DialogResult.Yes != ShowMessageBox.ShowOption(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_CONFIRM_DEL_NULL), securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_DELETE))) return;
+
+ aiBookRequest.Delete(aiBookEntity.Guid);
+
+ ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_SUCCEED_DELETED_NULL));
+
+ Reset();
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ private void saveBut_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (!SaveValidate()) return;
+
+ PackUIToEntity();
+
+
+ if (this.DisplayMode == GuiDisplayMode.Create)
+ {
+ data = aiBookRequest.Insert(data);
+ aiBookEntity.Guid = data.AiBook.Guid;
+ }
+ else
+ aiBookRequest.Update(data);
+
+
+ ShowMessageBox.ShowInfo((this.DisplayMode == GuiDisplayMode.Create) ?
+ securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_SUCCEED_CREATED_NULL) :
+ securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_SUCCEED_UPDATED_NULL));
+
+ guidSearchTxt.Text = aiBookEntity.Guid;
+ Search();
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ private void cancelBut_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ CancelEditing();
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ private void addBut_Click(object sender, EventArgs e)
+ {
+ //dataGv.AddRow(new AiBookDependentEntity() { CreatedBy = string.Empty, UpdatedBy = string.Empty });
+ }
+
+ private void delBut_Click(object sender, EventArgs e)
+ {
+ if (dataGv.RowCount <= 0 || dataGv.SelectedCells.Count <= 0)
+ {
+ ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_WS_RECORD_NOT_FOUND));
+ return;
+ }
+
+ dataGv.DeleteRows(dataGv.SelectedCells);
+ }
+
+ private void uploadBut_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ OpenFileDialog openFileDialog = new OpenFileDialog();
+ openFileDialog.Multiselect = false;
+
+ if (openFileDialog.ShowDialog() != DialogResult.OK)
+ return;
+
+ string[] fileNames = openFileDialog.FileNames;
+
+ string folderName = dmsFileRequest.GetFolderName(typeof(AiBookEntity).Name);
+ BookDmsFileViewEntity dmsFile = dmsFileRequestHelper.UploadFile(fileNames[0], folderName);
+ if (dmsFile == null || dmsFile.FileId == 0) return;
+
+ data.AiBook.FileId = dmsFile.FileId;
+
+ aiBookRequest.Update(data);
+
+ ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_SUCCEED_UPDATED_NULL));
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ private void processBut_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ AbstractForm dialog;
+ dialog = GetAbstractDialog(typeof(AiBookProcessDialogPage).Name);
+ if (DialogResult.OK != dialog.ShowCreateDialog()) return;
+
+ AiBookProcessData d = (AiBookProcessData)dialog.OutputData;
+
+ data = aiBookRequest.ProcessBook(data.AiBook.Guid, d.Encoding, d.Pattern);
+
+ ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_SUCCEED_UPDATED_NULL));
+
+ guidSearchTxt.Text = data.AiBook.Guid;
+ Search();
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ private void dataGv_CellClick(object sender, DataGridViewCellEventArgs e)
+ {
+ try
+ {
+ if (e.RowIndex == -1 || e.ColumnIndex == -1) return;
+
+ if (dataGv.RowCount <= 0 || dataGv.SelectedCells.Count <= 0)
+ {
+ ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_WS_RECORD_NOT_FOUND));
+ return;
+ }
+
+ AiChapterEntity chapter = dataGv.GetRowData(dataGv.SelectedCells[0].RowIndex);
+
+ AiSentenceViewEntity[] aiSentences= aiSentenceRequest.FindByChapterGuid(chapter.Guid);
+
+ sentenceGv.SetDataSource(aiSentences);
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+ }
+}
diff --git a/CloudBuilder.AI.Gui/AiBookOperationPage.resx b/CloudBuilder.AI.Gui/AiBookOperationPage.resx
new file mode 100644
index 0000000..aa8615d
--- /dev/null
+++ b/CloudBuilder.AI.Gui/AiBookOperationPage.resx
@@ -0,0 +1,150 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
\ No newline at end of file
diff --git a/CloudBuilder.AI.Gui/AiBookProcessDialogPage.Designer.cs b/CloudBuilder.AI.Gui/AiBookProcessDialogPage.Designer.cs
new file mode 100644
index 0000000..cdf7b07
--- /dev/null
+++ b/CloudBuilder.AI.Gui/AiBookProcessDialogPage.Designer.cs
@@ -0,0 +1,185 @@
+namespace CloudBuilder.AI.Gui
+{
+ partial class AiBookProcessDialogPage
+ {
+ ///
+ /// 設計工具所需的變數。
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 清除任何使用中的資源。
+ ///
+ /// 如果應該處置受控資源則為 true,否則為 false。
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region 元件設計工具產生的程式碼
+
+ ///
+ /// 此為設計工具支援所需的方法 - 請勿使用程式碼編輯器修改
+ /// 這個方法的內容。
+ ///
+ private void InitializeComponent()
+ {
+ mainPanel = new TableLayoutPanel();
+ dialogPanel = new TableLayoutPanel();
+ cancelBut = new Krypton.Toolkit.KryptonButton();
+ okBut = new Krypton.Toolkit.KryptonButton();
+ contentPanel = new TableLayoutPanel();
+ patternLabel = new Krypton.Toolkit.KryptonLabel();
+ patternTxt = new Krypton.Toolkit.KryptonTextBox();
+ encodingCombo = new Krypton.Toolkit.KryptonComboBox();
+ encodingLabel = new Krypton.Toolkit.KryptonLabel();
+ mainPanel.SuspendLayout();
+ dialogPanel.SuspendLayout();
+ contentPanel.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)encodingCombo).BeginInit();
+ SuspendLayout();
+ //
+ // mainPanel
+ //
+ mainPanel.ColumnCount = 1;
+ mainPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
+ mainPanel.Controls.Add(dialogPanel, 0, 1);
+ mainPanel.Controls.Add(contentPanel, 0, 0);
+ mainPanel.Dock = DockStyle.Fill;
+ mainPanel.Location = new Point(0, 0);
+ mainPanel.Name = "mainPanel";
+ mainPanel.RowCount = 2;
+ mainPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 65.0666656F));
+ mainPanel.RowStyles.Add(new RowStyle());
+ mainPanel.Size = new Size(321, 101);
+ mainPanel.TabIndex = 1;
+ //
+ // dialogPanel
+ //
+ dialogPanel.AutoSize = true;
+ dialogPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ dialogPanel.ColumnCount = 3;
+ dialogPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
+ dialogPanel.ColumnStyles.Add(new ColumnStyle());
+ dialogPanel.ColumnStyles.Add(new ColumnStyle());
+ dialogPanel.Controls.Add(cancelBut, 2, 0);
+ dialogPanel.Controls.Add(okBut, 1, 0);
+ dialogPanel.Dock = DockStyle.Fill;
+ dialogPanel.Location = new Point(3, 67);
+ dialogPanel.Name = "dialogPanel";
+ dialogPanel.RowCount = 1;
+ dialogPanel.RowStyles.Add(new RowStyle());
+ dialogPanel.Size = new Size(315, 31);
+ dialogPanel.TabIndex = 999;
+ //
+ // cancelBut
+ //
+ cancelBut.Location = new Point(222, 3);
+ cancelBut.Name = "cancelBut";
+ cancelBut.Size = new Size(90, 25);
+ cancelBut.TabIndex = 0;
+ cancelBut.Values.Image = Properties.Resources.close_16;
+ cancelBut.Values.Text = "取消(&C)";
+ cancelBut.Click += cancelBut_Click;
+ //
+ // okBut
+ //
+ okBut.Location = new Point(126, 3);
+ okBut.Name = "okBut";
+ okBut.Size = new Size(90, 25);
+ okBut.TabIndex = 0;
+ okBut.Values.Image = Properties.Resources.ok_16;
+ okBut.Values.Text = "确定(&O)";
+ okBut.Click += okBut_Click;
+ //
+ // contentPanel
+ //
+ contentPanel.ColumnCount = 2;
+ contentPanel.ColumnStyles.Add(new ColumnStyle());
+ contentPanel.ColumnStyles.Add(new ColumnStyle());
+ contentPanel.Controls.Add(patternLabel, 0, 0);
+ contentPanel.Controls.Add(patternTxt, 1, 0);
+ contentPanel.Controls.Add(encodingCombo, 1, 1);
+ contentPanel.Controls.Add(encodingLabel, 0, 1);
+ contentPanel.Dock = DockStyle.Fill;
+ contentPanel.Location = new Point(3, 3);
+ contentPanel.Name = "contentPanel";
+ contentPanel.RowCount = 2;
+ contentPanel.RowStyles.Add(new RowStyle());
+ contentPanel.RowStyles.Add(new RowStyle());
+ contentPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
+ contentPanel.Size = new Size(315, 58);
+ contentPanel.TabIndex = 3;
+ //
+ // patternLabel
+ //
+ patternLabel.Location = new Point(3, 3);
+ patternLabel.Name = "patternLabel";
+ patternLabel.Size = new Size(91, 20);
+ patternLabel.TabIndex = 0;
+ patternLabel.Values.Text = "分隔章节示例:";
+ //
+ // patternTxt
+ //
+ patternTxt.Dock = DockStyle.Fill;
+ patternTxt.Location = new Point(100, 3);
+ patternTxt.MaxLength = 50;
+ patternTxt.Name = "patternTxt";
+ patternTxt.Size = new Size(215, 23);
+ patternTxt.TabIndex = 1;
+ patternTxt.Text = "第([^】]+)章";
+ //
+ // encodingCombo
+ //
+ encodingCombo.Dock = DockStyle.Fill;
+ encodingCombo.DropDownWidth = 200;
+ encodingCombo.IntegralHeight = false;
+ encodingCombo.Items.AddRange(new object[] { "GB2312", "UTF-8" });
+ encodingCombo.Location = new Point(100, 32);
+ encodingCombo.Name = "encodingCombo";
+ encodingCombo.Size = new Size(215, 22);
+ encodingCombo.StateCommon.ComboBox.Content.TextH = Krypton.Toolkit.PaletteRelativeAlign.Near;
+ encodingCombo.TabIndex = 7;
+ encodingCombo.Text = "UTF-8";
+ //
+ // encodingLabel
+ //
+ encodingLabel.Location = new Point(3, 32);
+ encodingLabel.Name = "encodingLabel";
+ encodingLabel.Size = new Size(88, 20);
+ encodingLabel.TabIndex = 0;
+ encodingLabel.Values.Text = "小说原文格式";
+ //
+ // AiBookProcessDialogPage
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(mainPanel);
+ Name = "AiBookProcessDialogPage";
+ Size = new Size(321, 101);
+ mainPanel.ResumeLayout(false);
+ mainPanel.PerformLayout();
+ dialogPanel.ResumeLayout(false);
+ contentPanel.ResumeLayout(false);
+ contentPanel.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)encodingCombo).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private TableLayoutPanel mainPanel;
+ private TableLayoutPanel dialogPanel;
+ private Krypton.Toolkit.KryptonButton cancelBut;
+ private Krypton.Toolkit.KryptonButton okBut;
+ private TableLayoutPanel contentPanel;
+ private Krypton.Toolkit.KryptonLabel patternLabel;
+ private Krypton.Toolkit.KryptonTextBox patternTxt;
+ private Krypton.Toolkit.KryptonComboBox encodingCombo;
+ private Krypton.Toolkit.KryptonLabel encodingLabel;
+ }
+}
diff --git a/CloudBuilder.AI.Gui/AiBookProcessDialogPage.cs b/CloudBuilder.AI.Gui/AiBookProcessDialogPage.cs
new file mode 100644
index 0000000..fa2b266
--- /dev/null
+++ b/CloudBuilder.AI.Gui/AiBookProcessDialogPage.cs
@@ -0,0 +1,39 @@
+using CloudBuilder.AI.Data;
+using CloudBuilder.Gui;
+using Krypton.Toolkit;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace CloudBuilder.AI.Gui
+{
+ public partial class AiBookProcessDialogPage : AbstractPage
+ {
+ public AiBookProcessDialogPage()
+ {
+ InitializeComponent();
+ }
+
+ private void okBut_Click(object sender, EventArgs e)
+ {
+ this.ParentAbstractForm.OutputData = new AiBookProcessData()
+ {
+ Pattern = patternTxt.GetValue(),
+ Encoding = encodingCombo.Text
+ };
+
+ this.ParentAbstractForm.DialogResult = DialogResult.OK;
+ }
+
+ private void cancelBut_Click(object sender, EventArgs e)
+ {
+ this.ParentAbstractForm.DialogResult = DialogResult.Cancel;
+ }
+ }
+}
diff --git a/CloudBuilder.AI.Gui/AiBookProcessDialogPage.resx b/CloudBuilder.AI.Gui/AiBookProcessDialogPage.resx
new file mode 100644
index 0000000..8b2ff64
--- /dev/null
+++ b/CloudBuilder.AI.Gui/AiBookProcessDialogPage.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/CloudBuilder.AI.Gui/CloudBuilder.AI.Gui.csproj b/CloudBuilder.AI.Gui/CloudBuilder.AI.Gui.csproj
new file mode 100644
index 0000000..c95c6b2
--- /dev/null
+++ b/CloudBuilder.AI.Gui/CloudBuilder.AI.Gui.csproj
@@ -0,0 +1,71 @@
+
+
+
+ Library
+ net8.0-windows
+ enable
+ true
+ enable
+
+
+
+
+
+
+
+ ..\CloudBuilder.AI\bin\Debug\net8.0\CloudBuilder.AI.dll
+
+
+ ..\CloudBuilder.Core\bin\Debug\net8.0\CloudBuilder.Core.dll
+
+
+ ..\CloudBuilder.Gui\bin\Debug\net8.0-windows\CloudBuilder.Gui.dll
+
+
+ ..\CloudBuilder.Request\bin\Debug\net8.0\CloudBuilder.Request.dll
+
+
+ ..\CloudBuilder.Security\bin\Debug\net8.0\CloudBuilder.Security.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+
+
+
+
+
diff --git a/CloudBuilder.AI.Gui/CloudBuilder.AI.Gui.csproj.user b/CloudBuilder.AI.Gui/CloudBuilder.AI.Gui.csproj.user
new file mode 100644
index 0000000..da089ff
--- /dev/null
+++ b/CloudBuilder.AI.Gui/CloudBuilder.AI.Gui.csproj.user
@@ -0,0 +1,15 @@
+
+
+
+
+
+ UserControl
+
+
+ UserControl
+
+
+ UserControl
+
+
+
\ No newline at end of file
diff --git a/CloudBuilder.AI.Gui/Properties/Resources.Designer.cs b/CloudBuilder.AI.Gui/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..96a7c73
--- /dev/null
+++ b/CloudBuilder.AI.Gui/Properties/Resources.Designer.cs
@@ -0,0 +1,303 @@
+//------------------------------------------------------------------------------
+//
+// 這段程式碼是由工具產生的。
+// 執行階段版本:4.0.30319.42000
+//
+// 對這個檔案所做的變更可能會造成錯誤的行為,而且如果重新產生程式碼,
+// 變更將會遺失。
+//
+//------------------------------------------------------------------------------
+
+namespace CloudBuilder.AI.Gui.Properties {
+ using System;
+
+
+ ///
+ /// 用於查詢當地語系化字串等的強類型資源類別。
+ ///
+ // 這個類別是自動產生的,是利用 StronglyTypedResourceBuilder
+ // 類別透過 ResGen 或 Visual Studio 這類工具。
+ // 若要加入或移除成員,請編輯您的 .ResX 檔,然後重新執行 ResGen
+ // (利用 /str 選項),或重建您的 VS 專案。
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// 傳回這個類別使用的快取的 ResourceManager 執行個體。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CloudBuilder.AI.Gui.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// 覆寫目前執行緒的 CurrentUICulture 屬性,對象是所有
+ /// 使用這個強類型資源類別的資源查閱。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap amend_16 {
+ get {
+ object obj = ResourceManager.GetObject("amend_16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap cancel_16 {
+ get {
+ object obj = ResourceManager.GetObject("cancel_16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap close_16 {
+ get {
+ object obj = ResourceManager.GetObject("close_16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap create_16 {
+ get {
+ object obj = ResourceManager.GetObject("create_16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap delete_16 {
+ get {
+ object obj = ResourceManager.GetObject("delete_16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap element {
+ get {
+ object obj = ResourceManager.GetObject("element", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap element_minus_16 {
+ get {
+ object obj = ResourceManager.GetObject("element_minus_16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap element_plus_16 {
+ get {
+ object obj = ResourceManager.GetObject("element_plus_16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap MoveNext {
+ get {
+ object obj = ResourceManager.GetObject("MoveNext", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap MovePrevious {
+ get {
+ object obj = ResourceManager.GetObject("MovePrevious", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap navigate_minus {
+ get {
+ object obj = ResourceManager.GetObject("navigate_minus", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap navigate_plus {
+ get {
+ object obj = ResourceManager.GetObject("navigate_plus", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap nonImg {
+ get {
+ object obj = ResourceManager.GetObject("nonImg", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap ok_16 {
+ get {
+ object obj = ResourceManager.GetObject("ok_16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap page_link {
+ get {
+ object obj = ResourceManager.GetObject("page_link", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap page_white_delete {
+ get {
+ object obj = ResourceManager.GetObject("page_white_delete", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap page_white_gear {
+ get {
+ object obj = ResourceManager.GetObject("page_white_gear", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap page_white_get {
+ get {
+ object obj = ResourceManager.GetObject("page_white_get", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap page_white_go {
+ get {
+ object obj = ResourceManager.GetObject("page_white_go", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap reset_16 {
+ get {
+ object obj = ResourceManager.GetObject("reset_16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap save_16 {
+ get {
+ object obj = ResourceManager.GetObject("save_16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap search_16 {
+ get {
+ object obj = ResourceManager.GetObject("search_16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap view_16 {
+ get {
+ object obj = ResourceManager.GetObject("view_16", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// 查詢類型 System.Drawing.Bitmap 的當地語系化資源。
+ ///
+ internal static System.Drawing.Bitmap Yo7OjL6wMwgA845AU {
+ get {
+ object obj = ResourceManager.GetObject("Yo7OjL6wMwgA845AU", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/CloudBuilder.AI.Gui/Properties/Resources.resx b/CloudBuilder.AI.Gui/Properties/Resources.resx
new file mode 100644
index 0000000..dde2504
--- /dev/null
+++ b/CloudBuilder.AI.Gui/Properties/Resources.resx
@@ -0,0 +1,193 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ ..\Resources\nonImg.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\element_minus_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\page_link.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\create_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Yo7OjL6wMwgA845AU.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\navigate_minus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\amend_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\search_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\view_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\MovePrevious.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\close_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\save_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\page_white_go.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\page_white_delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\element.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\delete_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\MoveNext.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\ok_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\cancel_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\navigate_plus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\page_white_get.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\reset_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\element_plus_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\page_white_gear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
\ No newline at end of file
diff --git a/CloudBuilder.AI.Gui/Request/DmsFileRequestHelper.cs b/CloudBuilder.AI.Gui/Request/DmsFileRequestHelper.cs
new file mode 100644
index 0000000..a5b6935
--- /dev/null
+++ b/CloudBuilder.AI.Gui/Request/DmsFileRequestHelper.cs
@@ -0,0 +1,135 @@
+using CloudBuilder.AI.Entity;
+using CloudBuilder.Core.DependencyInjection.Form;
+using CloudBuilder.Core.DependencyInjection.Request;
+using CloudBuilder.Core.Request;
+using CloudBuilder.Core.Service;
+using CloudBuilder.Gui;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Net.Http.Headers;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace CloudBuilder.AI.Gui.Request
+{
+ public class DmsFileRequestHelper
+ {
+ private const int CHUNK_SIZE = 512 * 1024; // 512KB 分块大小
+
+ private IServiceRequest serviceRequest;
+ public BookDmsFileViewEntity UploadFile(string fileName, string folderName)
+ {
+ var fileInfo = new FileInfo(fileName);
+ var chunks = SplitFile(fileName);
+ string uid = Guid.NewGuid().ToString();
+ string fileFullName = fileInfo.Name;
+
+ return UploadChunk(chunks, fileFullName, uid, 1, folderName);
+ }
+
+ // 分块上传方法
+ private BookDmsFileViewEntity UploadChunk(IList chunks, string fileName, string uid, int index, string folderName)
+ {
+ BookDmsFileViewEntity dmsFileEntity = new BookDmsFileViewEntity();
+ try
+ {
+ var fileExtension = Path.GetExtension(fileName);
+ var chunk = chunks[index - 1];
+
+ using (var formData = new MultipartFormDataContent())
+ {
+ var content = new ByteArrayContent(chunk);
+ content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/octet-stream");
+
+ formData.Add(content, fileName,
+ $"{uid}-{index}-{chunks.Count}{fileExtension}");
+
+ IContext context = ApplicationServiceContext.Context;
+ using (var scope = ApplicationServiceContext.ServiceProvider.CreateScope())
+ {
+ serviceRequest = scope.ServiceProvider.GetService()!;
+
+ serviceRequest.AddHeaders("FilePath", folderName);
+
+ serviceRequest.SetContext(context);
+
+ Task.Run(async () => dmsFileEntity = await serviceRequest.PostAsync("/DmsFile/UploadFile", formData)).GetAwaiter().GetResult();
+ }
+
+ if (index < chunks.Count)
+ {
+ dmsFileEntity = UploadChunk(chunks, fileName, uid, index + 1, folderName);
+ }
+ }
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ return dmsFileEntity;
+ }
+
+ // 文件分块方法
+ private IList SplitFile(string filePath)
+ {
+ var chunks = new List();
+ using (var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
+ {
+ long fileSize = fileStream.Length;
+ long start = 0;
+ while (start < fileSize)
+ {
+ long remaining = fileSize - start;
+ int chunkSize = (int)Math.Min(CHUNK_SIZE, remaining);
+
+ byte[] buffer = new byte[chunkSize];
+ fileStream.Read(buffer, 0, chunkSize);
+
+ chunks.Add(buffer);
+ start += CHUNK_SIZE;
+ }
+ }
+ return chunks;
+ }
+
+ public void DownloadFile(int fileId, string saveFilePath)
+ {
+ try
+ {
+ ServiceHelper.GetService()!.DownloadFile("/DmsFile/DownloadFile?fileId=" + fileId, saveFilePath, null, OpenFile);
+ }
+ catch (ValidatedException ex)
+ {
+ ShowMessageBox.ShowInfo(ex.Message);
+ }
+ catch (ServiceErrorException ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ ShowMessageBox.ShowError(ex.Message);
+ }
+ }
+
+ private void OpenFile(string fileFullName)
+ {
+ Process.Start(new ProcessStartInfo
+ {
+ FileName = fileFullName,
+ UseShellExecute = true // 使用Windows Shell执行
+ });
+ }
+ }
+}
diff --git a/CloudBuilder.AI.Gui/Resources/MoveFirst.png b/CloudBuilder.AI.Gui/Resources/MoveFirst.png
new file mode 100644
index 0000000..46e0754
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/MoveFirst.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/MoveLast.png b/CloudBuilder.AI.Gui/Resources/MoveLast.png
new file mode 100644
index 0000000..80b2a45
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/MoveLast.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/MoveNext.png b/CloudBuilder.AI.Gui/Resources/MoveNext.png
new file mode 100644
index 0000000..5afeea1
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/MoveNext.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/MovePrevious.png b/CloudBuilder.AI.Gui/Resources/MovePrevious.png
new file mode 100644
index 0000000..62ed1f3
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/MovePrevious.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/Yo7OjL6wMwgA845AU.png b/CloudBuilder.AI.Gui/Resources/Yo7OjL6wMwgA845AU.png
new file mode 100644
index 0000000..d4c7b14
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/Yo7OjL6wMwgA845AU.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/amend_16.png b/CloudBuilder.AI.Gui/Resources/amend_16.png
new file mode 100644
index 0000000..95dabb1
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/amend_16.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/cancel_16.png b/CloudBuilder.AI.Gui/Resources/cancel_16.png
new file mode 100644
index 0000000..0da8729
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/cancel_16.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/close_16.png b/CloudBuilder.AI.Gui/Resources/close_16.png
new file mode 100644
index 0000000..349423f
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/close_16.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/create_16.png b/CloudBuilder.AI.Gui/Resources/create_16.png
new file mode 100644
index 0000000..18365cf
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/create_16.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/delete_16.png b/CloudBuilder.AI.Gui/Resources/delete_16.png
new file mode 100644
index 0000000..0b4a3bc
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/delete_16.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/element.png b/CloudBuilder.AI.Gui/Resources/element.png
new file mode 100644
index 0000000..9747dec
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/element.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/element_minus_16.png b/CloudBuilder.AI.Gui/Resources/element_minus_16.png
new file mode 100644
index 0000000..e4992dc
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/element_minus_16.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/element_plus_16.png b/CloudBuilder.AI.Gui/Resources/element_plus_16.png
new file mode 100644
index 0000000..8233437
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/element_plus_16.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/navigate_minus.png b/CloudBuilder.AI.Gui/Resources/navigate_minus.png
new file mode 100644
index 0000000..bb65279
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/navigate_minus.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/navigate_plus.png b/CloudBuilder.AI.Gui/Resources/navigate_plus.png
new file mode 100644
index 0000000..22a7dc8
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/navigate_plus.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/nonImg.jpg b/CloudBuilder.AI.Gui/Resources/nonImg.jpg
new file mode 100644
index 0000000..22d41ea
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/nonImg.jpg differ
diff --git a/CloudBuilder.AI.Gui/Resources/ok_16.png b/CloudBuilder.AI.Gui/Resources/ok_16.png
new file mode 100644
index 0000000..47dc49d
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/ok_16.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/page_link.png b/CloudBuilder.AI.Gui/Resources/page_link.png
new file mode 100644
index 0000000..312eab0
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/page_link.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/page_white_delete.png b/CloudBuilder.AI.Gui/Resources/page_white_delete.png
new file mode 100644
index 0000000..af1ecaf
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/page_white_delete.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/page_white_gear.png b/CloudBuilder.AI.Gui/Resources/page_white_gear.png
new file mode 100644
index 0000000..106f5aa
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/page_white_gear.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/page_white_get.png b/CloudBuilder.AI.Gui/Resources/page_white_get.png
new file mode 100644
index 0000000..e4a1ecb
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/page_white_get.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/page_white_go.png b/CloudBuilder.AI.Gui/Resources/page_white_go.png
new file mode 100644
index 0000000..7e62a92
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/page_white_go.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/print.png b/CloudBuilder.AI.Gui/Resources/print.png
new file mode 100644
index 0000000..902217c
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/print.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/reset_16.png b/CloudBuilder.AI.Gui/Resources/reset_16.png
new file mode 100644
index 0000000..ceb83b0
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/reset_16.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/save_16.png b/CloudBuilder.AI.Gui/Resources/save_16.png
new file mode 100644
index 0000000..f9d9eab
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/save_16.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/search_16.png b/CloudBuilder.AI.Gui/Resources/search_16.png
new file mode 100644
index 0000000..1a77c32
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/search_16.png differ
diff --git a/CloudBuilder.AI.Gui/Resources/view_16.png b/CloudBuilder.AI.Gui/Resources/view_16.png
new file mode 100644
index 0000000..49f50e2
Binary files /dev/null and b/CloudBuilder.AI.Gui/Resources/view_16.png differ
diff --git a/CloudBuilder.AI.Service/DmsFileService.auto.cs b/CloudBuilder.AI.Service/DmsFileService.auto.cs
new file mode 100644
index 0000000..a46728b
--- /dev/null
+++ b/CloudBuilder.AI.Service/DmsFileService.auto.cs
@@ -0,0 +1,877 @@
+using CloudBuilder.AI.Data;
+using CloudBuilder.AI.Entity;
+using CloudBuilder.AI.Policy;
+using CloudBuilder.AI.SearchCriteria;
+using CloudBuilder.Core.DatabaseAccessor;
+using CloudBuilder.Core.DatabaseAccessor.Entity;
+using CloudBuilder.Core.Service;
+using CloudBuilder.Security.Policy;
+using CloudBuilder.Security.Service;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.DependencyInjection;
+namespace CloudBuilder.AI.Service
+{
+ public class DmsFileService : IDmsFileService
+ {
+ private readonly IApplicationService service;
+ private readonly IHttpContextAccessor httpContextAccessor;
+ private IRepository repository;
+ public DmsFileService(IApplicationService service, IHttpContextAccessor httpContextAccessor)
+ {
+ this.service = service;
+ this.httpContextAccessor = httpContextAccessor;
+ repository = service.GetRepository>();
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Find)]
+ public DmsFileEntity FindByKey(int key)
+ {
+ return repository.DetachedEntities.Where(x => x.FileId == key).FirstOrDefault()!;
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Find)]
+ public DmsFileResultData FindBySearchCriteria(DmsFileSearchCriteria criteria)
+ {
+ DmsFileResultData data = new DmsFileResultData();
+ BookDmsFileViewEntity[] list = null;
+
+ int count = 0;
+
+ string sqlWhere = null;
+
+ if (criteria.Filter != null && criteria.Filter.Length > 0)
+ {
+ sqlWhere = SearchFilter.ComposeWhereClause(criteria.Filter);
+ }
+
+ sqlWhere = sqlWhere + string.Format(" and {0} ='{1}' ", BookDmsFileViewEntity.DB_CREATED_BY, service.UserId);
+
+ BookDmsFileViewEntity entity = BookDmsFileViewEntity.GetInstance();
+ string sql = entity.GetSelectTopFrom(criteria.limit, criteria.page, criteria.orderby.StringToDbField(), criteria.orderbytag, sqlWhere);
+
+ IRepository repositoryView = repository.GetRepository>();
+
+ string err = null;
+ try
+ {
+ list = repositoryView.FromSql(sql).ToArray();
+ }
+ catch (System.Exception ex)
+ {
+ err = ex.Message;
+ }
+
+
+
+ if (list != null && list.Length > 0)
+ {
+ //list = list.OrderByDescending(x => x.IsDirectoryIndc).ThenByDescending(x => x.CreatedDatetime).ToArray();
+ sql = entity.GetSelectCountFrom(sqlWhere);
+ count = (int)repository.ExecuteScalar(sql);
+
+ var webRootPath = service.Configuration["FileServiceSettings:RequestPath"];
+ var phy = service.Configuration["FileServiceSettings:PhysicalFileDirectory"];
+ var scale = service.Configuration["FileServiceSettings:ScaleDmsFileDirectory"].Replace(phy, "");
+ List prvs = new List();
+ //bool isAttached = Debugger.IsAttached;
+ foreach (var item in list)
+ {
+ item.Url = FileTypePolicy.PackUrl(service, item.CreatedBy, item.OrderKey, item.TranscodeIndc);
+ }
+
+ data.Datas = list.Select(x => new BookDmsFileViewDisplayData(x)
+ {
+ FormattedPic = FileTypePolicy.PackUrl(service, x.CreatedBy, x.OrderKey, YesNoPolicy.YES)
+ }).ToArray();
+ }
+
+ data.Limit = criteria.limit;
+ data.Page = criteria.page;
+
+ data.Total = count;
+ //data.Sql = sql;
+ data.ErrorMessage = err;
+ return data;
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Find)]
+ public DmsFileResultData FindDatasBySearchCriteria(DmsFileSearchCriteria criteria)
+ {
+ DmsFileResultData data = new DmsFileResultData();
+ BookDmsFileViewEntity[] list = null;
+
+ int count = 0;
+
+ string sqlWhere = null;
+
+ if (criteria.Filter != null && criteria.Filter.Length > 0)
+ {
+ sqlWhere = SearchFilter.ComposeWhereClause(criteria.Filter);
+ }
+
+ sqlWhere = sqlWhere + string.Format(" and {0} ='{1}' and {2} ='{3}' ",
+ BookDmsFileViewEntity.DB_CREATED_BY, service.UserId,
+ BookDmsFileViewEntity.DB_IS_DIRECTORY_INDC, YesNoPolicy.NO
+ );
+
+ BookDmsFileViewEntity entity = BookDmsFileViewEntity.GetInstance();
+ string sql = entity.GetSelectTopFrom(criteria.limit, criteria.page, criteria.orderby.StringToDbField(), criteria.orderbytag, sqlWhere);
+
+ IRepository repositoryView = repository.GetRepository>();
+
+ string err = null;
+ try
+ {
+ list = repositoryView.FromSql(sql).ToArray();
+ }
+ catch (System.Exception ex)
+ {
+ err = ex.Message;
+ }
+
+
+
+ if (list != null && list.Length > 0)
+ {
+ //list = list.OrderByDescending(x => x.IsDirectoryIndc).ThenByDescending(x => x.CreatedDatetime).ToArray();
+ sql = entity.GetSelectCountFrom(sqlWhere);
+ count = (int)repository.ExecuteScalar(sql);
+
+ var webRootPath = service.Configuration["FileServiceSettings:RequestPath"];
+ var phy = service.Configuration["FileServiceSettings:PhysicalFileDirectory"];
+ var scale = service.Configuration["FileServiceSettings:ScaleDmsFileDirectory"].Replace(phy, "");
+ List prvs = new List();
+ //bool isAttached = Debugger.IsAttached;
+ foreach (var item in list)
+ {
+ item.Url = FileTypePolicy.PackUrl(service, item.CreatedBy, item.OrderKey, item.TranscodeIndc);
+ }
+
+ data.Datas = list.Select(x => new BookDmsFileViewDisplayData(x)
+ {
+ FormattedPic = FileTypePolicy.PackUrl(service, x.CreatedBy, x.OrderKey, YesNoPolicy.YES)
+ }).ToArray();
+ }
+
+ data.Limit = criteria.limit;
+ data.Page = criteria.page;
+
+ data.Total = count;
+ //data.Sql = sql;
+ data.ErrorMessage = err;
+ return data;
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Print)]
+ public dynamic PrintBySearchCriteria(DmsFileSearchCriteria criteria)
+ {
+ throw new NotImplementedException();
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Insert)]
+ [UnitOfWork]
+ public DmsFileEntity Insert(DmsFileEntity data)
+ {
+ throw new NotImplementedException();
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Update)]
+ [UnitOfWork]
+ public DmsFileEntity Update(DmsFileEntity data)
+ {
+ throw new NotImplementedException();
+ }
+
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Delete)]
+ [UnitOfWork]
+ public void Delete(int key)
+ {
+ DmsFileEntity dmsFile = repository.DetachedEntities.Where(x => x.FileId == key).FirstOrDefault()!;
+
+ if (dmsFile == null) return;
+
+ IRepository repositoryUpload = repository.GetRepository>();
+ IRepository repositoryFolderMap = repository.GetRepository>();
+ IRepository repositoryFolder = repository.GetRepository>();
+
+ repository.DeleteNow(dmsFile);
+
+
+ BookDmsFileEntity uploadDmsFile = repositoryUpload.DetachedEntities.Where(x => x.FileId == key).FirstOrDefault()!;
+
+
+ if (uploadDmsFile != null)
+ {
+ repositoryUpload.DeleteNow(uploadDmsFile);
+ }
+
+ if (dmsFile.IsDirectoryIndc == YesNoPolicy.YES)
+ {
+ DmsFolderEntity folder = repositoryFolder.DetachedEntities.Where(x => x.FolderName == dmsFile.FileName).FirstOrDefault()!;
+
+ if (folder == null) return;
+
+ if (folder != null)
+ {
+ repositoryFolder.DeleteNow(folder);
+ }
+
+ DmsFolderMapEntity[] folderMaps = repositoryFolderMap.DetachedEntities.Where(x => x.FolderNameSon == dmsFile.FileName || x.FolderNameParent == dmsFile.FileName).ToArray();
+
+ if (folderMaps != null && folderMaps.Length > 0)
+ {
+ foreach (var map in folderMaps)
+ {
+ repositoryFolderMap.DeleteNow(map);
+ if (map.FolderNameSon == folder.FolderName) continue;
+ //刪除dmsfoler下的所有內容
+ DeleteFolder(map.FolderNameSon);
+ }
+ }
+
+
+ }
+ else
+ {
+ //删除文件与文件夹的映射关系
+ DmsFolderMapEntity folderMap = repositoryFolderMap.DetachedEntities.Where(x => x.FolderNameSon == dmsFile.FileName).FirstOrDefault();
+ if (folderMap != null)
+ repositoryFolderMap.DeleteNow(folderMap);
+ }
+
+ }
+
+
+ public void DeleteFolder(string folderName)
+ {
+ DmsFileEntity[] dmsFiles = repository.DetachedEntities.Where(x => x.FileName == folderName).ToArray();
+ if (dmsFiles == null || dmsFiles.Length == 0) return;
+ foreach (var dmsFile in dmsFiles)
+ {
+ Delete(dmsFile.FileId);
+ }
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Insert)]
+ [UnitOfWork]
+ public string GetFolderName(string folderLocalName)
+ {
+ IRepository repositoryFolder = repository.GetRepository>();
+ DmsFolderEntity folder = repositoryFolder.DetachedEntities.Where(x => x.FolderLocalName == service.UserId).FirstOrDefault()!;
+
+ if (folder != null) return folder.FolderName;
+
+ DmsFileEntity dmsFile = new DmsFileEntity();
+ dmsFile.FilePath = null;
+ dmsFile.FileName = folderLocalName;
+
+ return CreateDmsFolder(dmsFile);
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Insert)]
+ [UnitOfWork]
+ public string CreateDmsFolder(DmsFileEntity dmsFile)
+ {
+ IRepository repositoryFolder = repository.GetRepository>();
+ ISecurityGeneratorNumberService securityGeneratorNumberService = service.ServiceProvider.GetService()!;
+ DmsFolderEntity folder = null;
+ string folderNameParent = dmsFile.FilePath;
+ //父目录是空,创建顶级目录
+
+ folder = repositoryFolder.DetachedEntities.Where(x => x.FolderLocalName == service.UserId).FirstOrDefault()!;
+ if (folder == null)
+ {
+ folder = new DmsFolderEntity();
+ folder.FolderName = securityGeneratorNumberService.GetNo(AIPrefixPolicy.DMS_FOLDER, AIPrefixPolicy.DMS_FOLDER_FOLDER_NAME, "DR", YesNoPolicy.NO, "00000000");
+ folder.FolderLocalName = service.UserId;
+ repositoryFolder.InsertNow(folder);
+ }
+
+ if (string.IsNullOrEmpty(dmsFile.FilePath))
+ {
+ folderNameParent = folder.FolderName;
+ }
+
+ //创建当前目录
+ folder = new DmsFolderEntity();
+ folder.FolderName = securityGeneratorNumberService.GetNo(AIPrefixPolicy.DMS_FOLDER, AIPrefixPolicy.DMS_FOLDER_FOLDER_NAME, "DR", YesNoPolicy.NO, "00000000");
+ folder.FolderLocalName = dmsFile.FileName;
+ repositoryFolder.InsertNow(folder);
+ //创建目录关系表
+ DmsFolderMapEntity map = new DmsFolderMapEntity();
+ IRepository repositoryFolderMap = repository.GetRepository>();
+ map.FolderNameParent = folderNameParent;
+ map.FolderNameSon = folder.FolderName;
+ repositoryFolderMap.InsertNow(map);
+
+ //创建Dms目录
+ DmsFileEntity entity = new DmsFileEntity();
+ entity.OrderKey = entity.FileName = folder.FolderName;
+ entity.OrgFileName = dmsFile.FileName;
+ entity.AllowDeleteIndc = entity.AllowRenameIndc = entity.IsDirectoryIndc = YesNoPolicy.YES;
+
+ entity.FilePath = folderNameParent;
+
+ entity.OwerId = service.UserId;
+ entity.IsLinkIndc = YesNoPolicy.NO;
+
+ repository.InsertNow(entity);
+
+ BookDmsFileEntity upload = new BookDmsFileEntity();
+ upload.FileId = entity.FileId;
+ upload.FileCategory = typeof(AiBookEntity).Name;
+ upload.UploadName = securityGeneratorNumberService.GetNo(AIPrefixPolicy.BOOK_DMS_FILE, AIPrefixPolicy.BOOK_DMS_FILE_BOOK_NAME, "DR", YesNoPolicy.NO, AIPrefixPolicy.BOOK_DMS_FILE_FORMAT);
+ upload.OrgFileName = entity.OrgFileName;
+
+ IRepository repositoryUpload = repository.GetRepository>();
+
+ repositoryUpload.InsertNow(upload);
+
+ return folder.FolderName;
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Update)]
+ [UnitOfWork]
+ public DmsFileEntity UpdateDmsFolder(DmsFileEntity dmsFile)
+ {
+ IRepository repositoryUpload = repository.GetRepository>();
+
+ BookDmsFileEntity upload = repositoryUpload.DetachedEntities.Where(x => x.FileId == dmsFile.FileId).FirstOrDefault()!;
+
+ if (upload == null)
+ {
+ throw new ValidatedException("记录不存在.");
+ }
+
+ upload.OrgFileName = dmsFile.FileName;
+
+ repositoryUpload.UpdateNow(upload);
+
+ DmsFileEntity file = repository.DetachedEntities.Where(x => x.FileId == dmsFile.FileId).FirstOrDefault()!;
+ //修改目录档对应的名称
+ IRepository repositoryFolder = repository.GetRepository>();
+ DmsFolderEntity dmsFolder = repositoryFolder.DetachedEntities.Where(x => x.FolderName == file.FileName).FirstOrDefault()!;
+
+ if (dmsFolder == null) return dmsFile;
+ dmsFolder.FolderLocalName = upload.OrgFileName;
+
+ repositoryFolder.UpdateNow(dmsFolder);
+
+ return dmsFile;
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Find)]
+ public SelectOption[] FindDmsFolders()
+ {
+ IRepository repositoryFolder = repository.GetRepository>();
+ //排除FamilyGroup创建的目录
+ DmsFolderEntity[] ents = repositoryFolder.DetachedEntities.Where(x => x.FolderName.StartsWith("DR") && x.CreatedBy == service.UserId && x.FolderLocalName != service.UserId).ToArray();
+ List l = new List();
+ SelectOption selectOption;
+
+ DmsFolderEntity my = repositoryFolder.DetachedEntities.Where(x => x.CreatedBy == service.UserId && x.FolderLocalName == service.UserId).FirstOrDefault()!;
+
+ selectOption = new SelectOption();
+ selectOption.BindValue = string.Empty;
+ if (my == null)
+ {
+ selectOption.DisplayName = "我的网盘";
+ }
+ else
+ {
+ selectOption.DisplayName = "所有文件(夹)";
+ }
+
+ l.Add(selectOption);
+
+ if (my != null)
+ {
+ selectOption = new SelectOption();
+ selectOption.BindValue = my.FolderName;
+ selectOption.DisplayName = "我的网盘";
+ l.Add(selectOption);
+ }
+
+ if (ents == null || ents.Length == 0) return l.ToArray();
+
+ foreach (DmsFolderEntity ent in ents)
+ {
+ selectOption = new SelectOption();
+ selectOption.BindValue = ent.FolderName;
+ selectOption.DisplayName = ent.FolderLocalName;
+ l.Add(selectOption);
+ }
+ return l.ToArray();
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Find)]
+ public DmsFolderTreeData FindDmsFolderTreeData()
+ {
+ DmsFolderTreeData data = new DmsFolderTreeData();
+
+ IRepository repositoryFolder = repository.GetRepository>();
+ DmsFolderEntity[] dmsFolders = repositoryFolder.DetachedEntities.Where(x => x.CreatedBy == service.UserId).ToArray();
+
+ data.DmsFolders = dmsFolders;
+
+ IRepository repositoryFolderMap = repository.GetRepository>();
+ DmsFolderMapEntity[] dmsFolderMaps = repositoryFolderMap.DetachedEntities.Where(x => x.CreatedBy == service.UserId).ToArray();
+ data.DmsFoldersMaps = dmsFolderMaps;
+
+ return data;
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Update)]
+ [UnitOfWork]
+ public void MoveDmsFolder(DmsFileEntity dmsFile)
+ {
+ DmsFileEntity file = repository.DetachedEntities.Where(x => x.FileId == dmsFile.FileId).FirstOrDefault()!;
+
+ if (file == null) return;
+ if (file.FilePath == dmsFile.FilePath) return;
+
+ file.FilePath = dmsFile.FilePath;
+
+ repository.UpdateNow(file);
+
+ IRepository repositoryFolderMap = repository.GetRepository>();
+
+ DmsFolderMapEntity map = repositoryFolderMap.Entities.Where(x => x.FolderNameSon == file.FileName).FirstOrDefault()!;
+ if (map == null) return;
+ repositoryFolderMap.DeleteNow(map);
+
+ map = new DmsFolderMapEntity();
+ map.FolderNameSon = file.FileName;
+ map.FolderNameParent = dmsFile.FilePath;
+ repositoryFolderMap.InsertNow(map);
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Insert)]
+ [UnitOfWork]
+ public BookDmsFileViewEntity UploadFile()
+ {
+ //采用分片上传文件(以及后面分片下载)
+ DmsFileEntity dmsFile = null;
+
+ var files = httpContextAccessor.HttpContext.Request.Form.Files;
+
+ var currentDate = DateTime.Now;
+ if (files.Any())
+ {
+ foreach (var file in files)
+ {
+ string folderName = null;
+ if (httpContextAccessor.HttpContext.Request.Headers.ContainsKey("FilePath"))
+ folderName = httpContextAccessor.HttpContext.Request.Headers["FilePath"].ToString();
+ dmsFile = PackUploadFile(file, folderName);
+ break;
+ }
+ }
+ else
+ {
+ return null!;
+ }
+
+ if (dmsFile != null)
+ {
+ dmsFile = CreateDmsFile(dmsFile);
+ }
+ else
+ {
+ return null!;
+ }
+
+ IRepository repositoryUploadDmsFile = service.GetRepository>();
+ return repositoryUploadDmsFile.DetachedEntities.Where(x => x.FileId == dmsFile.FileId).FirstOrDefault()!;
+ }
+
+ public DmsFileEntity PackUploadFile(IFormFile file, string folderName)
+ {
+ var webRootPath = service.Configuration["FileServiceSettings:UploadDmsFileDirectory"];
+
+ DmsFileEntity dmsFile = new DmsFileEntity();
+ dmsFile.OrgFileName = file.Name.Replace(" ", "");
+
+ dmsFile.FilePath = folderName;
+
+ //文件后缀
+ var fileExtension = Path.GetExtension(file.Name.Replace(" ", "")).ToLower();//获取文件格式,拓展名
+
+ if (string.IsNullOrEmpty(fileExtension)) fileExtension = "ext";
+
+ var filePath = $"\\{service.UserId}\\{fileExtension.Replace(".", "")}\\";
+
+ //创建存储文件夹
+ if (!Directory.Exists(webRootPath + filePath))
+ {
+ Directory.CreateDirectory(webRootPath + filePath);
+ }
+
+ //判断文件大小
+ var fileSize = file.Length;
+
+ if (fileSize > 1024 * 1024 * 100) //100M TODO:(1mb=1024X1024b)
+ {
+ return null;
+ }
+
+ //保存的文件名称
+ string fullName = webRootPath + filePath + file.FileName;
+ if (File.Exists(fullName)) File.Delete(fullName);
+
+ //文件保存
+ using (var fs = System.IO.File.Create(fullName))
+ {
+ file.CopyTo(fs);
+ fs.Flush();
+ }
+
+ //FileName上传Uid:xxxx-1-1.xxx
+ string[] fns = file.FileName.Split('-');
+ //如果上传的不是最后一个分片,不写入表
+ if (fns[fns.Length - 2] != fns[fns.Length - 1].Split('.')[0])
+ {
+ dmsFile = null;
+ return null;
+ }
+ else
+ {
+ dmsFile.OrderKey = file.FileName;
+ //只有單一文件,不需合并,只有超過1個才要合并
+ if (fns[fns.Length - 1].Split('.')[0] == "1")
+ {
+ dmsFile.OrderKey = file.FileName;
+ dmsFile.FileName = file.FileName;
+ dmsFile.FileSize = Convert.ToInt32(fileSize / 1024);
+
+ var backupRootPath = service.Configuration["FileServiceSettings:BackupDmsFileDirectory"];
+ string backupName = backupRootPath + filePath + dmsFile.FileName;
+
+ if (!Directory.Exists(backupRootPath + filePath))
+ {
+ Directory.CreateDirectory(backupRootPath + filePath);
+ }
+
+ if (File.Exists(backupName)) File.Delete(backupName);
+
+ File.Copy(fullName, backupName, true);
+
+ //生成缩略图
+ if (FileTypePolicy.GetType(fileExtension.ToLower()) == FileTypePolicy.PHOTO)
+ {
+ RunMyProcess(service.Configuration["CloudBuilder.Topshelf:Path"], PackParameters(dmsFile));
+ }
+ }
+ else
+ {
+ List all = new List();
+ List fileNames = new List();
+ //文件分片从1开始
+ for (int i = 1; i <= Convert.ToInt32(fns[fns.Length - 1].Split('.')[0]); i++)
+ {
+ fns[fns.Length - 2] = i.ToString();
+ //FileName上传Uid:xxxx-<1>-1.xxx
+ fileNames.Add(webRootPath + filePath + fns.ToDelimiteredList('-'));
+ }
+
+ dmsFile.FileName = Path.GetFileName(fullName);// Path.GetFileNameWithoutExtension(fullName) + "_" + file.Name.Replace(" ", "");
+ var backupRootPath = service.Configuration["FileServiceSettings:BackupDmsFileDirectory"];
+ fullName = backupRootPath + filePath + dmsFile.FileName;
+
+ if (!Directory.Exists(backupRootPath + filePath))
+ {
+ Directory.CreateDirectory(backupRootPath + filePath);
+ }
+
+ if (File.Exists(fullName)) File.Delete(fullName);
+ using (FileStream outputFile = File.Create(fullName)) // 创建输出文件流
+ {
+ foreach (string fileName in fileNames)
+ {
+ byte[] buffer = File.ReadAllBytes(fileName); // 读取每个文件内容到字节数组
+
+ outputFile.Write(buffer, 0, buffer.Length); // 将字节数组写入输出文件流
+
+ dmsFile.FileSize += buffer.Length;
+ }
+
+ dmsFile.FileSize = Convert.ToInt32(dmsFile.FileSize / 1024);//kb
+ }
+ //task:ImageSharpTask uid:SYSTEM file_size:5351 file_name:vc-upload-1709274146458-2-11-11_DSC_6141.JPG order_key:vc-upload-1709257162571-2-6-6.JPG
+
+ //生成缩略图
+ if (FileTypePolicy.GetType(fullName.ToLower()) == FileTypePolicy.PHOTO)
+ {
+ RunMyProcess(service.Configuration["CloudBuilder.Topshelf:Path"], PackParameters(dmsFile));
+ }
+ else if (FileTypePolicy.GetType(fullName.ToLower()) == FileTypePolicy.VIDEO)
+ {
+ foreach (string fileName in fileNames)
+ {
+ if (File.Exists(fileName)) File.Delete(fileName);
+ }
+ string m3u8FilePath = webRootPath + $"\\{service.UserId}\\m3u8\\" + Path.GetFileNameWithoutExtension(dmsFile.OrderKey);
+ if (!Directory.Exists(m3u8FilePath))
+ {
+ Directory.CreateDirectory(m3u8FilePath);
+ }
+ //生成m3u8
+ TsToM3u8(dmsFile.OrderKey, fullName, m3u8FilePath + "\\main.m3u8");
+ }
+ }
+ }
+
+ return dmsFile;
+ }
+
+ public string FindM3u8Path(int fileId)
+ {
+ DmsFileEntity entity = repository.DetachedEntities.Where(x => x.FileId == fileId && x.CreatedBy == service.UserId).FirstOrDefault()!;
+
+ return FileTypePolicy.PackUrl(service, entity.CreatedBy, entity.OrderKey, entity.TranscodeIndc);
+ }
+
+ public string FindSourceVideoPath(int fileId)
+ {
+ DmsFileEntity entity = repository.DetachedEntities.Where(x => x.FileId == fileId && x.CreatedBy == service.UserId).FirstOrDefault()!;
+
+ return FileTypePolicy.PackSourceVideoUrl(service, entity.CreatedBy, entity.OrderKey);
+ }
+
+ private string PackParameters(DmsFileEntity dmsFile)
+ {
+ List para = new List();
+ para.Add("task:" + "ImageSharpTask");
+ para.Add("uid:" + service.UserId);
+ para.Add("file_size:" + dmsFile.FileSize);
+ para.Add("file_name:" + dmsFile.FileName);
+ para.Add("order_key:" + dmsFile.OrderKey);
+ return para.ToArray().ToDelimiteredList(' ');
+ }
+
+ public void TsToM3u8(string orderKey, string mp4Url, string m3u8Url, int videoLength = 6)
+ {
+ //string para = string.Format(service.Configuration["Ffmpeg:Pictrue"], mp4Url, m3u8Url);
+ //RunMyProcess(service.Configuration["Ffmpeg:Path"], para.Replace(".m3u8", ".png"));
+
+ //para = string.Format(service.Configuration["Ffmpeg:Arguments"], mp4Url, videoLength, m3u8Url);
+ ////不直接转码视频文件,影响服务器性能,改为在闭时自动生成
+ ////Task.Run(() =>
+ ////{
+ //// Thread.Sleep(200);
+ //// RunMyProcess(service.Configuration["Ffmpeg:Path"], para);
+ ////});
+ //IRepository logRepository = repository.GetRepository>();
+ //VideoToM3u8LogEntity log = new VideoToM3u8LogEntity();
+ //log.VideoName = para;
+ //log.FilePath = Path.GetDirectoryName(m3u8Url)!;
+ //log.OrderKey = orderKey;
+ //log.Status = "S";
+ //logRepository.InsertNow(log);
+ }
+
+ ///
+ /// 执行cmd指令(异步不等待,await要求等待返回,转码太耗时)
+ ///
+ ///
+ public void RunMyProcess(string exePath, string Parameters)
+ {
+ //try
+ //{
+ // if (string.IsNullOrEmpty(exePath)) return;
+ // Cli.Wrap(exePath)
+ // .WithArguments(Parameters)
+ // .ExecuteAsync();
+ //}
+ //catch (Exception ex)
+ //{
+ // throw new ValidatedException(ex.Message);
+ //}
+
+ }
+
+ public DmsFileEntity CreateDmsFile(DmsFileEntity dmsFile)
+ {
+ IRepository repositoryFolder = repository.GetRepository>();
+ ISecurityGeneratorNumberService securityGeneratorNumberService = service.ServiceProvider.GetService()!;
+ DmsFolderEntity folder = null;
+ string folderNameParent = dmsFile.FilePath;
+ //父目录是空,创建顶级目录
+ if (string.IsNullOrEmpty(dmsFile.FilePath))
+ {
+ folder = repositoryFolder.DetachedEntities.Where(x => x.FolderLocalName == service.UserId).FirstOrDefault()!;
+ if (folder == null)
+ {
+ folder = new DmsFolderEntity();
+ folder.FolderName = securityGeneratorNumberService.GetNo(AIPrefixPolicy.DMS_FOLDER, AIPrefixPolicy.DMS_FOLDER_FOLDER_NAME, null, YesNoPolicy.NO, "00000000");
+ folder.FolderLocalName = service.UserId;
+ repositoryFolder.InsertNow(folder);
+ }
+ folderNameParent = folder.FolderName;
+ }
+
+ BookDmsFileEntity upload = new BookDmsFileEntity();
+
+ upload.FileCategory = typeof(AiBookEntity).Name;
+ upload.UploadName = securityGeneratorNumberService.GetNo(AIPrefixPolicy.BOOK_DMS_FILE, AIPrefixPolicy.BOOK_DMS_FILE_BOOK_NAME, "FL", YesNoPolicy.NO, AIPrefixPolicy.BOOK_DMS_FILE_FORMAT);
+ upload.OrgFileName = dmsFile.OrgFileName;
+
+ //创建Dms文件
+ DmsFileEntity entity = new DmsFileEntity();
+ entity.OrderKey = dmsFile.OrderKey;
+ entity.FileName = upload.UploadName;
+ entity.FileType = FileTypePolicy.GetType(entity.OrderKey);
+ entity.OrgFileName = dmsFile.FileName;
+ entity.FileSize = dmsFile.FileSize;
+ entity.AllowDeleteIndc = entity.AllowRenameIndc = YesNoPolicy.YES;
+ entity.IsDirectoryIndc = YesNoPolicy.NO;
+
+ entity.FilePath = folderNameParent;
+
+ entity.OwerId = service.UserId;
+ entity.IsLinkIndc = YesNoPolicy.NO;
+
+ repository.InsertNow(entity);
+
+ IRepository repositoryUpload = repository.GetRepository>();
+ upload.FileId = entity.FileId;
+ repositoryUpload.InsertNow(upload);
+
+ //创建目录关系表
+ DmsFolderMapEntity map = new DmsFolderMapEntity();
+ IRepository repositoryFolderMap = repository.GetRepository>();
+ map.FolderNameParent = folderNameParent;
+ map.FolderNameSon = entity.FileName;
+ repositoryFolderMap.InsertNow(map);
+
+
+ return entity;
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Find)]
+ public dynamic DownloadFile(int fileId)
+ {
+ DmsFileEntity entity = repository.DetachedEntities.Where(x => x.FileId == fileId && x.CreatedBy == service.UserId).FirstOrDefault()!;
+
+ if (entity == null) throw new ValidatedException("文件不存在.");
+
+ var fileExtension = Path.GetExtension(entity.OrderKey);//获取文件格式,拓展名
+
+ string path = FileTypePolicy.PackFilePath(service, entity.CreatedBy, entity.OrderKey);
+
+ IRepository repositoryUpload = repository.GetRepository>();
+ BookDmsFileEntity uploadDmsFile = repositoryUpload.DetachedEntities.Where(x => x.FileId == fileId).FirstOrDefault()!;
+
+ if (uploadDmsFile == null || !File.Exists(path)) throw new ValidatedException("文件不存在.");
+
+ var stream = System.IO.File.OpenRead(path);
+
+ string contentType = "application/octet-stream";
+
+ switch (fileExtension.Replace(".", "").ToLower())
+ {
+ case "xls":
+ case "xlt":
+ case "xla":
+ contentType = "application/vnd.ms-excel";
+ break;
+ case "xlsx":
+ case "xltx":
+ contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+ break;
+ case "doc":
+ contentType = "application/msword";
+ break;
+ case "docx":
+ contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
+ break;
+ case "txt":
+ contentType = "text/plain";
+ break;
+ case "png":
+ case "jpg":
+ case "jpeg":
+ case "gif":
+ contentType = "image/*";
+ break;
+ case "mp4":
+ case "mpg":
+ case "mpeg":
+ case "avi":
+ contentType = "video/*";
+ break;
+ case "pdf":
+ contentType = "application/pdf";
+ break;
+ default:
+ break;
+ }
+
+ return new FileStreamResult(stream, contentType) { FileDownloadName = uploadDmsFile.OrgFileName };
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Find)]
+ public dynamic DownloadFilePreview(DmsFileEntity dmsFile)
+ {
+ var webRootPath = service.Configuration["FileServiceSettings:ScaleDmsFileDirectory"];
+
+ var fileExtension = Path.GetExtension(dmsFile.OrderKey);//获取文件格式,拓展名
+
+ var filePath = $"\\{dmsFile.CreatedBy}\\{fileExtension.Replace(".", "")}\\";
+
+ string path = webRootPath + filePath + dmsFile.OrderKey;
+
+ if (!File.Exists(path)) throw new ValidatedException("文件不存在.");
+
+ var stream = System.IO.File.OpenRead(path);
+
+ //string contentType = "image/*";
+ string contentType = "application/octet-stream";
+
+ return new FileStreamResult(stream, contentType) { FileDownloadName = dmsFile.OrderKey };
+
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Find)]
+ public dynamic DownloadFileCombine(string fileName)
+ {
+ var webRootPath = service.Configuration["FileServiceSettings:UploadDmsFileDirectory"];
+
+ var fileExtension = Path.GetExtension(fileName);//获取文件格式,拓展名
+
+ var filePath = $"\\{service.UserId}\\{fileExtension.Replace(".", "")}\\";
+
+ string path = webRootPath + filePath + fileName;
+
+ if (!File.Exists(path)) throw new ValidatedException("文件不存在.");
+
+ var stream = System.IO.File.OpenRead(path);
+
+ //string contentType = "image/*";
+ string contentType = "application/octet-stream";
+
+ return new FileStreamResult(stream, contentType) { FileDownloadName = fileName };
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Find)]
+ public int FindDmsFolderMapByFolderName(string folderName)
+ {
+ IRepository repositoryFolderMap = repository.GetRepository>();
+
+ return repositoryFolderMap.DetachedEntities.Where(x => x.FolderNameSon == folderName).Count();
+ }
+
+ [PermissionOperate(name: AIPermissionPolicy.DmsFile, operate: Operate.Find)]
+ public string FindFolderNameParentByFolderName(string folderName)
+ {
+ IRepository repositoryFolderMap = repository.GetRepository>();
+ if (repositoryFolderMap.DetachedEntities.Where(x => x.FolderNameSon == folderName).Count() == 0) return string.Empty;
+
+ return repositoryFolderMap.DetachedEntities.Where(x => x.FolderNameSon == folderName).FirstOrDefault()!.FolderNameParent;
+ }
+
+ }
+}
diff --git a/CloudBuilder.AI.Service/Utility/ChapterSplitter.cs b/CloudBuilder.AI.Service/Utility/ChapterSplitter.cs
new file mode 100644
index 0000000..f711a10
--- /dev/null
+++ b/CloudBuilder.AI.Service/Utility/ChapterSplitter.cs
@@ -0,0 +1,154 @@
+using CloudBuilder.AI.Entity;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+
+namespace CloudBuilder.AI.Service.Utility
+{
+ ///
+ /// 章节分割器
+ /// 不同的小说有自己的分割方法,可以传入参数
+ ///
+ public class ChapterSplitter
+ {
+ public ChapterSplitter()
+ {
+
+ }
+ ///
+ /// 按章节分割小说文本
+ ///
+ public List SplitNovelIntoChapters(string novelText, string chapterPatterns)
+ {
+ var chapters = new List();
+ var lines = novelText.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
+ var currentAiChapterEntity = new StringBuilder();
+ var currentAiChapterEntityTitle = "未命名章节";
+ var chapterCount = 1;
+
+ foreach (var line in lines)
+ {
+ // 检查是否是章节标题
+ if (IsChapterTitle(line, chapterPatterns))
+ {
+ // 如果当前章节有内容,则保存
+ if (currentAiChapterEntity.Length > 0)
+ {
+ chapters.Add(new AiChapterEntity
+ {
+ Title = currentAiChapterEntityTitle,
+ Guid = Guid.NewGuid().ToString(),
+ Content = currentAiChapterEntity.ToString(),
+ ChapterIndex = chapterCount
+ });
+ currentAiChapterEntity.Clear();
+ chapterCount++;
+ }
+
+ // 更新章节标题
+ currentAiChapterEntityTitle = line.Trim();
+ // 添加章节标题
+ currentAiChapterEntity.AppendLine(line.Trim());
+ // 添加一个空行作为分隔,确保章节标题和正文内容分离
+ currentAiChapterEntity.AppendLine();
+ }
+ else
+ {
+ // 添加到当前章节,确保每行独立
+ currentAiChapterEntity.AppendLine(line);
+ }
+ }
+
+ // 添加最后一个章节
+ if (currentAiChapterEntity.Length > 0)
+ {
+ chapters.Add(new AiChapterEntity
+ {
+ Title = currentAiChapterEntityTitle,
+ Content = currentAiChapterEntity.ToString(),
+ Guid = Guid.NewGuid().ToString(),
+ ChapterIndex = chapterCount
+ });
+ }
+
+ return chapters;
+ }
+
+ ///
+ /// 检查是否为章节标题
+ ///
+ private bool IsChapterTitle(string line, string cptPattern)
+ {
+ // 去除首尾空白字符
+ var trimmedLine = line.Trim();
+
+ // 常见的章节标题模式
+ var chapterPatterns = new[]
+ {
+ @"^第\s*[\u4e00-\u9fa50-9]+\s*章", // 第X章, 第XX章等
+ @"^第\s*[0-9]+\s*章", // 第1章, 第2章等
+ };
+
+ if (!string.IsNullOrEmpty(cptPattern))
+ {
+ Array.Resize(ref chapterPatterns, chapterPatterns.Length + 1);
+ chapterPatterns[chapterPatterns.Length - 1] = cptPattern;
+ }
+
+ foreach (var pattern in chapterPatterns)
+ {
+ if (Regex.IsMatch(trimmedLine, pattern, RegexOptions.IgnoreCase))
+ {
+ //第一章内容说明了什么,请描述一下:
+ if (trimmedLine.Length > 20) return false;
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ ///
+ /// 保存章节到单独的文件
+ ///
+ public void SaveChaptersToFiles(List chapters, string outputDirectory)
+ {
+ // 确保输出目录存在
+ if (!Directory.Exists(outputDirectory))
+ {
+ Directory.CreateDirectory(outputDirectory);
+ }
+
+ foreach (var chapter in chapters)
+ {
+ // 使用章节标题作为文件名,清理非法字符
+ var fileName = CleanFileName(chapter.Title) + ".txt";
+ var filePath = Path.Combine(outputDirectory, fileName);
+ File.WriteAllText(filePath, chapter.Content, Encoding.UTF8);
+ }
+ }
+
+ ///
+ /// 清理文件名中的非法字符
+ ///
+ private string CleanFileName(string fileName)
+ {
+ var invalidChars = Path.GetInvalidFileNameChars();
+ foreach (var invalidChar in invalidChars)
+ {
+ fileName = fileName.Replace(invalidChar, '_');
+ }
+
+ // 限制文件名长度
+ if (fileName.Length > 100)
+ {
+ fileName = fileName.Substring(0, 100);
+ }
+
+ return fileName;
+ }
+ }
+}
diff --git a/CloudBuilder.AI.Service/Utility/ParagraphSplitter.cs b/CloudBuilder.AI.Service/Utility/ParagraphSplitter.cs
new file mode 100644
index 0000000..c1b1316
--- /dev/null
+++ b/CloudBuilder.AI.Service/Utility/ParagraphSplitter.cs
@@ -0,0 +1,88 @@
+using CloudBuilder.AI.Data;
+using CloudBuilder.AI.Entity;
+using DocumentFormat.OpenXml.Spreadsheet;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudBuilder.AI.Service.Utility
+{
+ public class ParagraphSplitter
+ {
+ public ParagraphSplitter()
+ {
+ }
+ public void PackParagraphs(AiBookData data)
+ {
+ if (data.AiChapters == null || data.AiChapters.Length == 0) return;
+
+ var paragraphs = new List();
+ var sentences = new List();
+
+ foreach (AiChapterEntity aiChapterEntity in data.AiChapters)
+ {
+ SplitChapterIntoParagraphs(data, aiChapterEntity);
+ if (data.AiParagraphs != null && data.AiParagraphs.Length > 0)
+ paragraphs.AddRange(data.AiParagraphs);
+ if (data.AiSentences != null && data.AiSentences.Length > 0)
+ sentences.AddRange(data.AiSentences);
+ }
+ data.AiParagraphs = paragraphs.ToArray();
+ data.AiSentences = sentences.ToArray();
+ }
+
+ public AiBookData SplitChapterIntoParagraphs(AiBookData data, AiChapterEntity aiChapter)
+ {
+ data.AiParagraphs = null;
+ data.AiSentences = null;
+
+ var paragraphs = new List();
+ var sentences = new List();
+ var temps = new List();
+
+ if (string.IsNullOrWhiteSpace(aiChapter.Content)) return data;
+
+ // 按换行拆分段落(过滤空段落)
+ var paragraphTexts = aiChapter.Content.Split("\r\n")
+ .Select(p => p.Trim())
+ .Where(p => !string.IsNullOrWhiteSpace(p))
+ .ToList();
+
+ SentenceSplitter sentenceSplitter = new SentenceSplitter();
+
+ AiParagraphEntity aiParagraph;
+ int index = 1;
+
+ foreach (var text in paragraphTexts)
+ {
+ if (!ValidText(text)) continue;
+
+ aiParagraph = new AiParagraphEntity();
+ aiParagraph.Content = text;
+ aiParagraph.ChapterGuid = aiChapter.Guid;
+ aiParagraph.Guid = Guid.NewGuid().ToString();
+ aiParagraph.ParagraphIndex = index++;
+ aiParagraph.DialogueIndc = sentenceSplitter.IsDialogue(text) ? YesNoPolicy.YES : YesNoPolicy.NO;
+ paragraphs.Add(aiParagraph);
+
+ temps = sentenceSplitter.SplitByConfigurableQuotes(aiParagraph);
+
+ if (temps != null && temps.Count() > 0) sentences.AddRange(temps);
+ }
+
+ data.AiParagraphs = paragraphs.ToArray();
+ data.AiSentences = sentences.ToArray();
+
+ return data;
+ }
+
+ private bool ValidText(string text)
+ {
+ if (string.IsNullOrWhiteSpace(text.Trim())) return false;
+
+ return true;
+ }
+ }
+}
diff --git a/CloudBuilder.AI.Service/Utility/SentenceSplitter.cs b/CloudBuilder.AI.Service/Utility/SentenceSplitter.cs
new file mode 100644
index 0000000..c25efaa
--- /dev/null
+++ b/CloudBuilder.AI.Service/Utility/SentenceSplitter.cs
@@ -0,0 +1,197 @@
+using CloudBuilder.AI.Entity;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+
+namespace CloudBuilder.AI.Service.Utility
+{
+ ///
+ /// 智能句子分割器
+ ///
+ public class SentenceSplitter
+ {
+ // 成对引号配置数组(可自由扩展,格式:[左引号, 右引号])
+ private readonly List<(string LeftQuote, string RightQuote)> _quotePairs;
+ // 动态生成的正则表达式(匹配所有配置的引号类型)
+ private Regex _dynamicQuotePattern;
+ // 引号内必须包含的结尾标点集合
+ private readonly string _endPunctuations = "?!。,;:、……~·";
+
+ ///
+ /// 默认构造函数:初始化常用成对引号(中文、英文、直角引号)
+ ///
+ public SentenceSplitter()
+ {
+ _quotePairs = new List<(string, string)>
+ {
+ ("“", "”"), // 中文弯引号
+ ("\"", "\""), // 英文双引号(需转义)
+ ("〝", "〞"), // 中文直角引号
+ ("「", "」") // 中文方头引号(可选扩展)
+ };
+ InitDynamicRegex();
+ }
+
+ ///
+ /// 自定义构造函数:允许外部传入任意成对引号配置
+ ///
+ /// 自定义成对引号列表
+ public SentenceSplitter(List<(string LeftQuote, string RightQuote)> customQuotePairs)
+ {
+ _quotePairs = customQuotePairs ?? new List<(string, string)>();
+ InitDynamicRegex();
+ }
+
+ ///
+ /// 初始化动态正则:根据配置的成对引号生成匹配规则
+ ///
+ private void InitDynamicRegex()
+ {
+ if (_quotePairs.Count == 0)
+ {
+ // 空配置时生成空正则,避免匹配任何内容
+ _dynamicQuotePattern = new Regex(@"^$", RegexOptions.Compiled);
+ return;
+ }
+
+ // 步骤1:转义所有引号(避免正则特殊字符冲突),拼接左/右引号匹配组
+ string escapedLeftQuotes = string.Join("|", _quotePairs.Select(p => Regex.Escape(p.LeftQuote)));
+ string escapedRightQuotes = string.Join("|", _quotePairs.Select(p => Regex.Escape(p.RightQuote)));
+ // 步骤2:转义标点集合,避免正则解析错误
+ string escapedPunctuations = Regex.Escape(_endPunctuations);
+
+ // 步骤3:构建动态正则表达式
+ // 分组说明:
+ // ?:匹配配置的任意左引号
+ // ?:匹配引号内的内容(必须以指定标点结尾)
+ // ?:匹配配置的任意右引号
+ string regexPattern = $@"(?{escapedLeftQuotes})(?.+?[{escapedPunctuations}])(?{escapedRightQuotes})";
+ _dynamicQuotePattern = new Regex(regexPattern, RegexOptions.Compiled | RegexOptions.Singleline);
+ }
+
+ ///
+ /// 核心分割方法:按配置的成对引号分割文本,结果无引号字符
+ ///
+ /// 待分割的文本(如:“其他标点符号,如?”紫茜的秀目 或 "其他标点符号,如?"紫茜的秀目)
+ /// 分割后的纯文本列表
+ public List SplitByConfigurableQuotes(AiParagraphEntity aiParagraphEntity)
+ {
+ AiSentenceEntity aiSentence;
+ int sentenceIndex = 1;
+ // 空值/空白校验
+ if (string.IsNullOrWhiteSpace(aiParagraphEntity.Content))
+ {
+ return new List();
+ }
+
+ List result = new List();
+ string remainingText = aiParagraphEntity.Content.Trim();
+ int lastMatchEnd = 0;
+
+ // 遍历所有匹配的「引号+内容+标点+引号」文本块
+ foreach (Match match in _dynamicQuotePattern.Matches(remainingText))
+ {
+ // 1. 提取匹配的左/右引号,校验是否为成对配置
+ string matchedLeft = match.Groups["left"].Value;
+ string matchedRight = match.Groups["right"].Value;
+ bool isPairMatched = _quotePairs.Any(p => p.LeftQuote == matchedLeft && p.RightQuote == matchedRight);
+ if (!isPairMatched)
+ {
+ continue; // 非成对引号,跳过该匹配(避免“xxx"这类混合匹配)
+ }
+
+ // 2. 提取引号前的文本(过滤空值)
+ string prefixText = remainingText.Substring(lastMatchEnd, match.Index - lastMatchEnd).Trim();
+ if (!string.IsNullOrEmpty(prefixText))
+ {
+ aiSentence = new AiSentenceEntity();
+ aiSentence.Guid = Guid.NewGuid().ToString();
+ aiSentence.Content = prefixText;
+ aiSentence.DialogueIndc = YesNoPolicy.NO;
+ aiSentence.SentenceIndex = sentenceIndex++;
+ aiSentence.ParagraphGuid = aiParagraphEntity.Guid;
+ aiSentence.Status = "G";
+ //D-【待确认对话】p-【待确认人物】A-【等待分配角色】G-【生成中】C-【完成】
+ result.Add(aiSentence);
+ }
+
+ // 3. 提取引号内的纯内容(无引号字符)
+ string quotedContent = match.Groups["content"].Value.Trim();
+ if (!string.IsNullOrEmpty(quotedContent))
+ {
+ aiSentence = new AiSentenceEntity();
+ aiSentence.Guid = Guid.NewGuid().ToString();
+ aiSentence.Content = quotedContent;
+ aiSentence.DialogueIndc = YesNoPolicy.YES;
+ aiSentence.SentenceIndex = sentenceIndex++;
+ aiSentence.ParagraphGuid = aiParagraphEntity.Guid;
+ aiSentence.Status = "P";
+ //D-【待确认对话】p-【待确认人物】A-【等待分配角色】G-【生成中】C-【完成】
+ result.Add(aiSentence);
+ }
+
+ // 更新最后匹配位置
+ lastMatchEnd = match.Index + match.Length;
+ }
+
+ // 4. 提取最后一个匹配项后的剩余文本
+ string suffixText = remainingText.Substring(lastMatchEnd).Trim();
+ if (!string.IsNullOrEmpty(suffixText))
+ {
+ aiSentence = new AiSentenceEntity();
+ aiSentence.Guid = Guid.NewGuid().ToString();
+ aiSentence.Content = suffixText;
+ aiSentence.DialogueIndc = YesNoPolicy.NO;
+ aiSentence.SentenceIndex = sentenceIndex++;
+ aiSentence.ParagraphGuid = aiParagraphEntity.Guid;
+ aiSentence.Status = "G";
+ //D-【待确认对话】p-【待确认人物】A-【等待分配角色】G-【生成中】C-【完成】
+ result.Add(aiSentence);
+ }
+
+ return result;
+ }
+
+ ///
+ /// 新增:判断文本是否包含对话内容
+ ///
+ /// 待判断的文本(句子/段落)
+ /// true=包含对话,false=纯旁白/空文本
+ public bool IsDialogue(string text)
+ {
+ // 1. 处理空文本/NULL,直接返回false
+ if (string.IsNullOrWhiteSpace(text))
+ return false;
+
+ // 2. 文本预处理:去空格、统一全角/半角引号
+ string cleanedText = text.Trim();
+ // 替换全角空格为半角,避免干扰判断
+ cleanedText = Regex.Replace(cleanedText, @" ", " ");
+ // 统一引号格式(中文弯引号、直引号 → 标准双引号)
+ cleanedText = cleanedText.Replace("“", "\"")
+ .Replace("”", "\"")
+ .Replace("〝", "\"")
+ .Replace("〞", "\"")
+ .Replace("「", "\"")
+ .Replace("」", "\"")
+ .Replace("‘", "'")
+ .Replace("’", "'");
+
+ // 3. 核心判断规则:
+ // - 包含成对/单个双引号(排除仅含引号无内容的情况)
+ // - 包含冒号+引号(如:"XXX说:"XXX"" 场景)
+ var hasQuote = Regex.IsMatch(cleanedText, @""".+?""") || // 成对双引号(含内容)
+ Regex.IsMatch(cleanedText, @":\s*"""); // 冒号后接引号(说话人+对话)
+ var hasSingleQuote = Regex.IsMatch(cleanedText, @"'[^']+'"); // 成对单引号(英文对话)
+
+ // 4. 排除仅含引号符号的无效情况(如 ""、''、“”)
+ var onlyQuote = Regex.IsMatch(cleanedText, @"^\s*[""''“”]{1,2}\s*$");
+
+ // 最终判断:包含有效引号且不是仅含引号 → 判定为对话
+ return (hasQuote || hasSingleQuote) && !onlyQuote;
+ }
+ }
+}
diff --git a/CloudBuilder.AI/Data/AiBookProcessData.cs b/CloudBuilder.AI/Data/AiBookProcessData.cs
new file mode 100644
index 0000000..e00ac78
--- /dev/null
+++ b/CloudBuilder.AI/Data/AiBookProcessData.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudBuilder.AI.Data
+{
+ public class AiBookProcessData
+ {
+ public string? Encoding { get; set; } = string.Empty;
+
+ public string? Pattern { get; set; } = string.Empty;
+ }
+}
diff --git a/CloudBuilder.AI/Data/AiBookResultData.cs b/CloudBuilder.AI/Data/AiBookResultData.cs
new file mode 100644
index 0000000..1e2a49d
--- /dev/null
+++ b/CloudBuilder.AI/Data/AiBookResultData.cs
@@ -0,0 +1,20 @@
+using CloudBuilder.AI.Entity;
+using CloudBuilder.Core.Authorization;
+using CloudBuilder.Core.Service;
+using CloudBuilder.Security.Entity;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudBuilder.AI.Data
+{
+
+ [TypeScript]
+ public class AiBookResultData : SearchCriteriaResultData
+ {
+ public AiBookEntity[]? Datas { get; set; }
+
+ }
+}
diff --git a/CloudBuilder.AI/Data/AiChapterResultData.cs b/CloudBuilder.AI/Data/AiChapterResultData.cs
new file mode 100644
index 0000000..bdaeeae
--- /dev/null
+++ b/CloudBuilder.AI/Data/AiChapterResultData.cs
@@ -0,0 +1,17 @@
+using CloudBuilder.AI.Entity;
+using CloudBuilder.Core.Authorization;
+using CloudBuilder.Core.Service;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudBuilder.AI.Data
+{
+ [TypeScript]
+ public class AiChapterResultData : SearchCriteriaResultData
+ {
+ public AiChapterEntity[]? Datas { get; set; }
+ }
+}
diff --git a/CloudBuilder.AI/Data/AiParagraphResultData.cs b/CloudBuilder.AI/Data/AiParagraphResultData.cs
new file mode 100644
index 0000000..195e5ef
--- /dev/null
+++ b/CloudBuilder.AI/Data/AiParagraphResultData.cs
@@ -0,0 +1,18 @@
+using CloudBuilder.AI.Entity;
+using CloudBuilder.Core.Authorization;
+using CloudBuilder.Core.Service;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudBuilder.AI.Data
+{
+
+ [TypeScript]
+ public class AiParagraphResultData : SearchCriteriaResultData
+ {
+ public AiParagraphEntity[]? Datas { get; set; }
+ }
+}
diff --git a/CloudBuilder.AI/Data/AiSentenceViewResultData.cs b/CloudBuilder.AI/Data/AiSentenceViewResultData.cs
new file mode 100644
index 0000000..8cbc651
--- /dev/null
+++ b/CloudBuilder.AI/Data/AiSentenceViewResultData.cs
@@ -0,0 +1,18 @@
+using CloudBuilder.AI.Entity;
+using CloudBuilder.Core.Authorization;
+using CloudBuilder.Core.Service;
+using CloudBuilder.Security.Entity;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudBuilder.AI.Data
+{
+ [TypeScript]
+ public class AiSentenceViewResultData : SearchCriteriaResultData
+ {
+ public AiSentenceViewEntity[]? Datas { get; set; }
+ }
+}
diff --git a/CloudBuilder.AI/Data/BookDmsFileViewDisplayData.cs b/CloudBuilder.AI/Data/BookDmsFileViewDisplayData.cs
new file mode 100644
index 0000000..7014eb3
--- /dev/null
+++ b/CloudBuilder.AI/Data/BookDmsFileViewDisplayData.cs
@@ -0,0 +1,36 @@
+using CloudBuilder.AI.Entity;
+using CloudBuilder.Core.Authorization;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudBuilder.AI.Data
+{
+ [NotMapped]
+ [TypeScript]
+ public class BookDmsFileViewDisplayData : BookDmsFileViewEntity
+ {
+ public BookDmsFileViewDisplayData()
+ {
+ }
+ public BookDmsFileViewDisplayData(BookDmsFileViewEntity entity)
+ {
+ CopyFrom(entity);
+ }
+
+ public const string IS_SELECTED = "IsSelected";
+
+ public const string IS_PLAY = "IsPlay";
+ public const string IS_PAUSE = "IsPause";
+ public bool? IsSelected { get; set; }
+
+ public string? IsPlay { get; set; }
+
+ public string? IsPause { get; set; }
+
+ public string? FormattedPic { get; set; }
+ }
+}
diff --git a/CloudBuilder.AI/Data/DmsFileResultData.cs b/CloudBuilder.AI/Data/DmsFileResultData.cs
new file mode 100644
index 0000000..804d827
--- /dev/null
+++ b/CloudBuilder.AI/Data/DmsFileResultData.cs
@@ -0,0 +1,18 @@
+using CloudBuilder.Core.Authorization;
+using CloudBuilder.Core.Service;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudBuilder.AI.Data
+{
+ [TypeScript]
+ public class DmsFileResultData : SearchCriteriaResultData
+ {
+ public BookDmsFileViewDisplayData[]? Datas { get; set; }
+
+ public string[]? Previews { get; set; }
+ }
+}
diff --git a/CloudBuilder.AI/Data/DmsFolderTreeData.cs b/CloudBuilder.AI/Data/DmsFolderTreeData.cs
new file mode 100644
index 0000000..8bce328
--- /dev/null
+++ b/CloudBuilder.AI/Data/DmsFolderTreeData.cs
@@ -0,0 +1,17 @@
+using CloudBuilder.AI.Entity;
+using CloudBuilder.Core.Authorization;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudBuilder.AI.Data
+{
+ [TypeScript]
+ public class DmsFolderTreeData
+ {
+ public DmsFolderEntity[]? DmsFolders { get; set; }
+ public DmsFolderMapEntity[]? DmsFoldersMaps { get; set; }
+ }
+}
diff --git a/CloudBuilder.AI/Entity/BookDmsFileEntity.auto.cs b/CloudBuilder.AI/Entity/BookDmsFileEntity.auto.cs
new file mode 100644
index 0000000..8ff6075
--- /dev/null
+++ b/CloudBuilder.AI/Entity/BookDmsFileEntity.auto.cs
@@ -0,0 +1,118 @@
+using CloudBuilder.Core.Authorization;
+using CloudBuilder.Core.DatabaseAccessor.Entity;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+namespace CloudBuilder.AI.Entity
+ {
+ [TypeScript]
+ [Table("book_dms_file")]
+ public class BookDmsFileEntity : EntityBase
+ {
+
+ public BookDmsFileEntity()
+ {
+ }
+
+ [Column("created_datetime")]
+ public DateTime CreatedDatetime { get; set; }
+ [Column("created_by")]
+ public string CreatedBy { get; set; }
+ [Column("updated_datetime")]
+ public DateTime UpdatedDatetime { get; set; }
+ [Column("updated_by")]
+ public string UpdatedBy { get; set; }
+ [Key]
+ [Column("file_id")]
+ public int FileId { get; set; }
+ [Column("upload_name")]
+ public string UploadName { get; set; }
+ [Column("file_category")]
+ public string FileCategory { get; set; }
+ [Column("org_file_name")]
+ public string OrgFileName { get; set; }
+
+ public const string CREATED_DATETIME = "CreatedDatetime";
+ public const string CREATED_BY = "CreatedBy";
+ public const string UPDATED_DATETIME = "UpdatedDatetime";
+ public const string UPDATED_BY = "UpdatedBy";
+ public const string FILE_ID = "FileId";
+ public const string UPLOAD_NAME = "UploadName";
+ public const string FILE_CATEGORY = "FileCategory";
+ public const string ORG_FILE_NAME = "OrgFileName";
+
+ public const string DB_NAME_BOOK_DMS_FILE = "book_dms_file";
+ public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,file_id,upload_name,file_category,org_file_name";
+
+ public const string DB_CREATED_DATETIME = "created_datetime";
+ public const string DB_CREATED_BY = "created_by";
+ public const string DB_UPDATED_DATETIME = "updated_datetime";
+ public const string DB_UPDATED_BY = "updated_by";
+ public const string DB_FILE_ID = "file_id";
+ public const string DB_UPLOAD_NAME = "upload_name";
+ public const string DB_FILE_CATEGORY = "file_category";
+ public const string DB_ORG_FILE_NAME = "org_file_name";
+
+
+ public static BookDmsFileEntity GetInstance()
+ {
+ return new BookDmsFileEntity();
+ }
+
+ public virtual void CopyFrom(BookDmsFileEntity source)
+ {
+ CopyFrom(source, true);
+ }
+
+ public virtual void CopyFrom(BookDmsFileEntity source, bool includeSystemFields)
+ {
+ if (source == null)
+ {
+ throw new NullReferenceException("Source entity is null.");
+ }
+
+ this.CreatedDatetime = source.CreatedDatetime;
+ this.CreatedBy = source.CreatedBy;
+ this.UpdatedDatetime = source.UpdatedDatetime;
+ this.UpdatedBy = source.UpdatedBy;
+ this.FileId = source.FileId;
+ this.UploadName = source.UploadName;
+ this.FileCategory = source.FileCategory;
+ this.OrgFileName = source.OrgFileName;
+
+ if (includeSystemFields)
+ {
+ this.CreatedDatetime = source.CreatedDatetime;
+ this.CreatedBy = source.CreatedBy;
+ this.UpdatedDatetime = source.UpdatedDatetime;
+ this.UpdatedBy = source.UpdatedBy;
+ }
+ }
+
+ public override string GetSelectFrom()
+ {
+ return $" select {DB_NAME_FIELDS} from { DB_NAME_BOOK_DMS_FILE} with(nolock) ";
+ }
+
+ public override string GetSelectCountFrom(string sqlWhere)
+ {
+ return $" select count(*) from { DB_NAME_BOOK_DMS_FILE} with(nolock) where 1=1 {sqlWhere}";
+ }
+
+ public override string GetSelectTopFrom(int limit, int start,string orderby,string orderbytag, string sqlWhere)
+ {
+ if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc";
+ if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_FILE_ID ;
+ string top = limit > 0 ? $"top {limit}" : "";
+ return $" select {top} {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_BOOK_DMS_FILE} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}";
+ }
+
+ public BookDmsFileEntity Clone()
+ {
+ BookDmsFileEntity result = new BookDmsFileEntity();
+ result.CopyFrom(this);
+
+ return result;
+ }
+
+ }
+}
diff --git a/CloudBuilder.AI/Entity/BookDmsFileViewEntity.auto.cs b/CloudBuilder.AI/Entity/BookDmsFileViewEntity.auto.cs
new file mode 100644
index 0000000..3d5b00b
--- /dev/null
+++ b/CloudBuilder.AI/Entity/BookDmsFileViewEntity.auto.cs
@@ -0,0 +1,190 @@
+using CloudBuilder.Core.Authorization;
+using CloudBuilder.Core.DatabaseAccessor.Entity;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+namespace CloudBuilder.AI.Entity
+ {
+ [TypeScript]
+ [Table("book_dms_file_view")]
+ public class BookDmsFileViewEntity : ViewEntityBase
+ {
+
+ public BookDmsFileViewEntity()
+ {
+ }
+
+ [Column("created_datetime")]
+ public DateTime CreatedDatetime { get; set; }
+ [Column("created_by")]
+ public string CreatedBy { get; set; }
+ [Column("file_id")]
+ public int FileId { get; set; }
+ [Column("upload_name")]
+ public string UploadName { get; set; }
+ [Column("file_category")]
+ public string FileCategory { get; set; }
+ [Column("org_file_name")]
+ public string OrgFileName { get; set; }
+ [Column("allow_delete_indc")]
+ public string AllowDeleteIndc { get; set; }
+ [Column("file_type")]
+ public string? FileType { get; set; }
+ [Column("landscape_indc")]
+ public string? LandscapeIndc { get; set; }
+ [Column("transcode_indc")]
+ public string? TranscodeIndc { get; set; }
+ [Column("url")]
+ public string Url { get; set; }
+ [Column("is_directory_indc")]
+ public string IsDirectoryIndc { get; set; }
+ [Column("is_link_indc")]
+ public string IsLinkIndc { get; set; }
+ [Column("linked_file_id")]
+ public int LinkedFileId { get; set; }
+ [Column("order_key")]
+ public string? OrderKey { get; set; }
+ [Column("file_tag")]
+ public string? FileTag { get; set; }
+ [Column("allow_rename_indc")]
+ public string AllowRenameIndc { get; set; }
+ [Column("file_name")]
+ public string FileName { get; set; }
+ [Column("file_path")]
+ public string FilePath { get; set; }
+ [Column("folder_local_name")]
+ public string? FolderLocalName { get; set; }
+ [Column("file_size")]
+ public int FileSize { get; set; }
+ [Column("ower_id")]
+ public string OwerId { get; set; }
+ [Column("revision_no")]
+ public int RevisionNo { get; set; }
+
+ public const string CREATED_DATETIME = "CreatedDatetime";
+ public const string CREATED_BY = "CreatedBy";
+ public const string FILE_ID = "FileId";
+ public const string UPLOAD_NAME = "UploadName";
+ public const string FILE_CATEGORY = "FileCategory";
+ public const string ORG_FILE_NAME = "OrgFileName";
+ public const string ALLOW_DELETE_INDC = "AllowDeleteIndc";
+ public const string FILE_TYPE = "FileType";
+ public const string LANDSCAPE_INDC = "LandscapeIndc";
+ public const string TRANSCODE_INDC = "TranscodeIndc";
+ public const string URL = "Url";
+ public const string IS_DIRECTORY_INDC = "IsDirectoryIndc";
+ public const string IS_LINK_INDC = "IsLinkIndc";
+ public const string LINKED_FILE_ID = "LinkedFileId";
+ public const string ORDER_KEY = "OrderKey";
+ public const string FILE_TAG = "FileTag";
+ public const string ALLOW_RENAME_INDC = "AllowRenameIndc";
+ public const string FILE_NAME = "FileName";
+ public const string FILE_PATH = "FilePath";
+ public const string FOLDER_LOCAL_NAME = "FolderLocalName";
+ public const string FILE_SIZE = "FileSize";
+ public const string OWER_ID = "OwerId";
+ public const string REVISION_NO = "RevisionNo";
+
+ public const string DB_NAME_BOOK_DMS_FILE_VIEW = "book_dms_file_view";
+ public const string DB_NAME_FIELDS="created_datetime,created_by,file_id,upload_name,file_category,org_file_name,allow_delete_indc,file_type,landscape_indc,transcode_indc,url,is_directory_indc,is_link_indc,linked_file_id,order_key,file_tag,allow_rename_indc,file_name,file_path,folder_local_name,file_size,ower_id,revision_no";
+
+ public const string DB_CREATED_DATETIME = "created_datetime";
+ public const string DB_CREATED_BY = "created_by";
+ public const string DB_FILE_ID = "file_id";
+ public const string DB_UPLOAD_NAME = "upload_name";
+ public const string DB_FILE_CATEGORY = "file_category";
+ public const string DB_ORG_FILE_NAME = "org_file_name";
+ public const string DB_ALLOW_DELETE_INDC = "allow_delete_indc";
+ public const string DB_FILE_TYPE = "file_type";
+ public const string DB_LANDSCAPE_INDC = "landscape_indc";
+ public const string DB_TRANSCODE_INDC = "transcode_indc";
+ public const string DB_URL = "url";
+ public const string DB_IS_DIRECTORY_INDC = "is_directory_indc";
+ public const string DB_IS_LINK_INDC = "is_link_indc";
+ public const string DB_LINKED_FILE_ID = "linked_file_id";
+ public const string DB_ORDER_KEY = "order_key";
+ public const string DB_FILE_TAG = "file_tag";
+ public const string DB_ALLOW_RENAME_INDC = "allow_rename_indc";
+ public const string DB_FILE_NAME = "file_name";
+ public const string DB_FILE_PATH = "file_path";
+ public const string DB_FOLDER_LOCAL_NAME = "folder_local_name";
+ public const string DB_FILE_SIZE = "file_size";
+ public const string DB_OWER_ID = "ower_id";
+ public const string DB_REVISION_NO = "revision_no";
+
+
+ public static BookDmsFileViewEntity GetInstance()
+ {
+ return new BookDmsFileViewEntity();
+ }
+
+ public virtual void CopyFrom(BookDmsFileViewEntity source)
+ {
+ CopyFrom(source, true);
+ }
+
+ public virtual void CopyFrom(BookDmsFileViewEntity source, bool includeSystemFields)
+ {
+ if (source == null)
+ {
+ throw new NullReferenceException("Source entity is null.");
+ }
+
+ this.CreatedDatetime = source.CreatedDatetime;
+ this.CreatedBy = source.CreatedBy;
+ this.FileId = source.FileId;
+ this.UploadName = source.UploadName;
+ this.FileCategory = source.FileCategory;
+ this.OrgFileName = source.OrgFileName;
+ this.AllowDeleteIndc = source.AllowDeleteIndc;
+ this.FileType = source.FileType;
+ this.LandscapeIndc = source.LandscapeIndc;
+ this.TranscodeIndc = source.TranscodeIndc;
+ this.Url = source.Url;
+ this.IsDirectoryIndc = source.IsDirectoryIndc;
+ this.IsLinkIndc = source.IsLinkIndc;
+ this.LinkedFileId = source.LinkedFileId;
+ this.OrderKey = source.OrderKey;
+ this.FileTag = source.FileTag;
+ this.AllowRenameIndc = source.AllowRenameIndc;
+ this.FileName = source.FileName;
+ this.FilePath = source.FilePath;
+ this.FolderLocalName = source.FolderLocalName;
+ this.FileSize = source.FileSize;
+ this.OwerId = source.OwerId;
+ this.RevisionNo = source.RevisionNo;
+
+ if (includeSystemFields)
+ {
+ this.CreatedDatetime = source.CreatedDatetime;
+ this.CreatedBy = source.CreatedBy;
+ }
+ }
+
+ public override string GetSelectFrom()
+ {
+ return $" select {DB_NAME_FIELDS} from { DB_NAME_BOOK_DMS_FILE_VIEW} with(nolock) ";
+ }
+
+ public override string GetSelectCountFrom(string sqlWhere)
+ {
+ return $" select count(*) from { DB_NAME_BOOK_DMS_FILE_VIEW} with(nolock) where 1=1 {sqlWhere}";
+ }
+
+ public override string GetSelectTopFrom(int limit, int start,string orderby,string orderbytag, string sqlWhere)
+ {
+ if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc";
+
+ if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_CREATED_DATETIME ; string top = limit > 0 ? $"top {limit}" : "";
+ return $" select {top} {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_BOOK_DMS_FILE_VIEW} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}";
+ }
+
+ public BookDmsFileViewEntity Clone()
+ {
+ BookDmsFileViewEntity result = new BookDmsFileViewEntity();
+ result.CopyFrom(this);
+
+ return result;
+ }
+
+ }
+}
diff --git a/CloudBuilder.AI/Entity/DmsFileEntity.auto.cs b/CloudBuilder.AI/Entity/DmsFileEntity.auto.cs
new file mode 100644
index 0000000..06aadc1
--- /dev/null
+++ b/CloudBuilder.AI/Entity/DmsFileEntity.auto.cs
@@ -0,0 +1,184 @@
+using CloudBuilder.Core.Authorization;
+using CloudBuilder.Core.DatabaseAccessor.Entity;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+namespace CloudBuilder.AI.Entity
+ {
+ [TypeScript]
+ [Table("dms_file")]
+ public class DmsFileEntity : EntityBase
+ {
+
+ public DmsFileEntity()
+ {
+ }
+
+ [Column("created_datetime")]
+ public DateTime CreatedDatetime { get; set; }
+ [Column("created_by")]
+ public string CreatedBy { get; set; }
+ [Column("updated_datetime")]
+ public DateTime UpdatedDatetime { get; set; }
+ [Column("updated_by")]
+ public string UpdatedBy { get; set; }
+ [Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ [Column("file_id")]
+ public int FileId { get; set; }
+ [Column("file_name")]
+ public string FileName { get; set; }
+ [Column("file_type")]
+ public string? FileType { get; set; }
+ [Column("landscape_indc")]
+ public string? LandscapeIndc { get; set; }
+ [Column("transcode_indc")]
+ public string? TranscodeIndc { get; set; }
+ [Column("linked_file_id")]
+ public int LinkedFileId { get; set; }
+ [Column("org_file_name")]
+ public string OrgFileName { get; set; }
+ [Column("order_key")]
+ public string? OrderKey { get; set; }
+ [Column("file_tag")]
+ public string? FileTag { get; set; }
+ [Column("allow_rename_indc")]
+ public string AllowRenameIndc { get; set; }
+ [Column("allow_delete_indc")]
+ public string AllowDeleteIndc { get; set; }
+ [Column("file_path")]
+ public string FilePath { get; set; }
+ [Column("file_size")]
+ public int FileSize { get; set; }
+ [Column("ower_id")]
+ public string OwerId { get; set; }
+ [Column("revision_no")]
+ public int RevisionNo { get; set; }
+ [Column("is_directory_indc")]
+ public string IsDirectoryIndc { get; set; }
+ [Column("is_link_indc")]
+ public string IsLinkIndc { get; set; }
+
+ public const string CREATED_DATETIME = "CreatedDatetime";
+ public const string CREATED_BY = "CreatedBy";
+ public const string UPDATED_DATETIME = "UpdatedDatetime";
+ public const string UPDATED_BY = "UpdatedBy";
+ public const string FILE_ID = "FileId";
+ public const string FILE_NAME = "FileName";
+ public const string FILE_TYPE = "FileType";
+ public const string LANDSCAPE_INDC = "LandscapeIndc";
+ public const string TRANSCODE_INDC = "TranscodeIndc";
+ public const string LINKED_FILE_ID = "LinkedFileId";
+ public const string ORG_FILE_NAME = "OrgFileName";
+ public const string ORDER_KEY = "OrderKey";
+ public const string FILE_TAG = "FileTag";
+ public const string ALLOW_RENAME_INDC = "AllowRenameIndc";
+ public const string ALLOW_DELETE_INDC = "AllowDeleteIndc";
+ public const string FILE_PATH = "FilePath";
+ public const string FILE_SIZE = "FileSize";
+ public const string OWER_ID = "OwerId";
+ public const string REVISION_NO = "RevisionNo";
+ public const string IS_DIRECTORY_INDC = "IsDirectoryIndc";
+ public const string IS_LINK_INDC = "IsLinkIndc";
+
+ public const string DB_NAME_DMS_FILE = "dms_file";
+ public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,file_id,file_name,file_type,landscape_indc,transcode_indc,linked_file_id,org_file_name,order_key,file_tag,allow_rename_indc,allow_delete_indc,file_path,file_size,ower_id,revision_no,is_directory_indc,is_link_indc";
+
+ public const string DB_CREATED_DATETIME = "created_datetime";
+ public const string DB_CREATED_BY = "created_by";
+ public const string DB_UPDATED_DATETIME = "updated_datetime";
+ public const string DB_UPDATED_BY = "updated_by";
+ public const string DB_FILE_ID = "file_id";
+ public const string DB_FILE_NAME = "file_name";
+ public const string DB_FILE_TYPE = "file_type";
+ public const string DB_LANDSCAPE_INDC = "landscape_indc";
+ public const string DB_TRANSCODE_INDC = "transcode_indc";
+ public const string DB_LINKED_FILE_ID = "linked_file_id";
+ public const string DB_ORG_FILE_NAME = "org_file_name";
+ public const string DB_ORDER_KEY = "order_key";
+ public const string DB_FILE_TAG = "file_tag";
+ public const string DB_ALLOW_RENAME_INDC = "allow_rename_indc";
+ public const string DB_ALLOW_DELETE_INDC = "allow_delete_indc";
+ public const string DB_FILE_PATH = "file_path";
+ public const string DB_FILE_SIZE = "file_size";
+ public const string DB_OWER_ID = "ower_id";
+ public const string DB_REVISION_NO = "revision_no";
+ public const string DB_IS_DIRECTORY_INDC = "is_directory_indc";
+ public const string DB_IS_LINK_INDC = "is_link_indc";
+
+
+ public static DmsFileEntity GetInstance()
+ {
+ return new DmsFileEntity();
+ }
+
+ public virtual void CopyFrom(DmsFileEntity source)
+ {
+ CopyFrom(source, true);
+ }
+
+ public virtual void CopyFrom(DmsFileEntity source, bool includeSystemFields)
+ {
+ if (source == null)
+ {
+ throw new NullReferenceException("Source entity is null.");
+ }
+
+ this.CreatedDatetime = source.CreatedDatetime;
+ this.CreatedBy = source.CreatedBy;
+ this.UpdatedDatetime = source.UpdatedDatetime;
+ this.UpdatedBy = source.UpdatedBy;
+ this.FileId = source.FileId;
+ this.FileName = source.FileName;
+ this.FileType = source.FileType;
+ this.LandscapeIndc = source.LandscapeIndc;
+ this.TranscodeIndc = source.TranscodeIndc;
+ this.LinkedFileId = source.LinkedFileId;
+ this.OrgFileName = source.OrgFileName;
+ this.OrderKey = source.OrderKey;
+ this.FileTag = source.FileTag;
+ this.AllowRenameIndc = source.AllowRenameIndc;
+ this.AllowDeleteIndc = source.AllowDeleteIndc;
+ this.FilePath = source.FilePath;
+ this.FileSize = source.FileSize;
+ this.OwerId = source.OwerId;
+ this.RevisionNo = source.RevisionNo;
+ this.IsDirectoryIndc = source.IsDirectoryIndc;
+ this.IsLinkIndc = source.IsLinkIndc;
+
+ if (includeSystemFields)
+ {
+ this.CreatedDatetime = source.CreatedDatetime;
+ this.CreatedBy = source.CreatedBy;
+ this.UpdatedDatetime = source.UpdatedDatetime;
+ this.UpdatedBy = source.UpdatedBy;
+ }
+ }
+
+ public override string GetSelectFrom()
+ {
+ return $" select {DB_NAME_FIELDS} from { DB_NAME_DMS_FILE} with(nolock) ";
+ }
+
+ public override string GetSelectCountFrom(string sqlWhere)
+ {
+ return $" select count(*) from { DB_NAME_DMS_FILE} with(nolock) where 1=1 {sqlWhere}";
+ }
+
+ public override string GetSelectTopFrom(int limit, int start,string orderby,string orderbytag, string sqlWhere)
+ {
+ if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc";
+ if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_FILE_ID ;
+ string top = limit > 0 ? $"top {limit}" : "";
+ return $" select {top} {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_DMS_FILE} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}";
+ }
+
+ public DmsFileEntity Clone()
+ {
+ DmsFileEntity result = new DmsFileEntity();
+ result.CopyFrom(this);
+
+ return result;
+ }
+
+ }
+}
diff --git a/CloudBuilder.AI/Entity/DmsFolderEntity.auto.cs b/CloudBuilder.AI/Entity/DmsFolderEntity.auto.cs
new file mode 100644
index 0000000..aff23cd
--- /dev/null
+++ b/CloudBuilder.AI/Entity/DmsFolderEntity.auto.cs
@@ -0,0 +1,114 @@
+using CloudBuilder.Core.Authorization;
+using CloudBuilder.Core.DatabaseAccessor.Entity;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+namespace CloudBuilder.AI.Entity
+ {
+ [TypeScript]
+ [Table("dms_folder")]
+ public class DmsFolderEntity : EntityBase
+ {
+
+ public DmsFolderEntity()
+ {
+ }
+
+ [Column("created_datetime")]
+ public DateTime CreatedDatetime { get; set; }
+ [Column("created_by")]
+ public string CreatedBy { get; set; }
+ [Column("updated_datetime")]
+ public DateTime UpdatedDatetime { get; set; }
+ [Column("updated_by")]
+ public string UpdatedBy { get; set; }
+ [Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ [Column("folder_id")]
+ public int FolderId { get; set; }
+ [Column("folder_name")]
+ public string FolderName { get; set; }
+ [Column("folder_local_name")]
+ public string? FolderLocalName { get; set; }
+
+ public const string CREATED_DATETIME = "CreatedDatetime";
+ public const string CREATED_BY = "CreatedBy";
+ public const string UPDATED_DATETIME = "UpdatedDatetime";
+ public const string UPDATED_BY = "UpdatedBy";
+ public const string FOLDER_ID = "FolderId";
+ public const string FOLDER_NAME = "FolderName";
+ public const string FOLDER_LOCAL_NAME = "FolderLocalName";
+
+ public const string DB_NAME_DMS_FOLDER = "dms_folder";
+ public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,folder_id,folder_name,folder_local_name";
+
+ public const string DB_CREATED_DATETIME = "created_datetime";
+ public const string DB_CREATED_BY = "created_by";
+ public const string DB_UPDATED_DATETIME = "updated_datetime";
+ public const string DB_UPDATED_BY = "updated_by";
+ public const string DB_FOLDER_ID = "folder_id";
+ public const string DB_FOLDER_NAME = "folder_name";
+ public const string DB_FOLDER_LOCAL_NAME = "folder_local_name";
+
+
+ public static DmsFolderEntity GetInstance()
+ {
+ return new DmsFolderEntity();
+ }
+
+ public virtual void CopyFrom(DmsFolderEntity source)
+ {
+ CopyFrom(source, true);
+ }
+
+ public virtual void CopyFrom(DmsFolderEntity source, bool includeSystemFields)
+ {
+ if (source == null)
+ {
+ throw new NullReferenceException("Source entity is null.");
+ }
+
+ this.CreatedDatetime = source.CreatedDatetime;
+ this.CreatedBy = source.CreatedBy;
+ this.UpdatedDatetime = source.UpdatedDatetime;
+ this.UpdatedBy = source.UpdatedBy;
+ this.FolderId = source.FolderId;
+ this.FolderName = source.FolderName;
+ this.FolderLocalName = source.FolderLocalName;
+
+ if (includeSystemFields)
+ {
+ this.CreatedDatetime = source.CreatedDatetime;
+ this.CreatedBy = source.CreatedBy;
+ this.UpdatedDatetime = source.UpdatedDatetime;
+ this.UpdatedBy = source.UpdatedBy;
+ }
+ }
+
+ public override string GetSelectFrom()
+ {
+ return $" select {DB_NAME_FIELDS} from { DB_NAME_DMS_FOLDER} with(nolock) ";
+ }
+
+ public override string GetSelectCountFrom(string sqlWhere)
+ {
+ return $" select count(*) from { DB_NAME_DMS_FOLDER} with(nolock) where 1=1 {sqlWhere}";
+ }
+
+ public override string GetSelectTopFrom(int limit, int start,string orderby,string orderbytag, string sqlWhere)
+ {
+ if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc";
+ if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_FOLDER_ID ;
+ string top = limit > 0 ? $"top {limit}" : "";
+ return $" select {top} {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_DMS_FOLDER} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}";
+ }
+
+ public DmsFolderEntity Clone()
+ {
+ DmsFolderEntity result = new DmsFolderEntity();
+ result.CopyFrom(this);
+
+ return result;
+ }
+
+ }
+}
diff --git a/CloudBuilder.AI/Entity/DmsFolderMapEntity.auto.cs b/CloudBuilder.AI/Entity/DmsFolderMapEntity.auto.cs
new file mode 100644
index 0000000..d41eb40
--- /dev/null
+++ b/CloudBuilder.AI/Entity/DmsFolderMapEntity.auto.cs
@@ -0,0 +1,112 @@
+using CloudBuilder.Core.Authorization;
+using CloudBuilder.Core.DatabaseAccessor.Entity;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+namespace CloudBuilder.AI.Entity
+ {
+ [TypeScript]
+ [Table("dms_folder_map")]
+ public class DmsFolderMapEntity : EntityBase
+ {
+
+ public DmsFolderMapEntity()
+ {
+ }
+
+ [Column("created_datetime")]
+ public DateTime CreatedDatetime { get; set; }
+ [Column("created_by")]
+ public string CreatedBy { get; set; }
+ [Column("updated_datetime")]
+ public DateTime UpdatedDatetime { get; set; }
+ [Column("updated_by")]
+ public string UpdatedBy { get; set; }
+ [Column("folder_name_parent")]
+ public string FolderNameParent { get; set; }
+ [Column("folder_name_son")]
+ public string FolderNameSon { get; set; }
+ [Column("orderby")]
+ public int Orderby { get; set; }
+
+ public const string CREATED_DATETIME = "CreatedDatetime";
+ public const string CREATED_BY = "CreatedBy";
+ public const string UPDATED_DATETIME = "UpdatedDatetime";
+ public const string UPDATED_BY = "UpdatedBy";
+ public const string FOLDER_NAME_PARENT = "FolderNameParent";
+ public const string FOLDER_NAME_SON = "FolderNameSon";
+ public const string ORDERBY = "Orderby";
+
+ public const string DB_NAME_DMS_FOLDER_MAP = "dms_folder_map";
+ public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,folder_name_parent,folder_name_son,orderby";
+
+ public const string DB_CREATED_DATETIME = "created_datetime";
+ public const string DB_CREATED_BY = "created_by";
+ public const string DB_UPDATED_DATETIME = "updated_datetime";
+ public const string DB_UPDATED_BY = "updated_by";
+ public const string DB_FOLDER_NAME_PARENT = "folder_name_parent";
+ public const string DB_FOLDER_NAME_SON = "folder_name_son";
+ public const string DB_ORDERBY = "orderby";
+
+
+ public static DmsFolderMapEntity GetInstance()
+ {
+ return new DmsFolderMapEntity();
+ }
+
+ public virtual void CopyFrom(DmsFolderMapEntity source)
+ {
+ CopyFrom(source, true);
+ }
+
+ public virtual void CopyFrom(DmsFolderMapEntity source, bool includeSystemFields)
+ {
+ if (source == null)
+ {
+ throw new NullReferenceException("Source entity is null.");
+ }
+
+ this.CreatedDatetime = source.CreatedDatetime;
+ this.CreatedBy = source.CreatedBy;
+ this.UpdatedDatetime = source.UpdatedDatetime;
+ this.UpdatedBy = source.UpdatedBy;
+ this.FolderNameParent = source.FolderNameParent;
+ this.FolderNameSon = source.FolderNameSon;
+ this.Orderby = source.Orderby;
+
+ if (includeSystemFields)
+ {
+ this.CreatedDatetime = source.CreatedDatetime;
+ this.CreatedBy = source.CreatedBy;
+ this.UpdatedDatetime = source.UpdatedDatetime;
+ this.UpdatedBy = source.UpdatedBy;
+ }
+ }
+
+ public override string GetSelectFrom()
+ {
+ return $" select {DB_NAME_FIELDS} from { DB_NAME_DMS_FOLDER_MAP} with(nolock) ";
+ }
+
+ public override string GetSelectCountFrom(string sqlWhere)
+ {
+ return $" select count(*) from { DB_NAME_DMS_FOLDER_MAP} with(nolock) where 1=1 {sqlWhere}";
+ }
+
+ public override string GetSelectTopFrom(int limit, int start,string orderby,string orderbytag, string sqlWhere)
+ {
+ if (string.IsNullOrEmpty(orderbytag) || orderbytag.Trim() != "desc") orderbytag = "asc";
+ if (string.IsNullOrEmpty(orderby) || !DB_NAME_FIELDS.Contains(orderby)) orderby = DB_FOLDER_NAME_PARENT ;
+ string top = limit > 0 ? $"top {limit}" : "";
+ return $" select {top} {DB_NAME_FIELDS} from (select {DB_NAME_FIELDS} ,row_number() over(order by {orderby} {orderbytag}) as num from { DB_NAME_DMS_FOLDER_MAP} with(nolock) where 1=1 {sqlWhere} ) a where num> {limit * (start - 1)}";
+ }
+
+ public DmsFolderMapEntity Clone()
+ {
+ DmsFolderMapEntity result = new DmsFolderMapEntity();
+ result.CopyFrom(this);
+
+ return result;
+ }
+
+ }
+}
diff --git a/CloudBuilder.AI/Entity/DmsFolderMapEntityKey.auto.cs b/CloudBuilder.AI/Entity/DmsFolderMapEntityKey.auto.cs
new file mode 100644
index 0000000..faa2f09
--- /dev/null
+++ b/CloudBuilder.AI/Entity/DmsFolderMapEntityKey.auto.cs
@@ -0,0 +1,32 @@
+using CloudBuilder.Core.Authorization;
+namespace CloudBuilder.AI
+{
+ [TypeScript]
+ public class DmsFolderMapEntityKey
+ {
+ public string FolderNameParent { get; set; }
+ public string FolderNameSon { get; set; }
+
+ public override bool Equals(object obj)
+ {
+ if (this == obj) return true;
+
+ DmsFolderMapEntityKey pkey = obj as DmsFolderMapEntityKey;
+ if (pkey == null) return false;
+
+ if (FolderNameParent != pkey.FolderNameParent) return false;
+ if (FolderNameSon != pkey.FolderNameSon) return false;
+
+ return true;
+ }
+
+
+ public override string ToString()
+ {
+ string declareSql="";
+ declareSql=declareSql+$"declare @__tkey_FolderNameParent_0 varchar(50) select @__tkey_FolderNameParent_0 ='{FolderNameParent}'; " ; declareSql=declareSql+$"declare @__tkey_FolderNameSon_1 varchar(50) select @__tkey_FolderNameSon_1 ='{FolderNameSon}'; " ;
+ return declareSql;
+ }
+ }
+ }
+ /* builder.Entity().HasKey(c => new { c.FolderNameParent, c.FolderNameSon}); */
diff --git a/CloudBuilder.AI/Linkup/AiBookOperationLinkup.cs b/CloudBuilder.AI/Linkup/AiBookOperationLinkup.cs
new file mode 100644
index 0000000..4bd4699
--- /dev/null
+++ b/CloudBuilder.AI/Linkup/AiBookOperationLinkup.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudBuilder.AI.Linkup
+{
+ public class AiBookOperationLinkup
+ {
+ public int DisplayMode;
+
+ public string Guid;
+ }
+}
diff --git a/CloudBuilder.AI/Policy/AIPrefixPolicy.cs b/CloudBuilder.AI/Policy/AIPrefixPolicy.cs
new file mode 100644
index 0000000..ab60c4e
--- /dev/null
+++ b/CloudBuilder.AI/Policy/AIPrefixPolicy.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudBuilder.AI.Policy
+{
+ public class AIPrefixPolicy
+ {
+ public const string AI_BOOK = "AI_BOOK";
+ public const string GUID = "GUID";
+ public const string AI_BOOK_PREFIX = "B";
+ public const string AI_BOOK_GUID_FORMAT = "000000";
+
+
+ public const string BOOK_DMS_FILE = "BOOK_DMS_FILE";
+ public const string BOOK_DMS_FILE_BOOK_NAME = "BOOK_NAME";
+ public const string BOOK_DMS_FILE_FORMAT = "00000000";
+
+ public const string DMS_FOLDER = "DMS_FOLDER";
+ public const string DMS_FOLDER_FOLDER_NAME = "FOLDER_NAME";
+ }
+}
diff --git a/CloudBuilder.AI/SearchCriteria/DmsFileSearchCriteria.auto.cs b/CloudBuilder.AI/SearchCriteria/DmsFileSearchCriteria.auto.cs
new file mode 100644
index 0000000..d6683bd
--- /dev/null
+++ b/CloudBuilder.AI/SearchCriteria/DmsFileSearchCriteria.auto.cs
@@ -0,0 +1,10 @@
+using CloudBuilder.Core.Authorization;
+using CloudBuilder.Core.Service;
+namespace CloudBuilder.AI.SearchCriteria
+{
+ [TypeScript]
+ public class DmsFileSearchCriteria: AbstractSearchCriteria
+ {
+
+ }
+}
diff --git a/CloudBuilder.AI/Service/IDmsFileService.auto.cs b/CloudBuilder.AI/Service/IDmsFileService.auto.cs
new file mode 100644
index 0000000..3359917
--- /dev/null
+++ b/CloudBuilder.AI/Service/IDmsFileService.auto.cs
@@ -0,0 +1,44 @@
+
+using CloudBuilder.AI.Data;
+using CloudBuilder.AI.Entity;
+using CloudBuilder.AI.SearchCriteria;
+using CloudBuilder.Core.Service;
+using Microsoft.AspNetCore.Http;
+
+namespace CloudBuilder.AI.Service
+{
+ public interface IDmsFileService : IServiceBase
+ {
+ DmsFileResultData FindBySearchCriteria(DmsFileSearchCriteria tc);
+ dynamic PrintBySearchCriteria(DmsFileSearchCriteria tc);
+
+ DmsFileEntity PackUploadFile(IFormFile file, string folderName);
+
+ DmsFileEntity CreateDmsFile(DmsFileEntity dmsFile);
+
+ string GetFolderName(string folderLocalName);
+ string CreateDmsFolder(DmsFileEntity dmsFile);
+
+ DmsFileEntity UpdateDmsFolder(DmsFileEntity dmsFile);
+
+ void MoveDmsFolder(DmsFileEntity dmsFile);
+
+ SelectOption[] FindDmsFolders();
+ DmsFolderTreeData FindDmsFolderTreeData();
+ BookDmsFileViewEntity UploadFile();
+
+ dynamic DownloadFile(int fileId);
+
+ dynamic DownloadFilePreview(DmsFileEntity dmsFile);
+
+ dynamic DownloadFileCombine(string fileName);
+
+ DmsFileResultData FindDatasBySearchCriteria(DmsFileSearchCriteria criteria);
+
+ void DeleteFolder(string folderName);
+
+ int FindDmsFolderMapByFolderName(string folderName);
+
+ string FindFolderNameParentByFolderName(string folderName);
+ }
+}
diff --git a/CloudBuilder.Request/AI/AiBookPersonRequest.auto.cs b/CloudBuilder.Request/AI/AiBookPersonRequest.auto.cs
new file mode 100644
index 0000000..d39cf0d
--- /dev/null
+++ b/CloudBuilder.Request/AI/AiBookPersonRequest.auto.cs
@@ -0,0 +1,41 @@
+
+using CloudBuilder.Core.DependencyInjection.Request;
+using CloudBuilder.Core.Request;
+using CloudBuilder.Core.Service;
+using Microsoft.Extensions.DependencyInjection;
+using CloudBuilder.AI.Service;
+ using CloudBuilder.Core.DatabaseAccessor.Entity;
+ using CloudBuilder.AI.Entity;
+ using System;
+
+namespace CloudBuilder.Request.AI
+{
+
+public class AiBookPersonRequest : IRequest
+{
+
+private readonly IServiceRequest serviceRequest;
+public AiBookPersonRequest(IServiceRequest serviceRequest)
+{
+this.serviceRequest = serviceRequest;
+}
+
+ public AiBookPersonEntity FindByKey(string key)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiBookPerson/FindByKey?key=" + key.ToString())).GetAwaiter().GetResult(); }
+
+ public AiBookPersonEntity Insert(AiBookPersonEntity data)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiBookPerson/Insert" , data)).GetAwaiter().GetResult(); }
+
+ public AiBookPersonEntity Update(AiBookPersonEntity data)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiBookPerson/Update" , data)).GetAwaiter().GetResult(); }
+
+ public void Delete(string key)
+ {
+ Task.Run(() => serviceRequest.PostAsync("/AiBookPerson/Delete?key=" + key.ToString())).GetAwaiter().GetResult(); }
+
+
+}
+}
\ No newline at end of file
diff --git a/CloudBuilder.Request/AI/AiBookRequest.auto.cs b/CloudBuilder.Request/AI/AiBookRequest.auto.cs
new file mode 100644
index 0000000..8de047e
--- /dev/null
+++ b/CloudBuilder.Request/AI/AiBookRequest.auto.cs
@@ -0,0 +1,66 @@
+
+using CloudBuilder.Core.DependencyInjection.Request;
+using CloudBuilder.Core.Request;
+using CloudBuilder.Core.Service;
+using Microsoft.Extensions.DependencyInjection;
+using CloudBuilder.AI.Service;
+ using CloudBuilder.Core.DatabaseAccessor.Entity;
+ using CloudBuilder.AI.Entity;
+ using System;
+ using CloudBuilder.AI.Data;
+ using CloudBuilder.AI.SearchCriteria;
+
+namespace CloudBuilder.Request.AI
+{
+
+public class AiBookRequest : IRequest
+{
+
+private readonly IServiceRequest serviceRequest;
+public AiBookRequest(IServiceRequest serviceRequest)
+{
+this.serviceRequest = serviceRequest;
+}
+
+ public AiBookData FindByKey(string key)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiBook/FindByKey?key=" + key.ToString())).GetAwaiter().GetResult(); }
+
+ public AiBookEntity FindByTitle(string title)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiBook/FindByTitle?title=" + title.ToString())).GetAwaiter().GetResult(); }
+
+ public AiBookResultData FindBySearchCriteria(AiBookSearchCriteria criteria)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiBook/FindBySearchCriteria" , criteria)).GetAwaiter().GetResult(); }
+
+ public AiBookData Insert(AiBookData data)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiBook/Insert" , data)).GetAwaiter().GetResult(); }
+
+ public AiBookData Update(AiBookData data)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiBook/Update" , data)).GetAwaiter().GetResult(); }
+
+ public void Delete(string key)
+ {
+ Task.Run(() => serviceRequest.PostAsync("/AiBook/Delete?key=" + key.ToString())).GetAwaiter().GetResult(); }
+
+ public void Deletes(string[] keys)
+ {
+ Task.Run(() => serviceRequest.PostAsJsonAsync("/AiBook/Deletes" , keys)).GetAwaiter().GetResult(); }
+
+
+ public class ProcessBookCompositionData3 {
+ public string key { get; set; }
+ public string encoding { get; set; }
+ public string pattern { get; set; }
+
+ }
+ public AiBookData ProcessBook(string key, string encoding, string pattern)
+ {
+var compositionData = new ProcessBookCompositionData3{
key = key,
encoding = encoding,
pattern = pattern };
return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiBook/ProcessBook", compositionData)).GetAwaiter().GetResult(); }
+
+
+}
+}
\ No newline at end of file
diff --git a/CloudBuilder.Request/AI/AiChapterPersonRequest.auto.cs b/CloudBuilder.Request/AI/AiChapterPersonRequest.auto.cs
new file mode 100644
index 0000000..64c9172
--- /dev/null
+++ b/CloudBuilder.Request/AI/AiChapterPersonRequest.auto.cs
@@ -0,0 +1,43 @@
+
+using CloudBuilder.Core.DependencyInjection.Request;
+using CloudBuilder.Core.Request;
+using CloudBuilder.Core.Service;
+using Microsoft.Extensions.DependencyInjection;
+using CloudBuilder.AI.Service;
+ using CloudBuilder.Core.DatabaseAccessor.Entity;
+ using CloudBuilder.AI.Entity;
+ using System;
+ using CloudBuilder.AI.Data;
+ using CloudBuilder.AI.SearchCriteria;
+
+namespace CloudBuilder.Request.AI
+{
+
+public class AiChapterPersonRequest : IRequest
+{
+
+private readonly IServiceRequest serviceRequest;
+public AiChapterPersonRequest(IServiceRequest serviceRequest)
+{
+this.serviceRequest = serviceRequest;
+}
+
+ public AiChapterPersonEntity FindByKey(string key)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiChapterPerson/FindByKey?key=" + key.ToString())).GetAwaiter().GetResult(); }
+
+ public AiChapterPersonEntity Insert(AiChapterPersonEntity data)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiChapterPerson/Insert" , data)).GetAwaiter().GetResult(); }
+
+ public AiChapterPersonEntity Update(AiChapterPersonEntity data)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiChapterPerson/Update" , data)).GetAwaiter().GetResult(); }
+
+ public void Delete(string key)
+ {
+ Task.Run(() => serviceRequest.PostAsync("/AiChapterPerson/Delete?key=" + key.ToString())).GetAwaiter().GetResult(); }
+
+
+}
+}
\ No newline at end of file
diff --git a/CloudBuilder.Request/AI/AiChapterRequest.auto.cs b/CloudBuilder.Request/AI/AiChapterRequest.auto.cs
new file mode 100644
index 0000000..c6ea1a3
--- /dev/null
+++ b/CloudBuilder.Request/AI/AiChapterRequest.auto.cs
@@ -0,0 +1,51 @@
+
+using CloudBuilder.Core.DependencyInjection.Request;
+using CloudBuilder.Core.Request;
+using CloudBuilder.Core.Service;
+using Microsoft.Extensions.DependencyInjection;
+using CloudBuilder.AI.Service;
+ using CloudBuilder.Core.DatabaseAccessor.Entity;
+ using CloudBuilder.AI.Entity;
+ using System;
+ using CloudBuilder.AI.Data;
+ using CloudBuilder.AI.SearchCriteria;
+
+namespace CloudBuilder.Request.AI
+{
+
+public class AiChapterRequest : IRequest
+{
+
+private readonly IServiceRequest serviceRequest;
+public AiChapterRequest(IServiceRequest serviceRequest)
+{
+this.serviceRequest = serviceRequest;
+}
+
+ public AiChapterEntity FindByKey(string key)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiChapter/FindByKey?key=" + key.ToString())).GetAwaiter().GetResult(); }
+
+ public AiChapterEntity[] FindByTitle(string title)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiChapter/FindByTitle?title=" + title.ToString())).GetAwaiter().GetResult(); }
+
+ public AiChapterResultData FindBySearchCriteria(AiChapterSearchCriteria criteria)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiChapter/FindBySearchCriteria" , criteria)).GetAwaiter().GetResult(); }
+
+ public AiChapterEntity Insert(AiChapterEntity data)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiChapter/Insert" , data)).GetAwaiter().GetResult(); }
+
+ public AiChapterEntity Update(AiChapterEntity data)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiChapter/Update" , data)).GetAwaiter().GetResult(); }
+
+ public void Delete(string key)
+ {
+ Task.Run(() => serviceRequest.PostAsync("/AiChapter/Delete?key=" + key.ToString())).GetAwaiter().GetResult(); }
+
+
+}
+}
\ No newline at end of file
diff --git a/CloudBuilder.Request/AI/AiParagraphRequest.auto.cs b/CloudBuilder.Request/AI/AiParagraphRequest.auto.cs
new file mode 100644
index 0000000..f369450
--- /dev/null
+++ b/CloudBuilder.Request/AI/AiParagraphRequest.auto.cs
@@ -0,0 +1,47 @@
+
+using CloudBuilder.Core.DependencyInjection.Request;
+using CloudBuilder.Core.Request;
+using CloudBuilder.Core.Service;
+using Microsoft.Extensions.DependencyInjection;
+using CloudBuilder.AI.Service;
+ using CloudBuilder.Core.DatabaseAccessor.Entity;
+ using CloudBuilder.AI.Entity;
+ using System;
+ using CloudBuilder.AI.Data;
+ using CloudBuilder.AI.SearchCriteria;
+
+namespace CloudBuilder.Request.AI
+{
+
+public class AiParagraphRequest : IRequest
+{
+
+private readonly IServiceRequest serviceRequest;
+public AiParagraphRequest(IServiceRequest serviceRequest)
+{
+this.serviceRequest = serviceRequest;
+}
+
+ public AiParagraphEntity FindByKey(string key)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiParagraph/FindByKey?key=" + key.ToString())).GetAwaiter().GetResult(); }
+
+ public AiParagraphEntity Insert(AiParagraphEntity data)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiParagraph/Insert" , data)).GetAwaiter().GetResult(); }
+
+ public void Inserts(AiParagraphEntity[] datas)
+ {
+ Task.Run(() => serviceRequest.PostAsJsonAsync("/AiParagraph/Inserts" , datas)).GetAwaiter().GetResult(); }
+
+ public AiParagraphEntity Update(AiParagraphEntity data)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiParagraph/Update" , data)).GetAwaiter().GetResult(); }
+
+ public void Delete(string key)
+ {
+ Task.Run(() => serviceRequest.PostAsync("/AiParagraph/Delete?key=" + key.ToString())).GetAwaiter().GetResult(); }
+
+
+}
+}
\ No newline at end of file
diff --git a/CloudBuilder.Request/AI/AiSentenceRequest.auto.cs b/CloudBuilder.Request/AI/AiSentenceRequest.auto.cs
new file mode 100644
index 0000000..79a9523
--- /dev/null
+++ b/CloudBuilder.Request/AI/AiSentenceRequest.auto.cs
@@ -0,0 +1,55 @@
+
+using CloudBuilder.Core.DependencyInjection.Request;
+using CloudBuilder.Core.Request;
+using CloudBuilder.Core.Service;
+using Microsoft.Extensions.DependencyInjection;
+using CloudBuilder.AI.Service;
+ using CloudBuilder.Core.DatabaseAccessor.Entity;
+ using CloudBuilder.AI.Entity;
+ using System;
+ using CloudBuilder.AI.Data;
+ using CloudBuilder.AI.SearchCriteria;
+
+namespace CloudBuilder.Request.AI
+{
+
+public class AiSentenceRequest : IRequest
+{
+
+private readonly IServiceRequest serviceRequest;
+public AiSentenceRequest(IServiceRequest serviceRequest)
+{
+this.serviceRequest = serviceRequest;
+}
+
+ public AiSentenceEntity FindByKey(string key)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiSentence/FindByKey?key=" + key.ToString())).GetAwaiter().GetResult(); }
+
+ public AiSentenceViewEntity[] FindByChapterGuid(string chapterGuid)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiSentence/FindByChapterGuid?chapterGuid=" + chapterGuid.ToString())).GetAwaiter().GetResult(); }
+
+ public AiSentenceViewResultData FindBySearchCriteria(AiSentenceSearchCriteria criteria)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiSentence/FindBySearchCriteria" , criteria)).GetAwaiter().GetResult(); }
+
+ public AiSentenceEntity Insert(AiSentenceEntity data)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiSentence/Insert" , data)).GetAwaiter().GetResult(); }
+
+ public void Inserts(AiSentenceEntity[] datas)
+ {
+ Task.Run(() => serviceRequest.PostAsJsonAsync("/AiSentence/Inserts" , datas)).GetAwaiter().GetResult(); }
+
+ public AiSentenceEntity Update(AiSentenceEntity data)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiSentence/Update" , data)).GetAwaiter().GetResult(); }
+
+ public void Delete(string key)
+ {
+ Task.Run(() => serviceRequest.PostAsync("/AiSentence/Delete?key=" + key.ToString())).GetAwaiter().GetResult(); }
+
+
+}
+}
\ No newline at end of file
diff --git a/CloudBuilder.Request/AI/DmsFileRequest.auto.cs b/CloudBuilder.Request/AI/DmsFileRequest.auto.cs
new file mode 100644
index 0000000..82f1e7c
--- /dev/null
+++ b/CloudBuilder.Request/AI/DmsFileRequest.auto.cs
@@ -0,0 +1,104 @@
+
+using CloudBuilder.Core.DependencyInjection.Request;
+using CloudBuilder.Core.Request;
+using CloudBuilder.Core.Service;
+using Microsoft.Extensions.DependencyInjection;
+using CloudBuilder.AI.Service;
+ using CloudBuilder.Core.DatabaseAccessor.Entity;
+ using CloudBuilder.AI.Entity;
+ using System;
+ using CloudBuilder.AI.Data;
+ using CloudBuilder.AI.SearchCriteria;
+ using Microsoft.AspNetCore.Http;
+
+namespace CloudBuilder.Request.AI
+{
+
+public class DmsFileRequest : IRequest
+{
+
+private readonly IServiceRequest serviceRequest;
+public DmsFileRequest(IServiceRequest serviceRequest)
+{
+this.serviceRequest = serviceRequest;
+}
+
+ public DmsFileEntity FindByKey(Int32 key)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/DmsFile/FindByKey?key=" + key.ToString())).GetAwaiter().GetResult(); }
+
+ public DmsFileResultData FindBySearchCriteria(DmsFileSearchCriteria criteria)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/DmsFile/FindBySearchCriteria" , criteria)).GetAwaiter().GetResult(); }
+
+ public DmsFileResultData FindDatasBySearchCriteria(DmsFileSearchCriteria criteria)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/DmsFile/FindDatasBySearchCriteria" , criteria)).GetAwaiter().GetResult(); }
+
+ public dynamic PrintBySearchCriteria(DmsFileSearchCriteria criteria)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/DmsFile/PrintBySearchCriteria" , criteria)).GetAwaiter().GetResult(); }
+
+ public DmsFileEntity Insert(DmsFileEntity data)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/DmsFile/Insert" , data)).GetAwaiter().GetResult(); }
+
+ public DmsFileEntity Update(DmsFileEntity data)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/DmsFile/Update" , data)).GetAwaiter().GetResult(); }
+
+ public void Delete(Int32 key)
+ {
+ Task.Run(() => serviceRequest.PostAsync("/DmsFile/Delete?key=" + key.ToString())).GetAwaiter().GetResult(); }
+
+ public string GetFolderName(string folderLocalName)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/DmsFile/GetFolderName?folderLocalName=" + folderLocalName.ToString())).GetAwaiter().GetResult(); }
+
+ public string CreateDmsFolder(DmsFileEntity dmsFile)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/DmsFile/CreateDmsFolder" , dmsFile)).GetAwaiter().GetResult(); }
+
+ public DmsFileEntity UpdateDmsFolder(DmsFileEntity dmsFile)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/DmsFile/UpdateDmsFolder" , dmsFile)).GetAwaiter().GetResult(); }
+
+ public SelectOption[] FindDmsFolders()
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync ("/DmsFile/FindDmsFolders")).GetAwaiter().GetResult(); }
+
+ public DmsFolderTreeData FindDmsFolderTreeData()
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync ("/DmsFile/FindDmsFolderTreeData")).GetAwaiter().GetResult(); }
+
+ public void MoveDmsFolder(DmsFileEntity dmsFile)
+ {
+ Task.Run(() => serviceRequest.PostAsJsonAsync("/DmsFile/MoveDmsFolder" , dmsFile)).GetAwaiter().GetResult(); }
+
+ public BookDmsFileViewEntity UploadFile()
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync ("/DmsFile/UploadFile")).GetAwaiter().GetResult(); }
+
+ public dynamic DownloadFile(Int32 fileId)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/DmsFile/DownloadFile?fileId=" + fileId.ToString())).GetAwaiter().GetResult(); }
+
+ public dynamic DownloadFilePreview(DmsFileEntity dmsFile)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/DmsFile/DownloadFilePreview" , dmsFile)).GetAwaiter().GetResult(); }
+
+ public dynamic DownloadFileCombine(string fileName)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/DmsFile/DownloadFileCombine?fileName=" + fileName.ToString())).GetAwaiter().GetResult(); }
+
+ public Int32 FindDmsFolderMapByFolderName(string folderName)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/DmsFile/FindDmsFolderMapByFolderName?folderName=" + folderName.ToString())).GetAwaiter().GetResult(); }
+
+ public string FindFolderNameParentByFolderName(string folderName)
+ {
+return Task.Run(() => serviceRequest.PostAsJsonAsync("/DmsFile/FindFolderNameParentByFolderName?folderName=" + folderName.ToString())).GetAwaiter().GetResult(); }
+
+
+}
+}
\ No newline at end of file
diff --git a/CloudBuilder.Security/Policy/FileTypePolicy.cs b/CloudBuilder.Security/Policy/FileTypePolicy.cs
new file mode 100644
index 0000000..a671cb0
--- /dev/null
+++ b/CloudBuilder.Security/Policy/FileTypePolicy.cs
@@ -0,0 +1,126 @@
+using CloudBuilder.Core.DatabaseAccessor.Entity;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudBuilder.Security.Policy
+{
+ public class FileTypePolicy
+ {
+ public const string VIDEO = "V";
+ public const string AUDIO = "A";
+ public const string PHOTO = "P";
+ public const string DOCUMENT = "D";
+ public const string LYRIC = "L";
+
+ public static string GetType(string value)
+ {
+ if (string.IsNullOrEmpty(value)) return DOCUMENT;
+ else if (value.ToLower().Contains(".lrc")) return LYRIC;
+
+ else if (value.ToLower().Contains(".jpg") || value.ToLower().Contains(".png") ||
+ value.ToLower().Contains(".webp") || value.ToLower().Contains(".bmp") ||
+ value.ToLower().Contains(".gif") || value.ToLower().Contains(".jpeg")) return PHOTO;
+
+ else if (value.ToLower().Contains(".avi") || value.ToLower().Contains(".mpeg") ||
+ value.ToLower().Contains(".mov") || value.ToLower().Contains(".wmv") ||
+ value.ToLower().Contains(".mp4") || value.ToLower().Contains(".mkv") ||
+ value.ToLower().Contains(".flv") || value.ToLower().Contains(".rm")) return VIDEO;
+
+ else if (value.ToLower().Contains(".mp3") || value.ToLower().Contains(".wav") ||
+ value.ToLower().Contains(".flac") || value.ToLower().Contains(".ape") ||
+ value.ToLower().Contains(".wma") || value.ToLower().Contains(".mid")) return AUDIO;
+
+ return DOCUMENT;
+ }
+
+
+ public static bool IsAudio(string value)
+ {
+ return GetType(value) == AUDIO;
+ }
+
+ public static bool IsPhoto(string value)
+ {
+ return GetType(value) == PHOTO;
+ }
+
+ public static bool IsVideo(string value)
+ {
+ return GetType(value) == VIDEO;
+ }
+
+ public static bool IsLyric(string value)
+ {
+ return GetType(value) == LYRIC;
+ }
+
+
+ public static string PackUrl(IApplicationService service, string createdBy, string orderKey, string transcodeIndc)
+ {
+ string url = string.Empty;
+ var webRootPath = service.Configuration["FileServiceSettings:RequestPath"];
+ var phy = service.Configuration["FileServiceSettings:PhysicalFileDirectory"];
+
+ var fileExtension = Path.GetExtension(orderKey);//获取文件格式,拓展名
+ if (GetType(orderKey!) == FileTypePolicy.PHOTO)
+ {
+ if (transcodeIndc == YesNoPolicy.YES)
+ {
+ var backup = service.Configuration["FileServiceSettings:BackupDmsFileDirectory"].Replace(phy, "");
+ var filePath = $"{backup.Replace("\\", "/")}/{createdBy}/{fileExtension.Replace(".", "")}/";
+ url = service.Configuration["applicationUrl"] + webRootPath + filePath + orderKey;
+ }
+ else
+ {
+ var scale = service.Configuration["FileServiceSettings:ScaleDmsFileDirectory"].Replace(phy, "");
+ var filePath = $"{scale.Replace("\\", "/")}/{createdBy}/{fileExtension.Replace(".", "")}/";
+ url = service.Configuration["applicationUrl"] + webRootPath + filePath + orderKey;
+ }
+ }
+ else if (GetType(orderKey!) == FileTypePolicy.AUDIO)
+ {
+ var backup = service.Configuration["FileServiceSettings:BackupDmsFileDirectory"].Replace(phy, "");
+ var filePath = $"{backup.Replace("\\", "/")}/{createdBy}/{fileExtension.Replace(".", "")}/";
+ url = service.Configuration["applicationUrl"] + webRootPath + filePath + orderKey;
+ }
+ else if (GetType(orderKey!) == FileTypePolicy.VIDEO)
+ {
+ if (transcodeIndc == YesNoPolicy.YES)
+ {
+ var upload = service.Configuration["FileServiceSettings:UploadDmsFileDirectory"].Replace(phy, "");
+ var filePath = $"{upload.Replace("\\", "/")}/{createdBy}/m3u8/";
+ url = service.Configuration["applicationUrl"] + webRootPath + filePath + Path.GetFileNameWithoutExtension(orderKey) + "/main.m3u8";
+ }
+ else
+ {
+ var backup = service.Configuration["FileServiceSettings:BackupDmsFileDirectory"].Replace(phy, "");
+ var filePath = $"{backup.Replace("\\", "/")}/{createdBy}/{fileExtension.Replace(".", "")}/";
+ url = service.Configuration["applicationUrl"] + webRootPath + filePath + orderKey;
+ }
+ }
+
+ return url;
+ }
+
+ public static string PackSourceVideoUrl(IApplicationService service, string createdBy, string orderKey)
+ {
+ var webRootPath = service.Configuration["FileServiceSettings:RequestPath"];
+ var phy = service.Configuration["FileServiceSettings:PhysicalFileDirectory"];
+ var upload = service.Configuration["FileServiceSettings:BackupDmsFileDirectory"].Replace(phy, "");
+ var fileExtension = Path.GetExtension(orderKey);//获取文件格式,拓展名
+ var filePath = $"{upload.Replace("\\", "/")}/{createdBy}/{fileExtension.Replace(".", "")}/";
+ return service.Configuration["applicationUrl"] + webRootPath + filePath + orderKey;
+
+ }
+ public static string PackFilePath(IApplicationService service, string createdBy, string orderKey)
+ {
+ var backup = service.Configuration["FileServiceSettings:BackupDmsFileDirectory"]!;
+ var fileExtension = Path.GetExtension(orderKey).Replace(".", "");//获取文件格式,拓展名
+
+ return Path.Combine(backup, createdBy, fileExtension, orderKey);
+ }
+ }
+}
diff --git a/CloudBuilder.Web.Entry/Controllers/Ai/DmsFileController.auto.cs b/CloudBuilder.Web.Entry/Controllers/Ai/DmsFileController.auto.cs
new file mode 100644
index 0000000..c90e7c0
--- /dev/null
+++ b/CloudBuilder.Web.Entry/Controllers/Ai/DmsFileController.auto.cs
@@ -0,0 +1,420 @@
+
+using CloudBuilder.Core.DatabaseAccessor;
+using CloudBuilder.Core.Policy;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using System.Transactions;
+using CloudBuilder.Core.Service;
+using CloudBuilder.AI.Service;
+ using CloudBuilder.Core.DatabaseAccessor.Entity;
+ using CloudBuilder.AI.Entity;
+ using System;
+ using CloudBuilder.AI.Data;
+ using CloudBuilder.AI.SearchCriteria;
+ using Microsoft.AspNetCore.Http;
+
+namespace CloudBuilder.Web.Entry.Controllers.Ai
+{
+[Authorize(AuthorizePolicy.PERMISSION)]
+[ApiController]
+[Route("[controller]/[action]")]
+public class DmsFileController : ControllerBase
+{
+private readonly IApplicationService service;
+private readonly IDmsFileService dmsFileService;
+
+public DmsFileController(IApplicationService service, IDmsFileService dmsFileService)
+{
+this.service = service;
+this.dmsFileService= dmsFileService;
+}
+
+ [PermissionOperate(name: "DmsFile", operate: "Find")]
+ [HttpPost]
+ public dynamic FindByKey(Int32 key)
+ {
+ try
+ {
+
+ var result = dmsFileService.FindByKey(key);
+ return result;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Find")]
+ [HttpPost]
+ public dynamic FindBySearchCriteria(DmsFileSearchCriteria criteria)
+ {
+ try
+ {
+
+ var result = dmsFileService.FindBySearchCriteria(criteria);
+ return result;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Find")]
+ [HttpPost]
+ public dynamic FindDatasBySearchCriteria(DmsFileSearchCriteria criteria)
+ {
+ try
+ {
+
+ var result = dmsFileService.FindDatasBySearchCriteria(criteria);
+ return result;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Print")]
+ [HttpPost]
+ public dynamic PrintBySearchCriteria(DmsFileSearchCriteria criteria)
+ {
+ try
+ {
+
+ var result = dmsFileService.PrintBySearchCriteria(criteria);
+ return result;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Insert")]
+ [HttpPost]
+ [UnitOfWork]
+ public dynamic Insert(DmsFileEntity data)
+ {
+ try
+ {
+
+ var result = dmsFileService.Insert(data);
+ return result;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Update")]
+ [HttpPost]
+ [UnitOfWork]
+ public dynamic Update(DmsFileEntity data)
+ {
+ try
+ {
+
+ var result = dmsFileService.Update(data);
+ return result;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Delete")]
+ [HttpPost]
+ [UnitOfWork]
+ public dynamic Delete(Int32 key){
+ try
+ {
+ dmsFileService.Delete(key);
+
+ return string.Empty;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Insert")]
+ [HttpPost]
+ [UnitOfWork]
+ public dynamic GetFolderName(string folderLocalName)
+ {
+ try
+ {
+
+ var result = dmsFileService.GetFolderName(folderLocalName);
+ return result;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Insert")]
+ [HttpPost]
+ [UnitOfWork]
+ public dynamic CreateDmsFolder(DmsFileEntity dmsFile)
+ {
+ try
+ {
+
+ var result = dmsFileService.CreateDmsFolder(dmsFile);
+ return result;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Update")]
+ [HttpPost]
+ [UnitOfWork]
+ public dynamic UpdateDmsFolder(DmsFileEntity dmsFile)
+ {
+ try
+ {
+
+ var result = dmsFileService.UpdateDmsFolder(dmsFile);
+ return result;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Find")]
+ [HttpPost]
+ public dynamic FindDmsFolders()
+ {
+ try
+ {
+
+ var result = dmsFileService.FindDmsFolders();
+ return result;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Find")]
+ [HttpPost]
+ public dynamic FindDmsFolderTreeData()
+ {
+ try
+ {
+
+ var result = dmsFileService.FindDmsFolderTreeData();
+ return result;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Update")]
+ [HttpPost]
+ [UnitOfWork]
+ public dynamic MoveDmsFolder(DmsFileEntity dmsFile){
+ try
+ {
+ dmsFileService.MoveDmsFolder(dmsFile);
+
+ return string.Empty;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Insert")]
+ [HttpPost]
+ [UnitOfWork]
+ public dynamic UploadFile()
+ {
+ try
+ {
+
+ var result = dmsFileService.UploadFile();
+ return result;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Find")]
+ [HttpPost]
+ public dynamic DownloadFile(Int32 fileId)
+ {
+ try
+ {
+
+ var result = dmsFileService.DownloadFile(fileId);
+ return result;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Find")]
+ [HttpPost]
+ public dynamic DownloadFilePreview(DmsFileEntity dmsFile)
+ {
+ try
+ {
+
+ var result = dmsFileService.DownloadFilePreview(dmsFile);
+ return result;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Find")]
+ [HttpPost]
+ public dynamic DownloadFileCombine(string fileName)
+ {
+ try
+ {
+
+ var result = dmsFileService.DownloadFileCombine(fileName);
+ return result;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Find")]
+ [HttpPost]
+ public dynamic FindDmsFolderMapByFolderName(string folderName)
+ {
+ try
+ {
+
+ var result = dmsFileService.FindDmsFolderMapByFolderName(folderName);
+ return result;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+ [PermissionOperate(name: "DmsFile", operate: "Find")]
+ [HttpPost]
+ public dynamic FindFolderNameParentByFolderName(string folderName)
+ {
+ try
+ {
+
+ var result = dmsFileService.FindFolderNameParentByFolderName(folderName);
+ return result;
+ }
+ catch (ValidatedException vex)
+ {
+ return vex;
+ }
+ catch (Exception ex)
+ {
+ return new ServiceErrorException(ex);
+ }
+ }
+
+
+}
+}
\ No newline at end of file
diff --git a/Data/ai.zip b/Data/ai.zip
new file mode 100644
index 0000000..25e5c87
Binary files /dev/null and b/Data/ai.zip differ