Exemplo n.º 1
0
        //数据持久化
        internal static void  SaveToDb(YeWuInfo pYeWuInfo, YeWu pYeWu, bool pIsNew)
        {
            pYeWu.YeWuId   = pYeWuInfo.yeWuId;
            pYeWu.YeWuName = pYeWuInfo.yeWuName;
            pYeWu.IsNew    = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pYeWu.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(YeWuInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pYeWuInfo.yeWuId = pYeWu.YeWuId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(YeWuInfo)))
            {
                ResetCache();
            }
        }
Exemplo n.º 2
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 <YeWuInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
        {
            if (pPageIndex <= 1)
            {
                pPageIndex = 1;
            }
            List <YeWuInfo> list = new List <YeWuInfo>();

            Query q = YeWu.CreateQuery();

            q.PageIndex = pPageIndex;
            q.PageSize  = pPageSize;
            q.ORDER_BY(pSortExpression, pOrderBy.ToString());
            YeWuCollection collection = new  YeWuCollection();

            collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (YeWu yeWu  in collection)
            {
                YeWuInfo yeWuInfo = new YeWuInfo();
                LoadFromDAL(yeWuInfo, yeWu);
                list.Add(yeWuInfo);
            }
            pRecordCount = q.GetRecordCount();

            return(list);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <returns></returns>
        public static List <YeWuInfo> GetList()
        {
            string cacheKey = GetCacheKey();

            //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
            if (CachedEntityCommander.IsTypeRegistered(typeof(YeWuInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
            {
                return(CachedEntityCommander.GetCache(cacheKey) as List <YeWuInfo>);
            }
            else
            {
                List <YeWuInfo> list       = new List <YeWuInfo>();
                YeWuCollection  collection = new  YeWuCollection();
                Query           qry        = new Query(YeWu.Schema);
                collection.LoadAndCloseReader(qry.ExecuteReader());
                foreach (YeWu yeWu in collection)
                {
                    YeWuInfo yeWuInfo = new YeWuInfo();
                    LoadFromDAL(yeWuInfo, yeWu);
                    list.Add(yeWuInfo);
                }
                //生成缓存
                if (CachedEntityCommander.IsTypeRegistered(typeof(YeWuInfo)))
                {
                    CachedEntityCommander.SetCache(cacheKey, list);
                }
                return(list);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List <YeWuInfo> pList, YeWuCollection pCollection)
 {
     foreach (YeWu yeWu in pCollection)
     {
         YeWuInfo yeWuInfo = new YeWuInfo();
         LoadFromDAL(yeWuInfo, yeWu);
         pList.Add(yeWuInfo);
     }
 }
Exemplo n.º 5
0
        public YeWuInfo GetYeWuInfoById(int YeWuId)
        {
            YeWuInfo yeWuInfo  = null;//
            try
            {
                 yeWuInfo = new YeWuInfo(YeWuId);

            }
            catch (AppException)
            {
                return null;
            }

            return  yeWuInfo;
        }
Exemplo n.º 6
0
        public YeWuInfo GetYeWuInfoById(int YeWuId)
        {
            YeWuInfo yeWuInfo = null;             //

            try
            {
                yeWuInfo = new YeWuInfo(YeWuId);
            }
            catch (AppException)
            {
                return(null);
            }

            return(yeWuInfo);
        }
Exemplo n.º 7
0
 private void LoadFromId(int yeWuId)
 {
     if (CachedEntityCommander.IsTypeRegistered(typeof(YeWuInfo)))
     {
         YeWuInfo yeWuInfo = Find(GetList(), yeWuId);
         if (yeWuInfo == null)
         {
             throw new AppException("未能在缓存中找到相应的键值对象");
         }
         Copy(yeWuInfo, this);
     }
     else
     {
         YeWu yeWu = new YeWu(yeWuId);
         if (yeWu.IsNew)
         {
             throw new AppException("尚未初始化");
         }
         LoadFromDAL(this, yeWu);
     }
 }
Exemplo n.º 8
0
        private void PageBind()
        {
            int pid = Convert.ToInt32(Request["ProjectCreateId"].ToString());
            ProjectCreateInfo pc = new ProjectCreateInfo(pid);

            ClientInfo client = new ClientInfo(Convert.ToInt32(pc.ClientId));
            ProjectTypeInfo type = new ProjectTypeInfo(Convert.ToInt32(pc.ProjectTypeId));
            ProjectLevelInfo level = new ProjectLevelInfo(Convert.ToInt32(pc.ProjectLevelId));
            YeWuInfo yw = new YeWuInfo(Convert.ToInt32(pc.YeWuId));
            lblClientName.Text = client.ClientName.ToString();
            lblProjectType.Text = type.ProjectTypeName.ToString();
            lblProjectLevel.Text = level.ProjectLevelName.ToString();
            lblYewu.Text = yw.YeWuName.ToString();

            lblSheetNums.Text = pc.SheetNum.ToString();
            lblProjectFullName.Text = pc.ProjectName.ToString();
            lblProjectNum.Text = pc.SheetNum.ToString();
            lblPredictMoney.Text = pc.PreMoney.ToString();
            lblPredictProfit.Text = pc.PreProfit.ToString();
            lblApplyDate.Text = pc.ApplyDate.ToString();
            lblApplyName.Text = pc.ApplyName.ToString();
            lblApplyDepart.Text = pc.DepartName.ToString();
            txtBusinessDes.Text = pc.BusinessDescribe.ToString();
            lblCallBidPhaseExp.Text = pc.CallbidPhaseExp.ToString();
            lblCarryPhaseExp.Text = pc.CarryPhaseExp.ToString();
            txtClientDes.Text = pc.ClientDescribe.ToString();
            txtCompitDes.Text = pc.CompitDescribe.ToString();
            lblCratePhaseExp.Text = pc.CreatePhaseExp.ToString();
            txtManagerView.Text = pc.ManagerView.ToString();
            txtMemo.Text = pc.Memo.ToString();
            txtNeedDes.Text = pc.NeedDescribe.ToString();
            lblProjectFullName.Text =pc.ProjectName;
            lblProposePhaseExp.Text = pc.ProposePhaseExp.ToString();
            txtRiskDes.Text = pc.RiskDescribe.ToString();
            txtStrategyDes.Text = pc.StrategyDesribe.ToString();
            lblTalkPhaseExp.Text = pc.TalkPhaseExp.ToString();
            txtTechDes.Text = pc.TechDescribe.ToString();
            txtTechView.Text = pc.TechView.ToString();
            txtMarketView.Text = pc.MarketView.ToString();
        }
Exemplo n.º 9
0
 public List <YeWuInfo> GetYeWuInfoList()
 {
     return(YeWuInfo.GetList());
 }
Exemplo n.º 10
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<YeWuInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount)
        {
            if(pPageIndex<=1)
            pPageIndex=1;
            List< YeWuInfo> list = new List< YeWuInfo>();

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

            foreach (YeWu  yeWu  in collection)
            {
                YeWuInfo yeWuInfo = new YeWuInfo();
                LoadFromDAL(yeWuInfo,   yeWu);
                list.Add(yeWuInfo);
            }
            pRecordCount=q.GetRecordCount();

            return list;
        }
Exemplo n.º 11
0
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(YeWuInfo pYeWuInfoTo)
 {
     Copy(this,  pYeWuInfoTo);
 }
Exemplo n.º 12
0
 //从后台获取数据
 internal static void  LoadFromDAL(YeWuInfo pYeWuInfo, YeWu pYeWu)
 {
     pYeWuInfo.yeWuId   = pYeWu.YeWuId;
     pYeWuInfo.yeWuName = pYeWu.YeWuName;
     pYeWuInfo.Loaded   = true;
 }
Exemplo n.º 13
0
 //从后台获取数据
 internal static void LoadFromDAL(YeWuInfo pYeWuInfo, YeWu  pYeWu)
 {
     pYeWuInfo.yeWuId = pYeWu.YeWuId;
      		pYeWuInfo.yeWuName = pYeWu.YeWuName;
     pYeWuInfo.Loaded=true;
 }
Exemplo n.º 14
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <returns></returns>
 public static List<YeWuInfo> GetList()
 {
     string cacheKey = GetCacheKey();
     //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
     if (CachedEntityCommander.IsTypeRegistered(typeof(YeWuInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
     {
         return CachedEntityCommander.GetCache(cacheKey) as List< YeWuInfo>;
     }
     else
     {
         List< YeWuInfo>  list =new List< YeWuInfo>();
         YeWuCollection  collection=new  YeWuCollection();
         Query qry = new Query(YeWu.Schema);
         collection.LoadAndCloseReader(qry.ExecuteReader());
         foreach(YeWu yeWu in collection)
         {
             YeWuInfo yeWuInfo= new YeWuInfo();
             LoadFromDAL(yeWuInfo,yeWu);
             list.Add(yeWuInfo);
         }
       	//生成缓存
         if (CachedEntityCommander.IsTypeRegistered(typeof(YeWuInfo)))
         {
             CachedEntityCommander.SetCache(cacheKey, list);
         }
         return list;
     }
 }
Exemplo n.º 15
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List< YeWuInfo> pList, YeWuCollection pCollection)
 {
     foreach (YeWu yeWu in pCollection)
     {
         YeWuInfo yeWuInfo = new YeWuInfo();
         LoadFromDAL(yeWuInfo, yeWu );
         pList.Add(yeWuInfo);
     }
 }
Exemplo n.º 16
0
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(YeWuInfo pYeWuInfoTo)
 {
     Copy(this, pYeWuInfoTo);
 }
Exemplo n.º 17
0
 //数据持久化
 internal static void SaveToDb(YeWuInfo pYeWuInfo, YeWu  pYeWu,bool pIsNew)
 {
     pYeWu.YeWuId = pYeWuInfo.yeWuId;
      		pYeWu.YeWuName = pYeWuInfo.yeWuName;
     pYeWu.IsNew=pIsNew;
     string UserName = SubsonicHelper.GetUserName();
     try
     {
         pYeWu.Save(UserName);
     }
     catch(Exception ex)
     {
         LogManager.getInstance().getLogger(typeof(YeWuInfo)).Error(ex);
         if(ex.Message.Contains("插入重复键"))//违反了唯一键
         {
             throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
         }
         throw new AppException("保存失败");
     }
     pYeWuInfo.yeWuId = pYeWu.YeWuId;
     //如果缓存存在,更新缓存
     if (CachedEntityCommander.IsTypeRegistered(typeof(YeWuInfo)))
     {
         ResetCache();
     }
 }
Exemplo n.º 18
0
        public void DeleteById(YeWuInfo pYeWuInfo)
        {
            YeWuInfo yeWuInfo = new YeWuInfo(pYeWuInfo.YeWuId);

            yeWuInfo.Delete();
        }
Exemplo n.º 19
0
 public List <YeWuInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
 {
     return(YeWuInfo.GetPagedList(pPageIndex, pPageSize, pOrderBy, pSortExpression, out pRecordCount));
 }
Exemplo n.º 20
0
 public object  SaveYeWuInfo(YeWuInfo yeWuInfo)
 {
     yeWuInfo.Save();
     return(yeWuInfo.YeWuId);
 }
Exemplo n.º 21
0
 public void DeleteById(YeWuInfo pYeWuInfo)
 {
     YeWuInfo yeWuInfo = new YeWuInfo(pYeWuInfo.YeWuId);
     yeWuInfo.Delete();
 }
Exemplo n.º 22
0
 /// <summary>
 /// 复制一个对象,采用硬编码的方式,避免反射的低效
 /// </summary>
 /// <param name="pIndustryTypeInfoFrom"></param>
 /// <param name="pIndustryTypeInfoTo"></param>
 public static void Copy(YeWuInfo pYeWuInfoFrom, YeWuInfo pYeWuInfoTo)
 {
     pYeWuInfoTo.YeWuId   = pYeWuInfoFrom.yeWuId;
     pYeWuInfoTo.YeWuName = pYeWuInfoFrom.yeWuName;
     pYeWuInfoTo.Loaded   = pYeWuInfoFrom.Loaded;
 }
Exemplo n.º 23
0
 public object SaveYeWuInfo(YeWuInfo yeWuInfo)
 {
     yeWuInfo.Save();
     return yeWuInfo . YeWuId;
 }
Exemplo n.º 24
0
 /// <summary>
 /// 复制一个对象,采用硬编码的方式,避免反射的低效
 /// </summary>
 /// <param name="pIndustryTypeInfoFrom"></param>
 /// <param name="pIndustryTypeInfoTo"></param>
 public static void Copy(YeWuInfo pYeWuInfoFrom, YeWuInfo pYeWuInfoTo)
 {
     pYeWuInfoTo.YeWuId = pYeWuInfoFrom.yeWuId;
      		pYeWuInfoTo.YeWuName = pYeWuInfoFrom.yeWuName;
     pYeWuInfoTo.Loaded=pYeWuInfoFrom.Loaded;
 }