| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- using Castle.ActiveRecord;
- using NHibernate.Criterion;
- using System;
- using System.Text;
- namespace BizCom
- {
- [ActiveRecord("CE_ErpUserPost")]
- public class CeErpUserPost : ComBase<CeErpUserPost>
- {
- /// <summary>
- ///
- /// </summary>
- [PrimaryKey(PrimaryKeyType.Native)]
- public int ID { get; set; }
- private int _userID = 0;
- /// <summary>
- ///
- /// </summary>
- [Property]
- public int UserID
- {
- get { return _userID; }
- set { _userID = value; }
- }
- private int _orgID = 0;
- /// <summary>
- ///
- /// </summary>
- [Property]
- public int OrgID
- {
- get { return _orgID; }
- set { _orgID = value; }
- }
- private CeErpPost _post;
- [BelongsTo("PostID", Insert = false, NotFoundBehaviour = NotFoundBehaviour.Ignore, Cascade = CascadeEnum.None, Update = false)]
- public CeErpPost Post
- {
- get { return _post; }
- set { _post = value; }
- }
- private int _postID = 0;
- /// <summary>
- ///
- /// </summary>
- [Property]
- public int PostID
- {
- get { return _postID; }
- set { _postID = value; }
- }
- public static void Del(object id)
- {
- StringBuilder sql = new StringBuilder();
- sql.AppendFormat("delete from CE_ErpUserPost where id=" + id);
- ExecuteNonQuery(sql.ToString());
- }
- public static void Del(object id, string personId)
- {
- StringBuilder sql = new StringBuilder();
- sql.AppendFormat("delete from CE_ErpUserPost where id={0} and UserID={1}", id, personId);
- ExecuteNonQuery(sql.ToString());
- }
- public static CeErpUserPost Get(int personId, object id)
- {
- return FindFirst(Expression.And(Expression.Eq("UserID", personId), Expression.Eq("ID", Convert.ToInt32(id))));
- //Expression.Sql(string.Format("PersonID={0} and ID={1}", personId, id)));
- }
- public static CeErpUserPost GetByUserID(int uid)
- {
- return FindFirst(Expression.Eq("UserID", uid));
- //Expression.Sql(string.Format("PersonID={0} and ID={1}", personId, id)));
- }
- }
- }
|