Exemplo n.º 1
0
        //数据持久化
        internal static void  SaveToDb(ProjectLevelInfo pProjectLevelInfo, ProjectLevel pProjectLevel, bool pIsNew)
        {
            pProjectLevel.ProjectLevelId   = pProjectLevelInfo.projectLevelId;
            pProjectLevel.ProjectLevelName = pProjectLevelInfo.projectLevelName;
            pProjectLevel.IsNew            = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

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

            Query q = ProjectLevel.CreateQuery();

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

            collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (ProjectLevel projectLevel  in collection)
            {
                ProjectLevelInfo projectLevelInfo = new ProjectLevelInfo();
                LoadFromDAL(projectLevelInfo, projectLevel);
                list.Add(projectLevelInfo);
            }
            pRecordCount = q.GetRecordCount();

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

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

            }
            catch (AppException)
            {
                return null;
            }

            return  projectLevelInfo;
        }
Exemplo n.º 6
0
        public ProjectLevelInfo GetProjectLevelInfoById(int ProjectLevelId)
        {
            ProjectLevelInfo projectLevelInfo = null;             //

            try
            {
                projectLevelInfo = new ProjectLevelInfo(ProjectLevelId);
            }
            catch (AppException)
            {
                return(null);
            }

            return(projectLevelInfo);
        }
Exemplo n.º 7
0
 private void LoadFromId(int projectLevelId)
 {
     if (CachedEntityCommander.IsTypeRegistered(typeof(ProjectLevelInfo)))
     {
         ProjectLevelInfo projectLevelInfo = Find(GetList(), projectLevelId);
         if (projectLevelInfo == null)
         {
             throw new AppException("未能在缓存中找到相应的键值对象");
         }
         Copy(projectLevelInfo, this);
     }
     else
     {
         ProjectLevel projectLevel = new ProjectLevel(projectLevelId);
         if (projectLevel.IsNew)
         {
             throw new AppException("尚未初始化");
         }
         LoadFromDAL(this, projectLevel);
     }
 }
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
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(ProjectLevelInfo pProjectLevelInfoTo)
 {
     Copy(this, pProjectLevelInfoTo);
 }
Exemplo n.º 10
0
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(ProjectLevelInfo pProjectLevelInfoTo)
 {
     Copy(this,  pProjectLevelInfoTo);
 }
Exemplo n.º 11
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<ProjectLevelInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount)
        {
            if(pPageIndex<=1)
            pPageIndex=1;
            List< ProjectLevelInfo> list = new List< ProjectLevelInfo>();

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

            foreach (ProjectLevel  projectLevel  in collection)
            {
                ProjectLevelInfo projectLevelInfo = new ProjectLevelInfo();
                LoadFromDAL(projectLevelInfo,   projectLevel);
                list.Add(projectLevelInfo);
            }
            pRecordCount=q.GetRecordCount();

            return list;
        }
Exemplo n.º 12
0
 //从后台获取数据
 internal static void  LoadFromDAL(ProjectLevelInfo pProjectLevelInfo, ProjectLevel pProjectLevel)
 {
     pProjectLevelInfo.projectLevelId   = pProjectLevel.ProjectLevelId;
     pProjectLevelInfo.projectLevelName = pProjectLevel.ProjectLevelName;
     pProjectLevelInfo.Loaded           = true;
 }
Exemplo n.º 13
0
 //从后台获取数据
 internal static void LoadFromDAL(ProjectLevelInfo pProjectLevelInfo, ProjectLevel  pProjectLevel)
 {
     pProjectLevelInfo.projectLevelId = pProjectLevel.ProjectLevelId;
      		pProjectLevelInfo.projectLevelName = pProjectLevel.ProjectLevelName;
     pProjectLevelInfo.Loaded=true;
 }
Exemplo n.º 14
0
 /// <summary>
 /// 复制一个对象,采用硬编码的方式,避免反射的低效
 /// </summary>
 /// <param name="pIndustryTypeInfoFrom"></param>
 /// <param name="pIndustryTypeInfoTo"></param>
 public static void Copy(ProjectLevelInfo pProjectLevelInfoFrom, ProjectLevelInfo pProjectLevelInfoTo)
 {
     pProjectLevelInfoTo.ProjectLevelId   = pProjectLevelInfoFrom.projectLevelId;
     pProjectLevelInfoTo.ProjectLevelName = pProjectLevelInfoFrom.projectLevelName;
     pProjectLevelInfoTo.Loaded           = pProjectLevelInfoFrom.Loaded;
 }
Exemplo n.º 15
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List< ProjectLevelInfo> pList, ProjectLevelCollection pCollection)
 {
     foreach (ProjectLevel projectLevel in pCollection)
     {
         ProjectLevelInfo projectLevelInfo = new ProjectLevelInfo();
         LoadFromDAL(projectLevelInfo, projectLevel );
         pList.Add(projectLevelInfo);
     }
 }
Exemplo n.º 16
0
 public List <ProjectLevelInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
 {
     return(ProjectLevelInfo.GetPagedList(pPageIndex, pPageSize, pOrderBy, pSortExpression, out pRecordCount));
 }
Exemplo n.º 17
0
 public object  SaveProjectLevelInfo(ProjectLevelInfo projectLevelInfo)
 {
     projectLevelInfo.Save();
     return(projectLevelInfo.ProjectLevelId);
 }
Exemplo n.º 18
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <returns></returns>
 public static List<ProjectLevelInfo> GetList()
 {
     string cacheKey = GetCacheKey();
     //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
     if (CachedEntityCommander.IsTypeRegistered(typeof(ProjectLevelInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
     {
         return CachedEntityCommander.GetCache(cacheKey) as List< ProjectLevelInfo>;
     }
     else
     {
         List< ProjectLevelInfo>  list =new List< ProjectLevelInfo>();
         ProjectLevelCollection  collection=new  ProjectLevelCollection();
         Query qry = new Query(ProjectLevel.Schema);
         collection.LoadAndCloseReader(qry.ExecuteReader());
         foreach(ProjectLevel projectLevel in collection)
         {
             ProjectLevelInfo projectLevelInfo= new ProjectLevelInfo();
             LoadFromDAL(projectLevelInfo,projectLevel);
             list.Add(projectLevelInfo);
         }
       	//生成缓存
         if (CachedEntityCommander.IsTypeRegistered(typeof(ProjectLevelInfo)))
         {
             CachedEntityCommander.SetCache(cacheKey, list);
         }
         return list;
     }
 }
Exemplo n.º 19
0
 //数据持久化
 internal static void SaveToDb(ProjectLevelInfo pProjectLevelInfo, ProjectLevel  pProjectLevel,bool pIsNew)
 {
     pProjectLevel.ProjectLevelId = pProjectLevelInfo.projectLevelId;
      		pProjectLevel.ProjectLevelName = pProjectLevelInfo.projectLevelName;
     pProjectLevel.IsNew=pIsNew;
     string UserName = SubsonicHelper.GetUserName();
     try
     {
         pProjectLevel.Save(UserName);
     }
     catch(Exception ex)
     {
         LogManager.getInstance().getLogger(typeof(ProjectLevelInfo)).Error(ex);
         if(ex.Message.Contains("插入重复键"))//违反了唯一键
         {
             throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
         }
         throw new AppException("保存失败");
     }
     pProjectLevelInfo.projectLevelId = pProjectLevel.ProjectLevelId;
     //如果缓存存在,更新缓存
     if (CachedEntityCommander.IsTypeRegistered(typeof(ProjectLevelInfo)))
     {
         ResetCache();
     }
 }
Exemplo n.º 20
0
        public void DeleteById(ProjectLevelInfo pProjectLevelInfo)
        {
            ProjectLevelInfo projectLevelInfo = new ProjectLevelInfo(pProjectLevelInfo.ProjectLevelId);

            projectLevelInfo.Delete();
        }
Exemplo n.º 21
0
 public object SaveProjectLevelInfo(ProjectLevelInfo projectLevelInfo)
 {
     projectLevelInfo.Save();
     return projectLevelInfo . ProjectLevelId;
 }
Exemplo n.º 22
0
 public void DeleteById(ProjectLevelInfo pProjectLevelInfo)
 {
     ProjectLevelInfo projectLevelInfo = new ProjectLevelInfo(pProjectLevelInfo.ProjectLevelId);
     projectLevelInfo.Delete();
 }
Exemplo n.º 23
0
 public List <ProjectLevelInfo> GetProjectLevelInfoList()
 {
     return(ProjectLevelInfo.GetList());
 }
Exemplo n.º 24
0
 /// <summary>
 /// 复制一个对象,采用硬编码的方式,避免反射的低效
 /// </summary>
 /// <param name="pIndustryTypeInfoFrom"></param>
 /// <param name="pIndustryTypeInfoTo"></param>
 public static void Copy(ProjectLevelInfo pProjectLevelInfoFrom, ProjectLevelInfo pProjectLevelInfoTo)
 {
     pProjectLevelInfoTo.ProjectLevelId = pProjectLevelInfoFrom.projectLevelId;
      		pProjectLevelInfoTo.ProjectLevelName = pProjectLevelInfoFrom.projectLevelName;
     pProjectLevelInfoTo.Loaded=pProjectLevelInfoFrom.Loaded;
 }