using System;
using System.Collections;
using System.Diagnostics;
using BP.DA;
using BP.Difference;
using BP.En;
using BP.Web;
namespace BP.Sys
{
///
/// 常用语属性
///
public class FastInputAttr : EntityNoNameAttr
{
///
/// 表单ID.
///
public const string EnsName = "EnsName";
///
/// 字段
///
public const string AttrKey = "AttrKey";
///
/// 类型
///
public const string CfgKey = "CfgKey";
///
/// Vals
///
public const string Vals = "Vals";
///
/// 流程编号
///
public const string FK_Emp = "FK_Emp";
///
/// 顺序号
///
public const string Idx = "Idx";
}
///
/// 常用语
///
public class FastInput : EntityMyPK
{
#region 基本属性
///
/// 表单ID
///
public string EnsName
{
get
{
return this.GetValStringByKey(FastInputAttr.EnsName);
}
set
{
this.SetValByKey(FastInputAttr.EnsName, value);
}
}
///
/// 属性
///
public string AttrKey
{
get
{
return this.GetValStringByKey(FastInputAttr.AttrKey);
}
set
{
this.SetValByKey(FastInputAttr.AttrKey, value);
}
}
///
/// 配置的变量
///
public string CfgKey
{
get
{
return "CYY";
}
set
{
this.SetValByKey(FastInputAttr.CfgKey, value);
}
}
///
/// 人员
///
public string EmpNo
{
get
{
return this.GetValStringByKey(FastInputAttr.FK_Emp);
}
set
{
this.SetValByKey(FastInputAttr.FK_Emp, value);
}
}
public string Vals
{
get
{
return this.GetValStringByKey(FastInputAttr.Vals);
}
set
{
this.SetValByKey(FastInputAttr.Vals, value);
}
}
#endregion
#region 构造方法
///
/// 常用语
///
public FastInput()
{
}
///
/// 常用语
///
///
public FastInput(string mypk) : base(mypk)
{
}
///
/// 更新前做的事情
///
///
protected override bool beforeUpdateInsertAction()
{
if (DataType.IsNullOrEmpty(this.MyPK) == true)
this.setMyPK(DBAccess.GenerGUID());
return base.beforeUpdateInsertAction();
}
///
/// 重写基类方法
///
public override Map EnMap
{
get
{
if (this._enMap != null)
return this._enMap;
Map map = new Map("Sys_UserRegedit", "常用语");
/*
* 常用语分为两个模式: 流程的常用语,与表单字段的常用语.
* 这两个模式都存储在同一个表里.
*
* 流程的常用语存储格式为:
* CfgKey=Flow, EnsName=Flow, AttrKey=WorkCheck,FlowBBS,WorkReturn 三种类型.
*
* 表单的常用语为存储格式为:
* CfgKey=Frm, EnsName=myformID, AttrKey=myFieldName,
*
*/
//该表单对应的表单ID ,
//CfgKey=Flow, EnsName=Flow 是流程的常用语. Filed
map.AddMyPK();
map.AddTBString(FastInputAttr.CfgKey, null, "类型Flow,Frm", true, false, 0, 20, 20);
map.AddTBString(FastInputAttr.EnsName, null, "表单ID", true, false, 0, 100, 4);
map.AddTBString(FastInputAttr.AttrKey, null, "字段", true, false, 0, 100, 4);
map.AddTBString(FastInputAttr.FK_Emp, null, "人员", true, false, 0, 100, 4);
map.AddTBString(FastInputAttr.Vals, null, "值", true, false, 0, 500, 500);
this._enMap = map;
return this._enMap;
}
}
#endregion
///
/// 上移
///
///
public string DoUp()
{
this.DoOrderUp(FastInputAttr.CfgKey, "CYY",
FastInputAttr.EnsName, this.EnsName,
FastInputAttr.AttrKey, this.AttrKey,
FastInputAttr.FK_Emp, WebUser.No, "Idx");
return "移动成功.";
}
///
/// 下移
///
///
public string DoDown()
{
this.DoOrderDown(FastInputAttr.CfgKey, "CYY",
FastInputAttr.EnsName, this.EnsName,
FastInputAttr.AttrKey, this.AttrKey,
FastInputAttr.FK_Emp, WebUser.No, "Idx");
return "移动成功.";
}
}
///
/// 常用语s
///
public class FastInputs : EntitiesMyPK
{
///
/// 常用语s
///
public FastInputs()
{
}
///
/// 得到它的 Entity
///
public override Entity GetNewEntity
{
get
{
return new FastInput();
}
}
///
/// 获得已经有的数据.
///
///
public string InitData_Flow()
{
string userNo = WebUser.No;
if (SystemConfig.CCBPMRunModel == CCBPMRunModel.SAAS)
userNo = WebUser.OrgNo + "_" + userNo;
int i = this.Retrieve("CfgKey", "Flow", "FK_Emp", userNo);
if (i == 0)
{
FastInput en = new FastInput();
en.setMyPK("Flow" + userNo + "_1");
en.SetValByKey("CfgKey", "Flow");
en.SetValByKey("FK_Emp", userNo);
en.SetValByKey("Vals", "同意");
en.Insert();
en = new FastInput();
en.setMyPK("Flow" + userNo + "_2");
en.SetValByKey("CfgKey", "Flow");
en.SetValByKey("FK_Emp", userNo);
en.SetValByKey("Vals", "不同意");
en.Insert();
en = new FastInput();
en.setMyPK("Flow" + userNo + "_3");
en.SetValByKey("CfgKey", "Flow");
en.SetValByKey("FK_Emp", userNo);
en.SetValByKey("Vals", "请领导斟酌");
en.Insert();
this.Retrieve("CfgKey", "Flow", "FK_Emp", userNo);
}
if (i < 6)
{
int count = 6 - this.Count;
for (int idx = 0; idx < count; idx++)
{
int index = idx + 1 + count;
string mypk = "Flow" + userNo + "_" + index;
FastInput en = new FastInput();
if (en.IsExit("MyPK", mypk))
continue;
en.setMyPK(mypk);
en.SetValByKey("CfgKey", "Flow");
en.SetValByKey("FK_Emp", userNo);
en.SetValByKey("Vals", "");
en.Insert();
}
}
this.Retrieve("CfgKey", "Flow", "FK_Emp", userNo);
return this.ToJson();
}
///
/// 查询全部
///
///
public override int RetrieveAll()
{
int val = this.Retrieve(FastInputAttr.CfgKey, "CYY",
FastInputAttr.FK_Emp, BP.Web.WebUser.No);
if (val == 0)
{
FastInput en = new FastInput();
en.setMyPK(DBAccess.GenerGUID());
en.Vals = "同意";
en.EmpNo = WebUser.No;
en.Insert();
en = new FastInput();
en.setMyPK(DBAccess.GenerGUID());
en.Vals = "不同意";
en.EmpNo = WebUser.No;
en.Insert();
en = new FastInput();
en.setMyPK(DBAccess.GenerGUID());
en.Vals = "同意,请领导批示";
en.EmpNo = WebUser.No;
en.Insert();
en = new FastInput();
en.setMyPK(DBAccess.GenerGUID());
en.Vals = "同意办理";
en.EmpNo = WebUser.No;
en.Insert();
en = new FastInput();
en.setMyPK(DBAccess.GenerGUID());
en.Vals = "情况属实报领导批准";
en.EmpNo = WebUser.No;
en.Insert();
val = this.Retrieve(FastInputAttr.CfgKey, "CYY",
FastInputAttr.FK_Emp, BP.Web.WebUser.No);
}
return val;
}
#region 为了适应自动翻译成java的需要,把实体转换成List.
///
/// 转化成 java list,C#不能调用.
///
/// List
public System.Collections.Generic.IList ToJavaList()
{
return (System.Collections.Generic.IList)this;
}
///
/// 转化成list
///
/// List
public System.Collections.Generic.List Tolist()
{
System.Collections.Generic.List list = new System.Collections.Generic.List();
for (int i = 0; i < this.Count; i++)
{
list.Add((FastInput)this[i]);
}
return list;
}
#endregion 为了适应自动翻译成java的需要,把实体转换成List.
}
}