基线 SVN r240

SVN-Revision: r240
This commit is contained in:
cyf
2025-02-06 06:46:06 +00:00
commit ab56a9bcf7
5317 changed files with 902274 additions and 0 deletions
@@ -0,0 +1,112 @@
namespace Lskj.PubArtworkDynamic.Control
{
partial class ModuleGrid
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.pl_Bottom = new DevExpress.XtraEditors.PanelControl();
this.btnAdd = new DevExpress.XtraEditors.SimpleButton();
this.btnDel = new DevExpress.XtraEditors.SimpleButton();
this.gc_Main = new Lskj.Control.GridControlEx();
((System.ComponentModel.ISupportInitialize)(this.pl_Bottom)).BeginInit();
this.pl_Bottom.SuspendLayout();
this.SuspendLayout();
//
// pl_Bottom
//
this.pl_Bottom.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_Bottom.Appearance.Options.UseBackColor = true;
this.pl_Bottom.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_Bottom.Controls.Add(this.btnAdd);
this.pl_Bottom.Controls.Add(this.btnDel);
this.pl_Bottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pl_Bottom.Location = new System.Drawing.Point(0, 360);
this.pl_Bottom.LookAndFeel.UseDefaultLookAndFeel = false;
this.pl_Bottom.Margin = new System.Windows.Forms.Padding(4);
this.pl_Bottom.Name = "pl_Bottom";
this.pl_Bottom.Size = new System.Drawing.Size(354, 45);
this.pl_Bottom.TabIndex = 19;
//
// btnAdd
//
this.btnAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnAdd.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnAdd.Appearance.Options.UseFont = true;
this.btnAdd.Location = new System.Drawing.Point(150, 6);
this.btnAdd.Margin = new System.Windows.Forms.Padding(4);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(96, 32);
this.btnAdd.TabIndex = 43;
this.btnAdd.Text = "上传(&A)";
//
// btnDel
//
this.btnDel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnDel.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnDel.Appearance.Options.UseFont = true;
this.btnDel.Location = new System.Drawing.Point(254, 6);
this.btnDel.Margin = new System.Windows.Forms.Padding(4);
this.btnDel.Name = "btnDel";
this.btnDel.Size = new System.Drawing.Size(96, 32);
this.btnDel.TabIndex = 42;
this.btnDel.Text = "删除(&D)";
//
// gc_Main
//
this.gc_Main.AdapterObj = null;
this.gc_Main.AllowDrop = true;
this.gc_Main.Dock = System.Windows.Forms.DockStyle.Fill;
this.gc_Main.Location = new System.Drawing.Point(0, 0);
this.gc_Main.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.gc_Main.Name = "gc_Main";
this.gc_Main.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gc_Main.Size = new System.Drawing.Size(354, 360);
this.gc_Main.TabIndex = 20;
//
// ModuleGrid
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.gc_Main);
this.Controls.Add(this.pl_Bottom);
this.Name = "ModuleGrid";
this.Size = new System.Drawing.Size(354, 405);
((System.ComponentModel.ISupportInitialize)(this.pl_Bottom)).EndInit();
this.pl_Bottom.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private DevExpress.XtraEditors.PanelControl pl_Bottom;
private DevExpress.XtraEditors.SimpleButton btnAdd;
private DevExpress.XtraEditors.SimpleButton btnDel;
private Lskj.Control.GridControlEx gc_Main;
}
}
@@ -0,0 +1,479 @@
using Lskj.Business;
using Lskj.Business.Impl;
using Lskj.Control;
using Lskj.Control.BrowserSetting;
using Lskj.Control.Model;
using Lskj.Core;
using Lskj.Model;
using Lskj.Util;
using Microsoft.WindowsAPICodePack.Shell;
using Newtonsoft.Json.Linq;
using System;
using System.Data;
using System.IO;
using System.Net;
using System.Windows.Forms;
namespace Lskj.PubArtworkDynamic.Control
{
public partial class ModuleGrid : UserControl
{
/// <summary>
/// 模块类
/// </summary>
public ViewModel MainViewModel;
/// <summary>
/// 表格控件
/// </summary>
public GridControlEx MainGridEx { get { return gc_Main; } }
/// <summary>
/// 明细Model
/// </summary>
public GridDetailModel DetailModel;
/// <summary>
/// 条件控件
/// </summary>
public MyControl SearchMainObj;
/// <summary>
/// 左侧节点上方主键
/// </summary>
private string leftTopGridIdValue
{
get
{
ModuleGridDetail moduleGridDetail = (ModuleGridDetail)MainViewModel.LeftTabControl.TabControlObj.SelectedTabPage.Controls[0];
string rtnString = "";
DataRow dataRow = moduleGridDetail.TopGridEx.GridView.GetFocusedDataRow();
if (dataRow != null)
{
if (!string.IsNullOrEmpty(MainViewModel.MoudleMainObj.UploadIdValueField) && dataRow.Table.Columns.Contains(MainViewModel.MoudleMainObj.UploadIdValueField))
{
rtnString = dataRow[MainViewModel.MoudleMainObj.UploadIdValueField] + "";
}
}
return rtnString;
}
}
/// <summary>
/// 左侧节点上方主键
/// </summary>
private string leftBottomGridIdValue
{
get
{
ModuleGridDetail moduleGridDetail = (ModuleGridDetail)MainViewModel.LeftTabControl.TabControlObj.SelectedTabPage.Controls[0];
string rtnString = "";
DataRow dataRow = moduleGridDetail.BottomGridEx.GridView.GetFocusedDataRow();
if (dataRow != null)
{
if (!string.IsNullOrEmpty(MainViewModel.MoudleMainObj.UploadIdValueField) && dataRow.Table.Columns.Contains(MainViewModel.MoudleMainObj.UploadIdValueField))
{
rtnString = dataRow[MainViewModel.MoudleMainObj.UploadIdValueField] + "";
}
}
return rtnString;
}
}
/// <summary>
/// 文件大小
/// </summary>
private static readonly string[] suffixes = new string[] { " B", " KB", " MB", " GB", " TB", " PB" };
/// <summary>
/// 构造函数
/// </summary>
/// <param name="model"></param>
public ModuleGrid(GridDetailModel model)
{
DetailModel = model;
InitializeComponent();
Load += OnModuleGridDetailLoad;
btnAdd.Click += OnBtnAddClick;
btnDel.Click += OnBtnDelClick;
}
/// <summary>
/// 加载完成后
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnModuleGridDetailLoad(object sender, EventArgs e)
{
try
{
gc_Main.GridView.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.RowSelect;
gc_Main.Tag = DetailModel;
if (DetailModel.IsReadOnly)
{
this.SearchMainObj = new MyControl(DetailModel.DetailSql, gc_Main);//构建主表mycontrol
}
else
{
this.SearchMainObj = new MyControl(DetailModel.SystemModel.MenuSql, gc_Main);//构建主表mycontrol
}
DataTable gridColumns = new DataTable();
if (!string.IsNullOrEmpty(DetailModel.UnionModule))
{
gridColumns = BaseModuleImpl.GetBaseGridColumns(DetailModel.UnionModule);
}
else
{
gridColumns = ReportImpl.GetReportDetailColumns(MainViewModel.SysModel.ModuleCode, DetailModel.Id + "");
}
gc_Main.GridView.OptionsBehavior.Editable = false;
gc_Main.SetReadOnlyColumns(gridColumns, GridCustomColumnStruct.BaseMainGridView + DetailModel.FormKey);//明细
DynamicModel dyncModel = new DynamicModuleModel(new string[] { DetailModel.DetailName, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, MainViewModel.SysModel.Privilege, DetailModel.UnionModule, "0" });
if (!string.IsNullOrEmpty(DetailModel.SystemModel.ModeCode))
{
gc_Main.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(DetailModel.SystemModel.ModeCode), dyncModel, OnRightMenuCallBack, this.SearchMainObj);
}
else if (!string.IsNullOrEmpty(DetailModel.FormKey))
{
gc_Main.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(DetailModel.FormKey), dyncModel, OnRightMenuCallBack, this.SearchMainObj);
}
}
catch (Exception ex)
{
MessageUtil.Show(ex.Message);
}
}
/// <summary>
/// 上传按钮点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnBtnAddClick(object sender, EventArgs e)
{
try
{
string resultStr = string.Empty;
OpenFileDialog dialog = new OpenFileDialog();
dialog.Multiselect = true;//该值确定是否可以选择多个文件
dialog.Title = "请选择文件";
string filter = SqlHelper.ExecuteScalar(@"select 合并字段=stuff((select '|'+Mix_apellation+'(*'+bases1 +')'+'|*'+bases1 from P_BaseMixInfoTab b where Tag=a.Tag for xml path('')),1,1,'')
from P_BaseMixInfoTab a
where Tag='70700201'
group by Tag
") + "";
dialog.Filter = string.IsNullOrWhiteSpace(filter) ? "所有文件(*.*)|*.*" : filter;
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
WaitForm.ShowForm("文件上传中...");
foreach (string fileName in dialog.FileNames)
{
string outMsg = "";
bool isUpload = false;
if (filter.ToLower().Contains(Path.GetExtension(fileName).ToLower()))
{
isUpload = UploadFile(fileName, out outMsg);
}
else
{
outMsg = "该文件类型不允许上传";
}
if (!isUpload)
{
resultStr += string.Format("文件{0}上传失败,原因:{1}\r\n", Path.GetFileName(fileName), outMsg);
}
}
if (!string.IsNullOrEmpty(resultStr))
{
MessageUtil.Show(resultStr);
}
WaitForm.HideForm();
}
}
catch (Exception)
{
}
finally
{
RefushWaitDetail();
}
}
/// <summary>
/// 删除操作页签附件数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnBtnDelClick(object sender, EventArgs e)
{
try
{
DataTable dataTable = gc_Main.gridControl.DataSource as DataTable;
int[] rowNumbers = gc_Main.GridView.GetSelectedRows();
string resultStr = string.Empty;
foreach (int rowIndex in rowNumbers)
{
DataRow rowItem = gc_Main.GridView.GetDataRow(rowIndex);
bool isDelete = false;
isDelete = DeleteFile(rowIndex);
if (!isDelete)
{
gc_Main.GridView.UnselectRow(rowIndex);
resultStr += string.Format("文件{0}删除失败\r\n", rowItem["name"]);
}
}
if (!string.IsNullOrEmpty(resultStr))
{
MessageUtil.Show(resultStr);
}
gc_Main.GridView.DeleteSelectedRows();
gc_Main.GridView.SelectRow(dataTable.Rows.Count - 1);
gc_Main.GridView.FocusedRowHandle = dataTable.Rows.Count - 1;
}
catch (Exception)
{
}
finally
{
RefushWaitDetail();
}
}
/// <summary>
/// 刷新等待区
/// </summary>
public void RefushWaitDetail()
{
try
{
if (MainViewModel.LeftTabControl.TabControlObj.SelectedTabPage != null && MainViewModel.RightTabControl.TabControlObj.SelectedTabPage != null)
{
ModuleGridDetail moduleGridDetail = MainViewModel.LeftTabControl.TabControlObj.SelectedTabPage.Controls[0] as ModuleGridDetail;
DataRow rowItem = moduleGridDetail.TopGridEx.GetViewFocusedDataRow();
if (rowItem != null && this.MainGridEx.Tag != null && this.MainGridEx.Tag is GridDetailModel)
{
GridDetailModel gridDetailModel = this.MainGridEx.Tag as GridDetailModel;
string sqlValue = this.GetSearchSql(gridDetailModel, rowItem);
DataTable dataTable = MainImpl.GetDataTableResult(sqlValue);
this.MainGridEx.SetGridViewDataSource(dataTable);
this.MainGridEx.LastSearchSql = sqlValue;
}
}
}
catch (Exception ex)
{
MessageUtil.Show(ex.Message);
}
}
/// <summary>
/// 获取查询条件
/// </summary>
/// <param name="model"></param>
/// <param name="rowItem"></param>
/// <returns></returns>
private string GetSearchSql(GridDetailModel model, DataRow rowItem)
{
string fieldName = !string.IsNullOrEmpty(model.UnionParentField) && rowItem.Table.Columns.Contains(model.UnionParentField) ? model.UnionParentField : MainViewModel.MoudleMainObj.ParmaryKey;
string sqlValue = model.IsReadOnly || model.IsChart ? model.DetailSql : model.SystemModel.MenuSql;
sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue);
if (ReplaceHelper.IsSelect(sqlValue) && !string.IsNullOrEmpty(model.UnionValue))
{
sqlValue = ReplaceHelper.ReplaceWhereCond(sqlValue) + string.Format(" and {0}='{1}'", model.UnionValue, rowItem[fieldName] + "");
}
if (!string.IsNullOrEmpty(model.UnionCond))
{
string UnionCond = ReplaceHelper.ReplaceRowParam(rowItem, model.UnionCond);
sqlValue += UnionCond;
}
return sqlValue;
}
/// <summary>
/// 上传文件
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
private bool UploadFile(string filePath, out string msg)
{
bool isUpload = false;
string File = filePath;
string returnMsg = "";
string postUrl = "";
try
{
//获取文件信息
System.IO.FileInfo fileInfo = new FileInfo(File);
string suffix = Path.GetExtension(File);
//获取Excel等文件信息
string fileAuthor = "";
string fileType = "";
try
{
var file = ShellFile.FromFilePath(File);
string[] oldAuthors = file.Properties.System.Author.Value;//作者
if (oldAuthors != null && oldAuthors.Length > 0)
{
fileAuthor = string.Join(",", oldAuthors);
}
else
{
fileAuthor = "";
}
fileType = file.Properties.System.ItemTypeText.Value + "";
}
catch (Exception)
{
fileType = Path.GetExtension(File).TrimStart(',');
}
string name = fileInfo.Name;
DateTime creationTime = fileInfo.CreationTime;
string fileSize = BytesToReadableValue(fileInfo.Length);
byte[] fileBytes = ConvertFileToBytes(File);
string fileStream = Convert.ToBase64String(fileBytes);
string userId = ERPInfo.Instance.UserId;
DateTime uploadTime = DateTime.Now;
//上传文件到服务器目录
postUrl = "{0}Api/FileUploadApi.ashx?moduleId={1}&idValue={2}&folder={3}&totsize={4}&position={5}&filename={6}&method={7}";
if (!string.IsNullOrEmpty(leftTopGridIdValue))
{
postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, this.MainViewModel.SysModel.ModuleCode, leftTopGridIdValue, "UploadFilesTemp", fileBytes.Length, 0, name, "DoWebUpload");
HttpTools.setting("application/x-www-form-urlencoded", null, null);
string result = "";
CookieCollection cookieCollection = null;
HttpWebResponse webResponse = HttpTools.Post(postUrl, fileStream, null, HttpTools.Method.POST, out cookieCollection, out result);
if (webResponse != null && !string.IsNullOrEmpty(result))
{
JObject jsonObject = (JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(result);
string isSuccess = jsonObject["success"] + "";
if (isSuccess.Equals("True", StringComparison.CurrentCultureIgnoreCase))
{
string fileId = jsonObject["other"] + "";
string webpath = jsonObject["data"]["WebRelPath"] + "";
string searchSql = @"update P_fm_FileTab set author='{2}',CreationTime='{3}' ,Uploader='{4}',UploaderId='{5}' ,UploadTime='{6}' ,Pid='{1}'
where dllcoid = '{0}' and fileId='{7}' ";
searchSql = string.Format(searchSql, this.MainViewModel.SysModel.ModuleCode, this.leftTopGridIdValue, fileAuthor, fileInfo.CreationTime, ERPInfo.Instance.UserName, ERPInfo.Instance.UserId, uploadTime, fileId);
SqlHelper.ExecuteNonQuery(searchSql);
isUpload = true;
}
else
{
if (jsonObject.ContainsKey("msg"))
{
returnMsg = jsonObject["msg"] + "";
}
isUpload = false;
}
}
else
{
returnMsg = "上传请求失败";
isUpload = false;
}
}
else
{
returnMsg = "上传节点值不能为空";
isUpload = false;
}
}
catch (Exception ex)
{
returnMsg = ex.Message;
isUpload = false;
}
msg = returnMsg;
return isUpload;
}
/// <summary>
/// 删除文件
/// </summary>
/// <param name="rowIndex"></param>
/// <returns></returns>
private bool DeleteFile(int rowIndex)
{
DataRow rowItem = gc_Main.GridView.GetDataRow(rowIndex);
bool isDelete = false;
try
{
//删除文件
//string postUrl = "{0}Api/FileUploadApi.ashx?moduleId={1}&idValue={2}&folder={3}&filename={4}&method={5}";
string postUrl = "{0}Api/FileUploadApi.ashx?fileId={1}&filename={2}&method={3}";
//postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, this.Model.ModuleCode, "", "UploadFilesTemp", rowItem["name"], "DoDelete");
postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, rowItem["fileId"], rowItem["webpath"], "DoDelete");
HttpTools.setting("application/x-www-form-urlencoded", null, null);
string result = "";
CookieCollection cookieCollection = null;
HttpWebResponse webResponse = HttpTools.Post(postUrl, "", null, HttpTools.Method.POST, out cookieCollection, out result);
if (webResponse != null && !string.IsNullOrEmpty(result))
{
JObject jsonObject = (JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(result);
string isSuccess = jsonObject["success"] + "";
if (isSuccess.Equals("True", StringComparison.CurrentCultureIgnoreCase))
{
isDelete = true;
}
else
{
isDelete = false;
}
}
else
{
isDelete = false;
}
}
catch (Exception)
{
isDelete = false;
}
return isDelete;
}
/// <summary>
/// 获取文件大小的显示字符串
/// </summary>
/// <param name="number"></param>
/// <returns></returns>
public static string BytesToReadableValue(double number)
{
double last = 1;
for (int i = 0; i < suffixes.Length; i++)
{
var current = Math.Pow(1024, i + 1);
var temp = number / current;
if (temp < 1)
{
return (number / last).ToString("n2") + suffixes[i];
}
last = current;
}
return number.ToString();
}
/// <summary>
/// 附件转换byte[]
/// </summary>
/// <param name="filePath">附件路径</param>
/// <returns>二进制</returns>
private byte[] ConvertFileToBytes(string filePath)
{
byte[] bytContent = null;
System.IO.FileStream fs = null;
System.IO.BinaryReader br = null;
try
{
fs = new FileStream(filePath, System.IO.FileMode.Open);
}
catch (Exception)
{
throw;
}
finally
{
if (fs != null)
br = new BinaryReader((Stream)fs);
if (br != null)
bytContent = br.ReadBytes((Int32)fs.Length);
if (fs != null)
fs.Dispose();
}
return bytContent;
}
/// <summary>
/// 右键菜单回调
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnRightMenuCallBack(object sender, EventArgs e)
{
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,165 @@
namespace Lskj.PubArtworkDynamic.Control
{
partial class ModuleGridDetail
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.splitMainControl = new DevExpress.XtraEditors.SplitContainerControl();
this.pl_top_cond = new DevExpress.XtraEditors.PanelControl();
this.plm_top_btnFixSearch = new DevExpress.XtraEditors.SimpleButton();
this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
this.plm_top_cbField = new System.Windows.Forms.ComboBox();
this.plm_top_txtFixKey = new System.Windows.Forms.TextBox();
this.gc_Top = new Lskj.Control.GridControlEx();
this.gc_Bottom = new Lskj.Control.GridControlEx();
((System.ComponentModel.ISupportInitialize)(this.splitMainControl)).BeginInit();
this.splitMainControl.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_top_cond)).BeginInit();
this.pl_top_cond.SuspendLayout();
this.SuspendLayout();
//
// splitMainControl
//
this.splitMainControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitMainControl.Horizontal = false;
this.splitMainControl.Location = new System.Drawing.Point(0, 0);
this.splitMainControl.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.splitMainControl.Name = "splitMainControl";
this.splitMainControl.Panel1.Controls.Add(this.gc_Top);
this.splitMainControl.Panel1.Controls.Add(this.pl_top_cond);
this.splitMainControl.Panel1.Text = "Panel1";
this.splitMainControl.Panel2.Controls.Add(this.gc_Bottom);
this.splitMainControl.Panel2.Text = "Panel2";
this.splitMainControl.Size = new System.Drawing.Size(457, 562);
this.splitMainControl.SplitterPosition = 355;
this.splitMainControl.TabIndex = 5;
this.splitMainControl.Text = "splitContainerControl3";
//
// pl_top_cond
//
this.pl_top_cond.Controls.Add(this.plm_top_btnFixSearch);
this.pl_top_cond.Controls.Add(this.labelControl3);
this.pl_top_cond.Controls.Add(this.plm_top_cbField);
this.pl_top_cond.Controls.Add(this.plm_top_txtFixKey);
this.pl_top_cond.Dock = System.Windows.Forms.DockStyle.Top;
this.pl_top_cond.Location = new System.Drawing.Point(0, 0);
this.pl_top_cond.Margin = new System.Windows.Forms.Padding(4);
this.pl_top_cond.Name = "pl_top_cond";
this.pl_top_cond.Size = new System.Drawing.Size(457, 40);
this.pl_top_cond.TabIndex = 18;
//
// plm_top_btnFixSearch
//
this.plm_top_btnFixSearch.Appearance.Font = new System.Drawing.Font("宋体", 9F);
this.plm_top_btnFixSearch.Appearance.Options.UseFont = true;
this.plm_top_btnFixSearch.Location = new System.Drawing.Point(356, 6);
this.plm_top_btnFixSearch.Margin = new System.Windows.Forms.Padding(4);
this.plm_top_btnFixSearch.Name = "plm_top_btnFixSearch";
this.plm_top_btnFixSearch.Size = new System.Drawing.Size(72, 26);
this.plm_top_btnFixSearch.TabIndex = 40;
this.plm_top_btnFixSearch.Text = "查询(&Q)";
//
// labelControl3
//
this.labelControl3.Appearance.Font = new System.Drawing.Font("宋体", 9F);
this.labelControl3.Location = new System.Drawing.Point(3, 11);
this.labelControl3.Margin = new System.Windows.Forms.Padding(4);
this.labelControl3.Name = "labelControl3";
this.labelControl3.Size = new System.Drawing.Size(30, 15);
this.labelControl3.TabIndex = 39;
this.labelControl3.Text = "查询";
//
// plm_top_cbField
//
this.plm_top_cbField.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.plm_top_cbField.FormattingEnabled = true;
this.plm_top_cbField.Location = new System.Drawing.Point(40, 5);
this.plm_top_cbField.Margin = new System.Windows.Forms.Padding(4);
this.plm_top_cbField.Name = "plm_top_cbField";
this.plm_top_cbField.Size = new System.Drawing.Size(121, 26);
this.plm_top_cbField.TabIndex = 37;
this.plm_top_cbField.Tag = "";
//
// plm_top_txtFixKey
//
this.plm_top_txtFixKey.Location = new System.Drawing.Point(171, 5);
this.plm_top_txtFixKey.Margin = new System.Windows.Forms.Padding(4);
this.plm_top_txtFixKey.Name = "plm_top_txtFixKey";
this.plm_top_txtFixKey.Size = new System.Drawing.Size(176, 26);
this.plm_top_txtFixKey.TabIndex = 38;
//
// gc_Top
//
this.gc_Top.AdapterObj = null;
this.gc_Top.AllowDrop = true;
this.gc_Top.Dock = System.Windows.Forms.DockStyle.Fill;
this.gc_Top.Location = new System.Drawing.Point(0, 40);
this.gc_Top.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.gc_Top.Name = "gc_Top";
this.gc_Top.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gc_Top.Size = new System.Drawing.Size(457, 315);
this.gc_Top.TabIndex = 20;
//
// gc_Bottom
//
this.gc_Bottom.AdapterObj = null;
this.gc_Bottom.Dock = System.Windows.Forms.DockStyle.Fill;
this.gc_Bottom.Location = new System.Drawing.Point(0, 0);
this.gc_Bottom.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.gc_Bottom.Name = "gc_Bottom";
this.gc_Bottom.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gc_Bottom.Size = new System.Drawing.Size(457, 201);
this.gc_Bottom.TabIndex = 17;
//
// GridDetailControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.splitMainControl);
this.Name = "GridDetailControl";
this.Size = new System.Drawing.Size(457, 562);
((System.ComponentModel.ISupportInitialize)(this.splitMainControl)).EndInit();
this.splitMainControl.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_top_cond)).EndInit();
this.pl_top_cond.ResumeLayout(false);
this.pl_top_cond.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private DevExpress.XtraEditors.SplitContainerControl splitMainControl;
private Lskj.Control.GridControlEx gc_Top;
private DevExpress.XtraEditors.PanelControl pl_top_cond;
private DevExpress.XtraEditors.SimpleButton plm_top_btnFixSearch;
private DevExpress.XtraEditors.LabelControl labelControl3;
private System.Windows.Forms.ComboBox plm_top_cbField;
private System.Windows.Forms.TextBox plm_top_txtFixKey;
private Lskj.Control.GridControlEx gc_Bottom;
}
}
@@ -0,0 +1,463 @@
using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Views.Base;
using DevExpress.XtraGrid.Views.Grid;
using Lskj.Business.Impl;
using Lskj.Control;
using Lskj.Control.Model;
using Lskj.Model;
using Lskj.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Lskj.PubArtworkDynamic.Control
{
public partial class ModuleGridDetail : UserControl
{
/// <summary>
/// 模块类
/// </summary>
public ViewModel MainViewModel;
/// <summary>
/// 搜索按钮
/// </summary>
public SimpleButton SearchButton
{
get
{
if (this.SearchMainObj.ButtonObj != null)
{
return this.SearchMainObj.ButtonObj;
}
else
{
return this.plm_top_btnFixSearch;
}
}
}
/// <summary>
/// 主模块的表格
/// </summary>
public GridControlEx MainGridEx
{
get
{
if (gc_Top.ContainsFocus)
{
return gc_Top;
}
else
{
return gc_Bottom;
}
}
}
/// <summary>
/// 上方表格控件
/// </summary>
public GridControlEx TopGridEx { get { return gc_Top; } }
/// <summary>
/// 下方表格控件
/// </summary>
public GridControlEx BottomGridEx { get { return gc_Bottom; } }
/// <summary>
/// 明细Model
/// </summary>
public GridDetailModel DetailModel;
/// <summary>
/// 主条件控件
/// </summary>
public MyControl SearchMainObj;
/// <summary>
/// 明细条件控件
/// </summary>
public MyControl SearchDetailObj;
/// <summary>
/// 条件参数
/// </summary>
public string[] OtherParams;
/// <summary>
/// 拖拽方向(1只能拖拽到主表,2只能拖拽到明细。默认0都可以拖)
/// </summary>
public int DragDirection;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="model"></param>
public ModuleGridDetail(GridDetailModel model)
{
DetailModel = model;
InitializeComponent();
Load += OnModuleGridDetailLoad;
}
public ModuleGridDetail(GridDetailModel model, string[] otherParams)
{
DetailModel = model;
this.OtherParams = otherParams;
InitializeComponent();
Load += OnModuleGridDetailLoad;
}
/// <summary>
/// 加载完成后
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnModuleGridDetailLoad(object sender, EventArgs e)
{
try
{
gc_Top.GridView.OptionsSelection.MultiSelect = false;
gc_Top.GridView.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.RowSelect;
gc_Bottom.GridView.OptionsSelection.MultiSelect = false;
gc_Bottom.GridView.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.RowSelect;
gc_Top.GridView.RowClick += OnGridViewRowClick;
gc_Bottom.GridView.RowClick += OnGridViewRowClick;
//gc_Bottom.GridView.FocusedRowObjectChanged += OnGridViewFocusedRowObjectChanged;
if (DetailModel != null)
{
this.DragDirection = DetailModel.SystemModel.DragDirection;
if (DetailModel.IsReadOnly)
{
this.SearchMainObj = new MyControl(DetailModel.DetailSql, gc_Top);//构建主表mycontrol
}
else
{
this.SearchMainObj = new MyControl(DetailModel.SystemModel.MenuSql, gc_Top);//构建主表mycontrol
}
this.SearchMainObj.OtherParams = this.OtherParams;
this.SearchMainObj.OnSearchAfterCallBack += OnSearchAfterCallBack;//搜索完成后
DataTable gridColumns = new DataTable();
if (!string.IsNullOrEmpty(DetailModel.UnionModule))
{
gridColumns = BaseModuleImpl.GetBaseGridColumns(DetailModel.UnionModule);
}
else
{
gridColumns = ReportImpl.GetReportDetailColumns(MainViewModel.SysModel.ModuleCode, DetailModel.Id + "");
}
gc_Top.GridView.OptionsBehavior.Editable = false;
gc_Top.SetReadOnlyColumns(gridColumns, GridCustomColumnStruct.BaseMainGridView + DetailModel.FormKey);//明细
DynamicModel dyncModel = new DynamicModuleModel(new string[] { DetailModel.DetailName, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, MainViewModel.SysModel.Privilege, DetailModel.UnionModule, "0" });
if (!string.IsNullOrEmpty(DetailModel.SystemModel.ModeCode))
{
gc_Top.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(DetailModel.SystemModel.ModeCode), dyncModel, OnRightMenuCallBack, this.SearchMainObj);
}
else if (!string.IsNullOrEmpty(DetailModel.FormKey))
{
gc_Top.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(DetailModel.FormKey), dyncModel, OnRightMenuCallBack, this.SearchMainObj);
}
DataTable queryTable = BaseModuleImpl.GetCustomQueryFields(DetailModel.SystemModel.CondKey);//获取主模块构建的条件
if (queryTable != null && queryTable.Rows.Count > 0)
{
// 加载自定义查询条件
this.pl_top_cond.Controls.Clear();
this.SearchMainObj.InitSearchControl(queryTable, this.pl_top_cond, null, null, DetailModel.SystemModel.ConditionRefresh);
}
else
{
// 加载固定查询条件
DataTable table = BaseModuleImpl.GetFixedQueryFields(DetailModel.SystemModel.ModeCode);//加载固定查询条件
this.plm_top_cbField.DisplayMember = "fieldText";
this.plm_top_cbField.ValueMember = "fieldName";
this.plm_top_cbField.DataSource = table;
this.SearchMainObj.InitDefaultSearchControl(table, this.pl_top_cond, this.plm_top_cbField.Name, this.plm_top_txtFixKey.Name, this.plm_top_btnFixSearch.Name);
}
//加载明细表格
DataTable moduleDetailTable = BaseModuleImpl.GetBaseDetailPages(DetailModel.UnionModule);//获取关联模块配置明细
DataRow detailRow = moduleDetailTable.Rows.Cast<DataRow>().Where(n => (n["orderId"] + "").Equals("99")).FirstOrDefault();
if (detailRow != null)
{
GridDetailModel bottomDetailModel = new GridDetailModel(detailRow);
bottomDetailModel.SystemModel = new ModuleModel(MainImpl.GetSystemdllTab(bottomDetailModel.UnionModule));//获取主模块构建类
gc_Bottom.Tag = bottomDetailModel;
if (bottomDetailModel.IsReadOnly)
{
this.SearchDetailObj = new MyControl(bottomDetailModel.DetailSql, gc_Bottom);//构建明细表mycontrol
}
else
{
this.SearchDetailObj = new MyControl(bottomDetailModel.SystemModel.MenuSql, gc_Bottom);//构建明细表mycontrol
}
DataTable bottomDetailColumns = new DataTable();
if (!string.IsNullOrEmpty(bottomDetailModel.UnionModule))
{
bottomDetailColumns = BaseModuleImpl.GetBaseGridColumns(bottomDetailModel.UnionModule);
}
else
{
bottomDetailColumns = ReportImpl.GetReportDetailColumns(MainViewModel.SysModel.ModuleCode, bottomDetailModel.Id + "");
}
gc_Bottom.GridView.OptionsBehavior.Editable = false;
gc_Bottom.SetReadOnlyColumns(bottomDetailColumns, GridCustomColumnStruct.BaseMainGridView + bottomDetailModel.FormKey);//明细
DynamicModel dyncBottomDetailModel = new DynamicModuleModel(new string[] { bottomDetailModel.DetailName, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, MainViewModel.SysModel.Privilege, bottomDetailModel.UnionModule, "0" });
if (!string.IsNullOrEmpty(bottomDetailModel.SystemModel.ModeCode))
{
gc_Bottom.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(bottomDetailModel.SystemModel.ModeCode), dyncBottomDetailModel, OnRightMenuCallBack, SearchDetailObj);
}
else if (!string.IsNullOrEmpty(bottomDetailModel.FormKey))
{
gc_Bottom.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(bottomDetailModel.FormKey), dyncBottomDetailModel, OnRightMenuCallBack, SearchDetailObj);
}
}
else
{
splitMainControl.PanelVisibility = DevExpress.XtraEditors.SplitPanelVisibility.Panel1;
}
}
else
{
ModuleModel MainModuleModel = new ModuleModel(MainImpl.GetSystemdllTab(MainViewModel.SysModel.ModuleCode));//获取主模块构建类
this.DragDirection = MainModuleModel.DragDirection;
this.SearchMainObj = new MyControl(MainModuleModel.MenuSql, gc_Top);//构建主表mycontrol
this.SearchMainObj.OtherParams = this.OtherParams;
this.SearchMainObj.OnSearchAfterCallBack += OnSearchAfterCallBack;//搜索完成后
DataTable gridColumns = BaseModuleImpl.GetBaseGridColumns(MainModuleModel.ModeCode);
gc_Top.GridView.OptionsBehavior.Editable = false;
gc_Top.SetReadOnlyColumns(gridColumns, GridCustomColumnStruct.BaseMainGridView + MainModuleModel.FormKey);//明细
DynamicModel dyncModel = new DynamicModuleModel(new string[] { MainModuleModel.MenuName, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, MainViewModel.SysModel.Privilege, MainModuleModel.ModeCode, "0" });
if (!string.IsNullOrEmpty(MainModuleModel.ModeCode))
{
gc_Top.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(MainModuleModel.ModeCode), dyncModel, OnRightMenuCallBack, this.SearchMainObj);
}
else if (!string.IsNullOrEmpty(MainModuleModel.FormKey))
{
gc_Top.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(MainModuleModel.FormKey), dyncModel, OnRightMenuCallBack, this.SearchMainObj);
}
DataTable queryTable = BaseModuleImpl.GetCustomQueryFields(MainModuleModel.CondKey);//获取主模块构建的条件
if (queryTable != null && queryTable.Rows.Count > 0)
{
// 加载自定义查询条件
this.pl_top_cond.Controls.Clear();
this.SearchMainObj.InitSearchControl(queryTable, this.pl_top_cond, null, null, MainModuleModel.ConditionRefresh);
}
else
{
// 加载固定查询条件
DataTable table = BaseModuleImpl.GetFixedQueryFields(DetailModel.SystemModel.ModeCode);//加载固定查询条件
this.plm_top_cbField.DisplayMember = "fieldText";
this.plm_top_cbField.ValueMember = "fieldName";
this.plm_top_cbField.DataSource = table;
this.SearchMainObj.InitDefaultSearchControl(table, this.pl_top_cond, this.plm_top_cbField.Name, this.plm_top_txtFixKey.Name, this.plm_top_btnFixSearch.Name);
}
//加载明细表格
DataTable moduleDetailTable = BaseModuleImpl.GetBaseDetailPages(MainModuleModel.ModeCode);//获取关联模块配置明细
DataRow detailRow = moduleDetailTable.Rows.Cast<DataRow>().Where(n => (n["orderId"] + "").Equals("99")).FirstOrDefault();
if (detailRow != null)
{
GridDetailModel bottomDetailModel = new GridDetailModel(detailRow);
bottomDetailModel.SystemModel = new ModuleModel(MainImpl.GetSystemdllTab(bottomDetailModel.UnionModule));//获取主模块构建类
gc_Bottom.Tag = bottomDetailModel;
if (bottomDetailModel.IsReadOnly)
{
this.SearchDetailObj = new MyControl(bottomDetailModel.DetailSql, gc_Bottom);//构建明细表mycontrol
}
else
{
this.SearchDetailObj = new MyControl(bottomDetailModel.SystemModel.MenuSql, gc_Bottom);//构建明细表mycontrol
}
DataTable bottomDetailColumns = new DataTable();
if (!string.IsNullOrEmpty(bottomDetailModel.UnionModule))
{
bottomDetailColumns = BaseModuleImpl.GetBaseGridColumns(bottomDetailModel.UnionModule);
}
else
{
bottomDetailColumns = ReportImpl.GetReportDetailColumns(MainViewModel.SysModel.ModuleCode, bottomDetailModel.Id + "");
}
gc_Bottom.GridView.OptionsBehavior.Editable = false;
gc_Bottom.SetReadOnlyColumns(bottomDetailColumns, GridCustomColumnStruct.BaseMainGridView + bottomDetailModel.FormKey);//明细
DynamicModel dyncBottomDetailModel = new DynamicModuleModel(new string[] { bottomDetailModel.DetailName, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, MainViewModel.SysModel.Privilege, bottomDetailModel.UnionModule, "0" });
if (!string.IsNullOrEmpty(bottomDetailModel.SystemModel.ModeCode))
{
gc_Bottom.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(bottomDetailModel.SystemModel.ModeCode), dyncBottomDetailModel, OnRightMenuCallBack, SearchDetailObj);
}
else if (!string.IsNullOrEmpty(bottomDetailModel.FormKey))
{
gc_Bottom.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(bottomDetailModel.FormKey), dyncBottomDetailModel, OnRightMenuCallBack, SearchDetailObj);
}
}
else
{
splitMainControl.PanelVisibility = DevExpress.XtraEditors.SplitPanelVisibility.Panel1;
}
}
}
catch (Exception ex)
{
MessageUtil.Show(ex.Message);
}
}
/// <summary>
/// 右键菜单回调
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnRightMenuCallBack(object sender, EventArgs e)
{
try
{
SearchMainObj.SearchGrid();
RefushLeftDetail();
RefushBottomLeftDetail();
}
catch (Exception ex)
{
MessageUtil.Show(ex.Message);
}
}
/// <summary>
/// 搜索完成后
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnSearchAfterCallBack(object sender, EventArgs e)
{
try
{
RefushWaitDetail();
RefushLeftDetail();
RefushBottomLeftDetail();
}
catch (Exception ex)
{
MessageUtil.Show(ex.Message);
}
}
/// <summary>
/// 行选中改变时刷新明细
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void OnGridViewRowClick(object sender, RowClickEventArgs e)
{
GridView gridView = (GridView)sender;
if (gridView == gc_Top.GridView)
{
RefushLeftDetail();
}
RefushWaitDetail();
RefushBottomLeftDetail();
}
/// <summary>
/// 刷新左边选中的明细信息
/// </summary>
public void RefushLeftDetail()
{
try
{
if (MainViewModel.LeftTabControl.TabControlObj.SelectedTabPage != null)
{
ModuleGridDetail moduleGridDetail = MainViewModel.LeftTabControl.TabControlObj.SelectedTabPage.Controls[0] as ModuleGridDetail;
DataRow rowItem = moduleGridDetail.TopGridEx.GetViewFocusedDataRow();
if (rowItem != null && moduleGridDetail.BottomGridEx.Tag != null && moduleGridDetail.BottomGridEx.Tag is GridDetailModel)
{
GridDetailModel leftDetailModel = moduleGridDetail.BottomGridEx.Tag as GridDetailModel;
string sqlValue = this.GetSearchSql(leftDetailModel, rowItem);
DataTable dataTable = MainImpl.GetDataTableResult(sqlValue);
moduleGridDetail.BottomGridEx.SetGridViewDataSource(dataTable);
moduleGridDetail.BottomGridEx.LastSearchSql = sqlValue;
}
}
}
catch (Exception ex)
{
MessageUtil.Show(ex.Message);
}
}
/// <summary>
/// 刷新左边选中的底部明细信息
/// </summary>
public void RefushBottomLeftDetail()
{
try
{
if (MainViewModel.LeftTabControl.TabControlObj.SelectedTabPage != null)
{
ModuleGridDetail moduleGridDetail = MainViewModel.LeftTabControl.TabControlObj.SelectedTabPage.Controls[0] as ModuleGridDetail;
DataRow rowItem = null;
if (moduleGridDetail.BottomGridEx.Visible == true)
{
rowItem = moduleGridDetail.BottomGridEx.GetViewFocusedDataRow();
}
if (rowItem == null || moduleGridDetail.BottomGridEx.Visible == false)
{
rowItem = moduleGridDetail.TopGridEx.GetViewFocusedDataRow();
}
if (rowItem != null && MainViewModel.BottomLeftGridEx.Tag != null && MainViewModel.BottomLeftGridEx.Tag is GridDetailModel)
{
GridDetailModel bottomLeftDetailModel = MainViewModel.BottomLeftGridEx.Tag as GridDetailModel;
string sqlValue = this.GetSearchSql(bottomLeftDetailModel, rowItem);
DataTable dataTable = MainImpl.GetDataTableResult(sqlValue);
MainViewModel.BottomLeftGridEx.SetGridViewDataSource(dataTable);
MainViewModel.BottomLeftGridEx.LastSearchSql = sqlValue;
}
}
}
catch (Exception ex)
{
MessageUtil.Show(ex.Message);
}
}
/// <summary>
/// 刷新等待区
/// </summary>
public void RefushWaitDetail()
{
try
{
if (MainViewModel.LeftTabControl.TabControlObj.SelectedTabPage != null && MainViewModel.RightTabControl.TabControlObj.SelectedTabPage != null)
{
ModuleGridDetail moduleGridDetail = MainViewModel.LeftTabControl.TabControlObj.SelectedTabPage.Controls[0] as ModuleGridDetail;
ModuleGrid moduleGrid = MainViewModel.RightTabControl.TabControlObj.SelectedTabPage.Controls[0] as ModuleGrid;
DataRow rowItem = moduleGridDetail.TopGridEx.GetViewFocusedDataRow();
if (rowItem != null && moduleGrid.MainGridEx.Tag != null && moduleGrid.MainGridEx.Tag is GridDetailModel)
{
GridDetailModel gridDetailModel = moduleGrid.MainGridEx.Tag as GridDetailModel;
string sqlValue = this.GetSearchSql(gridDetailModel, rowItem);
DataTable dataTable = MainImpl.GetDataTableResult(sqlValue);
moduleGrid.MainGridEx.SetGridViewDataSource(dataTable);
moduleGrid.MainGridEx.LastSearchSql = sqlValue;
}
}
}
catch (Exception ex)
{
MessageUtil.Show(ex.Message);
}
}
/// <summary>
/// 获取查询条件
/// </summary>
/// <param name="model"></param>
/// <param name="rowItem"></param>
/// <returns></returns>
private string GetSearchSql(GridDetailModel model, DataRow rowItem)
{
string fieldName = !string.IsNullOrEmpty(model.UnionParentField) && rowItem.Table.Columns.Contains(model.UnionParentField) ? model.UnionParentField : MainViewModel.MoudleMainObj.ParmaryKey;
string sqlValue = model.IsReadOnly || model.IsChart ? model.DetailSql : model.SystemModel.MenuSql;
sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue);
if (ReplaceHelper.IsSelect(sqlValue) && !string.IsNullOrEmpty(model.UnionValue))
{
sqlValue = ReplaceHelper.ReplaceWhereCond(sqlValue) + string.Format(" and {0}='{1}'", model.UnionValue, rowItem[fieldName] + "");
}
if (!string.IsNullOrEmpty(model.UnionCond))
{
string UnionCond = ReplaceHelper.ReplaceRowParam(rowItem, model.UnionCond);
sqlValue += UnionCond;
}
return sqlValue;
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>