Пример #1
0
        public RelateBExpInfo GetRelateBExpInfoById(int RelateBExpId)
        {
            RelateBExpInfo relateBExpInfo  = null;//
            try
            {
                 relateBExpInfo = new RelateBExpInfo(RelateBExpId);

            }
            catch (AppException)
            {
                return null;
            }

            return  relateBExpInfo;
        }
Пример #2
0
 protected void btnAddRelate_Click(object sender, EventArgs e)
 {
     if (ddlClient.SelectedValue.ToString() == "")
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('��ѡ��ͻ���');</script>");
     }
     if (ddlRelate.SelectedValue.ToString() == "")
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('��ѡ����ϵ�ˣ�');</script>");
     }
     else
     {
         int bExpId = Convert.ToInt32(Request["BusinessExpId"].ToString());
         int RelateId = Convert.ToInt32(ddlRelate.SelectedValue);
         RelateBExpInfo rb = new RelateBExpInfo();
         rb.RelateId = RelateId;
         rb.BusinessExpId = bExpId;
         rb.Save();
         gvRelateDataBind();
         NumOfPeople();
     }
 }
Пример #3
0
 //数据持久化
 internal static void SaveToDb(RelateBExpInfo pRelateBExpInfo, RelateBExp  pRelateBExp,bool pIsNew)
 {
     pRelateBExp.RelateBExpId = pRelateBExpInfo.relateBExpId;
      		pRelateBExp.RelateId = pRelateBExpInfo.relateId;
      		pRelateBExp.BusinessExpId = pRelateBExpInfo.businessExpId;
     pRelateBExp.IsNew=pIsNew;
     string UserName = SubsonicHelper.GetUserName();
     try
     {
         pRelateBExp.Save(UserName);
     }
     catch(Exception ex)
     {
         LogManager.getInstance().getLogger(typeof(RelateBExpInfo)).Error(ex);
         if(ex.Message.Contains("插入重复键"))//违反了唯一键
         {
             throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
         }
         throw new AppException("保存失败");
     }
     pRelateBExpInfo.relateBExpId = pRelateBExp.RelateBExpId;
     //如果缓存存在,更新缓存
     if (CachedEntityCommander.IsTypeRegistered(typeof(RelateBExpInfo)))
     {
         ResetCache();
     }
 }
Пример #4
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List< RelateBExpInfo> pList, RelateBExpCollection pCollection)
 {
     foreach (RelateBExp relateBExp in pCollection)
     {
         RelateBExpInfo relateBExpInfo = new RelateBExpInfo();
         LoadFromDAL(relateBExpInfo, relateBExp );
         pList.Add(relateBExpInfo);
     }
 }
Пример #5
0
 //从后台获取数据
 internal static void LoadFromDAL(RelateBExpInfo pRelateBExpInfo, RelateBExp  pRelateBExp)
 {
     pRelateBExpInfo.relateBExpId = pRelateBExp.RelateBExpId;
      		pRelateBExpInfo.relateId = pRelateBExp.RelateId;
      		pRelateBExpInfo.businessExpId = pRelateBExp.BusinessExpId;
     pRelateBExpInfo.Loaded=true;
 }
Пример #6
0
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(RelateBExpInfo pRelateBExpInfoTo)
 {
     Copy(this,  pRelateBExpInfoTo);
 }
Пример #7
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List<RelateBExpInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount)
        {
            if(pPageIndex<=1)
            pPageIndex=1;
            List< RelateBExpInfo> list = new List< RelateBExpInfo>();

            Query q = RelateBExp .CreateQuery();
            q.PageIndex = pPageIndex;
            q.PageSize = pPageSize;
            q.ORDER_BY(pSortExpression,pOrderBy.ToString());
            RelateBExpCollection  collection=new  RelateBExpCollection();
             	collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (RelateBExp  relateBExp  in collection)
            {
                RelateBExpInfo relateBExpInfo = new RelateBExpInfo();
                LoadFromDAL(relateBExpInfo,   relateBExp);
                list.Add(relateBExpInfo);
            }
            pRecordCount=q.GetRecordCount();

            return list;
        }
Пример #8
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <returns></returns>
 public static List<RelateBExpInfo> GetList()
 {
     string cacheKey = GetCacheKey();
     //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
     if (CachedEntityCommander.IsTypeRegistered(typeof(RelateBExpInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
     {
         return CachedEntityCommander.GetCache(cacheKey) as List< RelateBExpInfo>;
     }
     else
     {
         List< RelateBExpInfo>  list =new List< RelateBExpInfo>();
         RelateBExpCollection  collection=new  RelateBExpCollection();
         Query qry = new Query(RelateBExp.Schema);
         collection.LoadAndCloseReader(qry.ExecuteReader());
         foreach(RelateBExp relateBExp in collection)
         {
             RelateBExpInfo relateBExpInfo= new RelateBExpInfo();
             LoadFromDAL(relateBExpInfo,relateBExp);
             list.Add(relateBExpInfo);
         }
       	//生成缓存
         if (CachedEntityCommander.IsTypeRegistered(typeof(RelateBExpInfo)))
         {
             CachedEntityCommander.SetCache(cacheKey, list);
         }
         return list;
     }
 }
Пример #9
0
 /// <summary>
 /// 复制一个对象,采用硬编码的方式,避免反射的低效
 /// </summary>
 /// <param name="pIndustryTypeInfoFrom"></param>
 /// <param name="pIndustryTypeInfoTo"></param>
 public static void Copy(RelateBExpInfo pRelateBExpInfoFrom, RelateBExpInfo pRelateBExpInfoTo)
 {
     pRelateBExpInfoTo.RelateBExpId = pRelateBExpInfoFrom.relateBExpId;
      		pRelateBExpInfoTo.RelateId = pRelateBExpInfoFrom.relateId;
      		pRelateBExpInfoTo.BusinessExpId = pRelateBExpInfoFrom.businessExpId;
     pRelateBExpInfoTo.Loaded=pRelateBExpInfoFrom.Loaded;
 }
Пример #10
0
 public object SaveRelateBExpInfo(RelateBExpInfo relateBExpInfo)
 {
     relateBExpInfo.Save();
     return relateBExpInfo . RelateBExpId;
 }
Пример #11
0
 public void DeleteById(RelateBExpInfo pRelateBExpInfo)
 {
     RelateBExpInfo relateBExpInfo = new RelateBExpInfo(pRelateBExpInfo.RelateBExpId);
     relateBExpInfo.Delete();
 }