using BP.DA;
using BP.Web;
using BP.En;
namespace BP.CCOA
{
///
/// 记事本 属性
///
public class NotepadAttr : EntityMyPKAttr
{
///
/// 名称
///
public const string Name = "Name";
///
/// 功能ID
///
public const string Docs = "Docs";
///
/// 组织编号
///
public const string OrgNo = "OrgNo";
///
/// 记录人
///
public const string Rec = "Rec";
///
/// 记录日期
///
public const string RDT = "RDT";
///
/// 年月
///
public const string NianYue = "NianYue";
///
/// 是否收藏
///
public const string IsStar = "IsStar";
}
///
/// 记事本
///
public class Notepad : EntityMyPK
{
#region 基本属性
///
/// 组织编号
///
public string OrgNo
{
get { return this.GetValStrByKey(NotepadAttr.OrgNo); }
set { this.SetValByKey(NotepadAttr.OrgNo, value); }
}
///
/// 记录人
///
public string Rec
{
get { return this.GetValStrByKey(NotepadAttr.Rec); }
set { this.SetValByKey(NotepadAttr.Rec, value); }
}
///
/// 记录日期
///
public string RDT
{
get { return this.GetValStrByKey(NotepadAttr.RDT); }
set { this.SetValByKey(NotepadAttr.RDT, value); }
}
///
/// 年月
///
public string NianYue
{
get { return this.GetValStrByKey(NotepadAttr.NianYue); }
set { this.SetValByKey(NotepadAttr.NianYue, value); }
}
#endregion
#region 构造方法
///
/// 权限控制
///
public override UAC HisUAC
{
get
{
UAC uac = new UAC();
if (WebUser.IsAdmin)
{
uac.IsUpdate = true;
return uac;
}
return base.HisUAC;
}
}
///
/// 记事本
///
public Notepad()
{
}
public Notepad(string mypk)
{
this.setMyPK(mypk);
this.Retrieve();
}
///
/// 重写基类方法
///
public override Map EnMap
{
get
{
if (this._enMap != null)
return this._enMap;
Map map = new Map("OA_Notepad", "记事本");
map.AddMyPK();
map.AddTBString(NotepadAttr.Name, null, "标题", true, false, 0, 300, 10, true);
map.AddTBStringDoc(NotepadAttr.Docs, null, "内容", true, false);
map.AddTBString(NotepadAttr.OrgNo, null, "OrgNo", false, false, 0, 100, 10);
map.AddTBString(NotepadAttr.Rec, null, "记录人", false, false, 0, 100, 10, true);
map.AddTBDateTime(NotepadAttr.RDT, null, "记录时间", false, false);
map.AddTBString(NotepadAttr.NianYue, null, "NianYue", false, false, 0, 10, 10);
map.AddTBInt(NotepadAttr.IsStar, 0, "是否标星", false, false);
//RefMethod rm = new RefMethod();
//rm.Title = "方法参数"; // "设计表单";
//rm.ClassMethodName = this.ToString() + ".DoParas";
//rm.Visable = true;
//rm.RefMethodType = RefMethodType.RightFrameOpen;
//rm.Target = "_blank";
////rm.GroupName = "开发接口";
//// map.AddRefMethod(rm);
//rm = new RefMethod();
//rm.Title = "方法内容"; // "设计表单";
//rm.ClassMethodName = this.ToString() + ".DoDocs";
//rm.Visable = true;
//rm.RefMethodType = RefMethodType.RightFrameOpen;
//rm.Target = "_blank";
////rm.GroupName = "开发接口";
//map.AddRefMethod(rm);
this._enMap = map;
return this._enMap;
}
}
#endregion
#region 执行方法.
protected override bool beforeInsert()
{
this.setMyPK(DBAccess.GenerGUID());
this.Rec = WebUser.No;
this.RDT = DataType.CurrentDateTime;
this.NianYue = DataType.CurrentYearMonth;
return base.beforeInsert();
}
#endregion 执行方法.
}
///
/// 记事本 s
///
public class Notepads : EntitiesMyPK
{
///
/// 查询前30个数据.
///
///
public string RetrieveTop30()
{
QueryObject qo = new QueryObject(this);
qo.AddWhere(NotepadAttr.Rec, WebUser.No);
//qo.addAnd();
//qo.AddWhere(NotepadAttr.IsStar, 0);
qo.Top = 30;
qo.addOrderBy("RDT");
qo.DoQuery();
return this.ToJson();
}
public string RetrieveTop30Stars()
{
QueryObject qo = new QueryObject(this);
qo.AddWhere(NotepadAttr.Rec, WebUser.No);
qo.addAnd();
qo.AddWhere(NotepadAttr.IsStar, 1);
qo.Top = 30;
qo.addOrderBy("RDT");
qo.DoQuery();
return this.ToJson();
}
///
/// 记事本
///
public Notepads() { }
///
/// 得到它的 Entity
///
public override Entity GetNewEntity
{
get
{
return new Notepad();
}
}
#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((Notepad)this[i]);
}
return list;
}
#endregion 为了适应自动翻译成java的需要,把实体转换成List.
}
}