基线 SVN r240
SVN-Revision: r240
This commit is contained in:
@@ -0,0 +1,221 @@
|
||||
/******************************
|
||||
* 说明:标准基础档案
|
||||
* 创建人:龚宇超
|
||||
* 创建日期:2017-08-21
|
||||
* 修改人:
|
||||
* 修改日期:
|
||||
* 修改备注:
|
||||
* 版本:1.0.0.0
|
||||
******************************/
|
||||
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;
|
||||
using Lskj.Control;
|
||||
using Lskj.Control.Model;
|
||||
using Lskj.Util;
|
||||
using Lskj.Data;
|
||||
using Lskj.Model;
|
||||
using Lskj.Business.Impl;
|
||||
using Lskj.Main.Model;
|
||||
using Lskj.Business;
|
||||
using System.Collections;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Lskj.PubModule
|
||||
{
|
||||
public partial class FrmMain : BaseForm
|
||||
{
|
||||
public DynamicModuleModel Model;
|
||||
|
||||
public FrmMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:窗体加载时</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-09-01 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
WaitForm.ShowForm();
|
||||
try
|
||||
{
|
||||
this.Model.Privilege = this.Model.Privilege.Equals("3") ? "1" : Model.ModuleId > 0 ? BaseImpl.GetUserPurviewsByMenuId(Model.ModuleId + "") + "" : BaseImpl.GetUserPurviewsByMenuCode(Model.ModuleCode) + "";
|
||||
|
||||
this.mControl.LeftCond = Model.LeftCond;
|
||||
this.mControl.InitControls(Model);
|
||||
SetFormSize();
|
||||
this.FormClosing += new FormClosingEventHandler(OnClose);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteError(ex, ResourceKeys.BaseModule);
|
||||
//MessageUtil.Show(ex.Message + "\r\n" + ex.StackTrace);
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message,ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(this);
|
||||
this.mControl.Visible = true;
|
||||
}
|
||||
|
||||
WaitForm.HideForm();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取数据源缓存
|
||||
/// </summary>
|
||||
/// <param name="cachesDic"></param>
|
||||
public void GetDataCaches(Dictionary<object, Hashtable> cachesDic)
|
||||
{
|
||||
//全局数据
|
||||
Task<DynamicModel> dynamicModelTask = cachesDic.AddTask(this, "DynamicModel", new Task<DynamicModel>(() =>
|
||||
{
|
||||
return Model;//动态链接库对象
|
||||
}));
|
||||
Task<DataRow> systemDllRowTask = cachesDic.AddTask(this, "SystemDllRow", new Task<DataRow>(() =>
|
||||
{
|
||||
return MainImpl.GetSystemdllTab(Model.ModuleCode);//获取单个模块信息
|
||||
}));
|
||||
Task<ModuleModel> sysModelTask = cachesDic.AddTask(this, "SysModel", new Task<ModuleModel>(() =>
|
||||
{
|
||||
ModuleModel sysModel = new ModuleModel(systemDllRowTask.Result);
|
||||
return sysModel;//系统模块实体对象
|
||||
}));
|
||||
Task<List<GridDetailModel>> detailTask = cachesDic.AddTask(this, "Details", new Task<List<GridDetailModel>>(() =>
|
||||
{
|
||||
DataTable detailPages = BaseModuleImpl.GetBaseDetailPages(Model.ModuleCode);//根据传入的模块编号获得基础档案底部标签的数据
|
||||
List<GridDetailModel> details = new List<GridDetailModel>();//表格明细对象的集合
|
||||
foreach (DataRow item in detailPages.Rows)
|
||||
{
|
||||
GridDetailModel gridDetailModel = new GridDetailModel(item, null, GridCustomColumnStruct.BaseDetailGridView);
|
||||
details.Add(gridDetailModel);
|
||||
Task<DataTable> addGridColumnsTask = cachesDic.AddTask(gridDetailModel, "GridColumns", new Task<DataTable>(() =>
|
||||
{
|
||||
DataTable gridColumns = ReportImpl.GetReportDetailColumns(Model.ModuleCode, item["id"] + "");//获取报表明细列
|
||||
gridDetailModel.GridColumns = gridColumns;
|
||||
return gridColumns;
|
||||
}));
|
||||
}
|
||||
return details;
|
||||
}));
|
||||
Task<int> formTypeTask = cachesDic.AddTask(this, "FormType", new Task<int>(() =>
|
||||
{
|
||||
return BaseImpl.GetBaseType(Model.ModuleCode);
|
||||
}));
|
||||
Task<string> privilegeTask = cachesDic.AddTask(this, "Privilege", new Task<string>(() =>
|
||||
{
|
||||
return Model.Privilege.Equals("3") ? "1" : Model.ModuleId > 0 ? BaseImpl.GetUserPurviewsByMenuId(Model.ModuleId + "") + "" : BaseImpl.GetUserPurviewsByMenuCode(Model.ModuleCode) + "";// 权限(1.有操作权限.0.无权限.2.只读权限.3.右键配置权限全部开放)
|
||||
}));
|
||||
//添加数据到mControl
|
||||
cachesDic.AddTask(mControl, "DynamicModel", dynamicModelTask);
|
||||
cachesDic.AddTask(mControl, "SystemDllRow", systemDllRowTask);
|
||||
cachesDic.AddTask(mControl, "SysModel", sysModelTask);
|
||||
cachesDic.AddTask(mControl, "Details", detailTask);
|
||||
//获取mControl控件的数据
|
||||
mControl.GetDataCaches(cachesDic);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 关闭模块时发生
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnClose(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
string guid = this.Tag + "";
|
||||
if (string.IsNullOrWhiteSpace(guid)) return;
|
||||
DllModule m = Manager.ModuleForms[guid];
|
||||
m.IsClose = true;
|
||||
if (SystemInfo.Instance.EfficientVerification)
|
||||
{
|
||||
bool SaveResults = this.mControl.ModuleGridDetailObj.VerificationInterface();
|
||||
if (!SaveResults)
|
||||
{
|
||||
DialogResult result = MessageUtil.Show(("数据未保存,是否确定关闭?"), MessageBoxButtons.YesNo);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
m.IsClose = true;
|
||||
e.Cancel = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m.IsClose = false;
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#region 设置窗口大小
|
||||
/// <summary>
|
||||
/// <para>说明:设置弹出窗体大小</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-12-15 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
private void SetFormSize()
|
||||
{
|
||||
if (this.FormBorderStyle == FormBorderStyle.Sizable)
|
||||
{
|
||||
string height = Util.IniHelper.Read("ModuleGrid_Height_" + Model.ModuleCode);
|
||||
string width = Util.IniHelper.Read("ModuleGrid_Width_" + Model.ModuleCode);
|
||||
this.Height = string.IsNullOrEmpty(height) ? this.Height : Convert.ToInt32(height);
|
||||
this.Width = string.IsNullOrEmpty(width) ? this.Width : Convert.ToInt32(width);
|
||||
this.Width = this.Width > Screen.PrimaryScreen.WorkingArea.Width ? Screen.PrimaryScreen.WorkingArea.Width : this.Width;
|
||||
this.Height = this.Height > Screen.PrimaryScreen.WorkingArea.Height ? Screen.PrimaryScreen.WorkingArea.Height : this.Height;
|
||||
this.Left = (Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2;
|
||||
this.Top = (Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 2;
|
||||
this.Resize += new EventHandler(FrmMain_Resize);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:弹窗发生改变的时候</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
/// <para>创建日期:2020-11-25 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
public void FrmMain_Resize(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
IniHelper.Write("ModuleGrid_Height_" + Model.ModuleCode, this.Height + "");
|
||||
IniHelper.Write("ModuleGrid_Width_" + Model.ModuleCode, this.Width + "");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message,ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user