You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
3.2 KiB
C#
94 lines
3.2 KiB
C#
using System;
|
|
using BP.DA;
|
|
using BP.En;
|
|
using BP.Sys;
|
|
namespace BP.WF.DTS
|
|
{
|
|
/// <summary>
|
|
/// 修复数据库 的摘要说明
|
|
/// </summary>
|
|
public class RepariDB : Method
|
|
{
|
|
/// <summary>
|
|
/// 不带有参数的方法
|
|
/// </summary>
|
|
public RepariDB()
|
|
{
|
|
this.Title = "修复数据库";
|
|
this.Help = "把最新的版本的与当前的数据表结构,做一个自动修复, 修复内容:缺少列,缺少列注释,列注释不完整或者有变化。";
|
|
this.Help += "<br>因为表单设计器的错误,丢失了字段,通过它也可以自动修复。";
|
|
}
|
|
/// <summary>
|
|
/// 设置执行变量
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public override void Init()
|
|
{
|
|
//this.Warning = "您确定要执行吗?";
|
|
//HisAttrs.AddTBString("P1", null, "原密码", true, false, 0, 10, 10);
|
|
//HisAttrs.AddTBString("P2", null, "新密码", true, false, 0, 10, 10);
|
|
//HisAttrs.AddTBString("P3", null, "确认", true, false, 0, 10, 10);
|
|
}
|
|
/// <summary>
|
|
/// 当前的操纵员是否可以执行这个方法
|
|
/// </summary>
|
|
public override bool IsCanDo
|
|
{
|
|
get
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 执行
|
|
/// </summary>
|
|
/// <returns>返回执行结果</returns>
|
|
public override object Do()
|
|
{
|
|
string rpt =BP.Pub.PubClass.DBRpt(DBCheckLevel.High);
|
|
|
|
|
|
//// 手动升级. 2011-07-08 补充节点字段分组.
|
|
//string sql = "DELETE FROM Sys_EnCfg WHERE No='BP.WF.Template.NodeSheet'";
|
|
//DBAccess.RunSQL(sql);
|
|
|
|
//sql = "INSERT INTO Sys_EnCfg(No,GroupTitle) VALUES ('BP.WF.Template.NodeSheet','NodeID=基本配置@WarningHour=考核属性@SendLab=功能按钮标签与状态')";
|
|
//DBAccess.RunSQL(sql);
|
|
|
|
// 修复因bug丢失的字段.
|
|
MapDatas mds = new MapDatas();
|
|
mds.RetrieveAll();
|
|
foreach (MapData md in mds)
|
|
{
|
|
string nodeid = md.No.Replace("ND","");
|
|
try
|
|
{
|
|
BP.WF.Node nd = new Node(int.Parse(nodeid));
|
|
nd.RepareMap(nd.HisFlow);
|
|
continue;
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
}
|
|
|
|
MapAttr attr = new MapAttr();
|
|
if (attr.IsExit(MapAttrAttr.KeyOfEn, "OID", MapAttrAttr.FK_MapData, md.No) == false)
|
|
{
|
|
attr.FrmID =md.No;
|
|
attr.setKeyOfEn("OID");
|
|
attr.setName("OID");
|
|
attr.setMyDataType(DataType.AppInt);
|
|
attr.setUIContralType(UIContralType.TB);
|
|
attr.setLGType(FieldTypeS.Normal);
|
|
attr.setUIVisible(false);
|
|
attr.setUIIsEnable(false);
|
|
attr.DefVal = "0";
|
|
attr.HisEditType = BP.En.EditType.Readonly;
|
|
attr.Insert();
|
|
}
|
|
}
|
|
return "执行成功...";
|
|
}
|
|
}
|
|
}
|