107 lines
3.5 KiB
C#
107 lines
3.5 KiB
C#
using Lskj.Business;
|
|
using Lskj.Model;
|
|
using Lskj.Util;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Data;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Lskj.PubGetChipInfo
|
|
{
|
|
/// <summary>
|
|
/// c#库被调用统一接口类
|
|
/// </summary>
|
|
public sealed class DllBaseClass : IForm
|
|
{
|
|
public DllBaseClass()
|
|
{
|
|
|
|
}
|
|
|
|
public DllBaseClass(string[] obj)
|
|
{
|
|
try
|
|
{
|
|
DynamicGetChipInfoModel getChipInfoModel = new DynamicGetChipInfoModel(obj);
|
|
FrmMain main = new FrmMain();
|
|
this.SubForm = main;
|
|
main.GetChipInfoModel = getChipInfoModel;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogUtil.WriteError("Lskj.PubGetChipInfo.dll--参数错误-->" + obj.ToString(), ex);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 窗口
|
|
/// </summary>
|
|
public Form SubForm { get; set; }
|
|
/// <summary>
|
|
/// 入口模型
|
|
/// </summary>
|
|
public class DynamicGetChipInfoModel : DynamicModel
|
|
{
|
|
/// <summary>
|
|
/// 芯片类型,1:PRM芯片,2:授权芯片
|
|
/// </summary>
|
|
public string ChipType;
|
|
/// <summary>
|
|
/// 处理sql
|
|
/// </summary>
|
|
public string AfterSql;
|
|
public override string[] OtherParams()
|
|
{
|
|
return this.Params;
|
|
}
|
|
/// <summary>
|
|
/// 初始化默认参数(1.标题、2、用户ID、3.用户名、4.权限、5.模块编号、6.菜单ID)
|
|
/// </summary>
|
|
/// <param name="args">The arguments.</param>
|
|
public DynamicGetChipInfoModel(string[] args)
|
|
: base(args)
|
|
{
|
|
// 右键菜单打开的模块没有moduleId,部分特殊模块没有moduleId比如添加界面.
|
|
if (!string.IsNullOrEmpty(args[5]))
|
|
{
|
|
base.ModuleId = Convert.ToInt32(args[5]);
|
|
}
|
|
if (args.Length > 6 && !string.IsNullOrWhiteSpace(args[6]))
|
|
{
|
|
base.ModuleCode = args[6];
|
|
}
|
|
if (args.Length > 7 && !string.IsNullOrWhiteSpace(args[7]))
|
|
{
|
|
this.ChipType = args[7];
|
|
}
|
|
if (args.Length > 8 && !string.IsNullOrWhiteSpace(args[8]))
|
|
{
|
|
this.AfterSql = args[8];
|
|
}
|
|
if (args.Length > 10)
|
|
{
|
|
this.Params = new string[args.Length];
|
|
for (int i = 10; i < args.Length; i++)
|
|
{
|
|
Params[i - 10] = args[i];
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(args[args.Length - 1]))
|
|
{
|
|
try
|
|
{
|
|
JObject rowObject = JsonConvert.DeserializeObject<JObject>(args[args.Length - 1]);
|
|
JArray jArray = new JArray();
|
|
jArray.Add(rowObject);
|
|
DataTable dataTable = JsonConvert.DeserializeObject<DataTable>(JsonConvert.SerializeObject(jArray));
|
|
this.MaintabFocusedRow = dataTable.Rows[0];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|