//从后台获取数据 internal static void LoadFromDAL(ProjectCreateInfo pProjectCreateInfo, ProjectCreate pProjectCreate) { pProjectCreateInfo.projectCreateId = pProjectCreate.ProjectCreateId; pProjectCreateInfo.clientId = pProjectCreate.ClientId; pProjectCreateInfo.projectLevelId = pProjectCreate.ProjectLevelId; pProjectCreateInfo.projectTypeId = pProjectCreate.ProjectTypeId; pProjectCreateInfo.yeWuId = pProjectCreate.YeWuId; pProjectCreateInfo.projectName = pProjectCreate.ProjectName; pProjectCreateInfo.preMoney = pProjectCreate.PreMoney; pProjectCreateInfo.preProfit = pProjectCreate.PreProfit; pProjectCreateInfo.applyDate = pProjectCreate.ApplyDate; pProjectCreateInfo.createPhaseExp = pProjectCreate.CreatePhaseExp; pProjectCreateInfo.proposePhaseExp = pProjectCreate.ProposePhaseExp; pProjectCreateInfo.callbidPhaseExp = pProjectCreate.CallbidPhaseExp; pProjectCreateInfo.talkPhaseExp = pProjectCreate.TalkPhaseExp; pProjectCreateInfo.carryPhaseExp = pProjectCreate.CarryPhaseExp; pProjectCreateInfo.needDescribe = pProjectCreate.NeedDescribe; pProjectCreateInfo.compitDescribe = pProjectCreate.CompitDescribe; pProjectCreateInfo.clientDescribe = pProjectCreate.ClientDescribe; pProjectCreateInfo.techDescribe = pProjectCreate.TechDescribe; pProjectCreateInfo.businessDescribe = pProjectCreate.BusinessDescribe; pProjectCreateInfo.riskDescribe = pProjectCreate.RiskDescribe; pProjectCreateInfo.strategyDesribe = pProjectCreate.StrategyDesribe; pProjectCreateInfo.memo = pProjectCreate.Memo; pProjectCreateInfo.marketView = pProjectCreate.MarketView; pProjectCreateInfo.techView = pProjectCreate.TechView; pProjectCreateInfo.managerView = pProjectCreate.ManagerView; pProjectCreateInfo.sheetNum = pProjectCreate.SheetNum; pProjectCreateInfo.today = pProjectCreate.Today; pProjectCreateInfo.applyName = pProjectCreate.ApplyName; pProjectCreateInfo.departName = pProjectCreate.DepartName; pProjectCreateInfo.state = pProjectCreate.State; pProjectCreateInfo.applyTime = pProjectCreate.ApplyTime; pProjectCreateInfo.Loaded = true; }
/// <summary> /// 获得数据列表 /// </summary> /// <returns></returns> public static List <ProjectCreateInfo> GetList() { string cacheKey = GetCacheKey(); //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取 if (CachedEntityCommander.IsTypeRegistered(typeof(ProjectCreateInfo)) && CachedEntityCommander.GetCache(cacheKey) != null) { return(CachedEntityCommander.GetCache(cacheKey) as List <ProjectCreateInfo>); } else { List <ProjectCreateInfo> list = new List <ProjectCreateInfo>(); ProjectCreateCollection collection = new ProjectCreateCollection(); Query qry = new Query(ProjectCreate.Schema); collection.LoadAndCloseReader(qry.ExecuteReader()); foreach (ProjectCreate projectCreate in collection) { ProjectCreateInfo projectCreateInfo = new ProjectCreateInfo(); LoadFromDAL(projectCreateInfo, projectCreate); list.Add(projectCreateInfo); } //生成缓存 if (CachedEntityCommander.IsTypeRegistered(typeof(ProjectCreateInfo))) { CachedEntityCommander.SetCache(cacheKey, list); } return(list); } }
/// <summary> /// 复制一个对象,采用硬编码的方式,避免反射的低效 /// </summary> /// <param name="pIndustryTypeInfoFrom"></param> /// <param name="pIndustryTypeInfoTo"></param> public static void Copy(ProjectCreateInfo pProjectCreateInfoFrom, ProjectCreateInfo pProjectCreateInfoTo) { pProjectCreateInfoTo.ProjectCreateId = pProjectCreateInfoFrom.projectCreateId; pProjectCreateInfoTo.ClientId = pProjectCreateInfoFrom.clientId; pProjectCreateInfoTo.ProjectLevelId = pProjectCreateInfoFrom.projectLevelId; pProjectCreateInfoTo.ProjectTypeId = pProjectCreateInfoFrom.projectTypeId; pProjectCreateInfoTo.YeWuId = pProjectCreateInfoFrom.yeWuId; pProjectCreateInfoTo.ProjectName = pProjectCreateInfoFrom.projectName; pProjectCreateInfoTo.PreMoney = pProjectCreateInfoFrom.preMoney; pProjectCreateInfoTo.PreProfit = pProjectCreateInfoFrom.preProfit; pProjectCreateInfoTo.ApplyDate = pProjectCreateInfoFrom.applyDate; pProjectCreateInfoTo.CreatePhaseExp = pProjectCreateInfoFrom.createPhaseExp; pProjectCreateInfoTo.ProposePhaseExp = pProjectCreateInfoFrom.proposePhaseExp; pProjectCreateInfoTo.CallbidPhaseExp = pProjectCreateInfoFrom.callbidPhaseExp; pProjectCreateInfoTo.TalkPhaseExp = pProjectCreateInfoFrom.talkPhaseExp; pProjectCreateInfoTo.CarryPhaseExp = pProjectCreateInfoFrom.carryPhaseExp; pProjectCreateInfoTo.NeedDescribe = pProjectCreateInfoFrom.needDescribe; pProjectCreateInfoTo.CompitDescribe = pProjectCreateInfoFrom.compitDescribe; pProjectCreateInfoTo.ClientDescribe = pProjectCreateInfoFrom.clientDescribe; pProjectCreateInfoTo.TechDescribe = pProjectCreateInfoFrom.techDescribe; pProjectCreateInfoTo.BusinessDescribe = pProjectCreateInfoFrom.businessDescribe; pProjectCreateInfoTo.RiskDescribe = pProjectCreateInfoFrom.riskDescribe; pProjectCreateInfoTo.StrategyDesribe = pProjectCreateInfoFrom.strategyDesribe; pProjectCreateInfoTo.Memo = pProjectCreateInfoFrom.memo; pProjectCreateInfoTo.MarketView = pProjectCreateInfoFrom.marketView; pProjectCreateInfoTo.TechView = pProjectCreateInfoFrom.techView; pProjectCreateInfoTo.ManagerView = pProjectCreateInfoFrom.managerView; pProjectCreateInfoTo.SheetNum = pProjectCreateInfoFrom.sheetNum; pProjectCreateInfoTo.Today = pProjectCreateInfoFrom.today; pProjectCreateInfoTo.ApplyName = pProjectCreateInfoFrom.applyName; pProjectCreateInfoTo.DepartName = pProjectCreateInfoFrom.departName; pProjectCreateInfoTo.State = pProjectCreateInfoFrom.state; pProjectCreateInfoTo.ApplyTime = pProjectCreateInfoFrom.applyTime; pProjectCreateInfoTo.Loaded = pProjectCreateInfoFrom.Loaded; }
protected void btnSave_Click(object sender, EventArgs e) { if (rblOver.SelectedIndex == -1) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('请选择修正或通过!');</script>"); } else { try { int cid = Convert.ToInt32(Request["ProjectCreateId"].ToString()); ProjectCreateInfo pc = new ProjectCreateInfo(cid); pc.TechView = txtTechView.Text.ToString(); pc.MarketView = txtMarketView.Text.ToString(); if (rblOver.Items[0].Selected) { pc.State = 2; pc.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('您让申请人修正!');</script>"); } else if (rblOver.Items[1].Selected) { pc.State = 6; pc.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('审批通过!');</script>"); } } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('保存失败:" + Ex.Message + "');", true); } } }
/// <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 <ProjectCreateInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount) { if (pPageIndex <= 1) { pPageIndex = 1; } List <ProjectCreateInfo> list = new List <ProjectCreateInfo>(); Query q = ProjectCreate.CreateQuery(); q.PageIndex = pPageIndex; q.PageSize = pPageSize; q.ORDER_BY(pSortExpression, pOrderBy.ToString()); ProjectCreateCollection collection = new ProjectCreateCollection(); collection.LoadAndCloseReader(q.ExecuteReader()); foreach (ProjectCreate projectCreate in collection) { ProjectCreateInfo projectCreateInfo = new ProjectCreateInfo(); LoadFromDAL(projectCreateInfo, projectCreate); list.Add(projectCreateInfo); } pRecordCount = q.GetRecordCount(); return(list); }
protected void btnSubmit_Click(object sender, EventArgs e) { int fid = Convert.ToInt32(((Button)sender).CommandArgument.ToString()); ProjectCreateInfo pc = new ProjectCreateInfo(fid); pc.ApplyTime = DateTime.Now.ToString(); pc.State = 1; pc.Save(); gvDataBind(); }
/// <summary> /// 批量装载 /// </summary> internal static void LoadFromDALPatch(List <ProjectCreateInfo> pList, ProjectCreateCollection pCollection) { foreach (ProjectCreate projectCreate in pCollection) { ProjectCreateInfo projectCreateInfo = new ProjectCreateInfo(); LoadFromDAL(projectCreateInfo, projectCreate); pList.Add(projectCreateInfo); } }
//数据持久化 internal static void SaveToDb(ProjectCreateInfo pProjectCreateInfo, ProjectCreate pProjectCreate, bool pIsNew) { pProjectCreate.ProjectCreateId = pProjectCreateInfo.projectCreateId; pProjectCreate.ClientId = pProjectCreateInfo.clientId; pProjectCreate.ProjectLevelId = pProjectCreateInfo.projectLevelId; pProjectCreate.ProjectTypeId = pProjectCreateInfo.projectTypeId; pProjectCreate.YeWuId = pProjectCreateInfo.yeWuId; pProjectCreate.ProjectName = pProjectCreateInfo.projectName; pProjectCreate.PreMoney = pProjectCreateInfo.preMoney; pProjectCreate.PreProfit = pProjectCreateInfo.preProfit; pProjectCreate.ApplyDate = pProjectCreateInfo.applyDate; pProjectCreate.CreatePhaseExp = pProjectCreateInfo.createPhaseExp; pProjectCreate.ProposePhaseExp = pProjectCreateInfo.proposePhaseExp; pProjectCreate.CallbidPhaseExp = pProjectCreateInfo.callbidPhaseExp; pProjectCreate.TalkPhaseExp = pProjectCreateInfo.talkPhaseExp; pProjectCreate.CarryPhaseExp = pProjectCreateInfo.carryPhaseExp; pProjectCreate.NeedDescribe = pProjectCreateInfo.needDescribe; pProjectCreate.CompitDescribe = pProjectCreateInfo.compitDescribe; pProjectCreate.ClientDescribe = pProjectCreateInfo.clientDescribe; pProjectCreate.TechDescribe = pProjectCreateInfo.techDescribe; pProjectCreate.BusinessDescribe = pProjectCreateInfo.businessDescribe; pProjectCreate.RiskDescribe = pProjectCreateInfo.riskDescribe; pProjectCreate.StrategyDesribe = pProjectCreateInfo.strategyDesribe; pProjectCreate.Memo = pProjectCreateInfo.memo; pProjectCreate.MarketView = pProjectCreateInfo.marketView; pProjectCreate.TechView = pProjectCreateInfo.techView; pProjectCreate.ManagerView = pProjectCreateInfo.managerView; pProjectCreate.SheetNum = pProjectCreateInfo.sheetNum; pProjectCreate.Today = pProjectCreateInfo.today; pProjectCreate.ApplyName = pProjectCreateInfo.applyName; pProjectCreate.DepartName = pProjectCreateInfo.departName; pProjectCreate.State = pProjectCreateInfo.state; pProjectCreate.ApplyTime = pProjectCreateInfo.applyTime; pProjectCreate.IsNew = pIsNew; string UserName = SubsonicHelper.GetUserName(); try { pProjectCreate.Save(UserName); } catch (Exception ex) { LogManager.getInstance().getLogger(typeof(ProjectCreateInfo)).Error(ex); if (ex.Message.Contains("插入重复键")) //违反了唯一键 { throw new AppException("此对象已经存在"); //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示 } throw new AppException("保存失败"); } pProjectCreateInfo.projectCreateId = pProjectCreate.ProjectCreateId; //如果缓存存在,更新缓存 if (CachedEntityCommander.IsTypeRegistered(typeof(ProjectCreateInfo))) { ResetCache(); } }
protected void gvSale_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //鼠标移动到每项时颜色交替效果 e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#c1ebff'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e"); //设置悬浮鼠标指针形状为"小手" e.Row.Attributes["style"] = "Cursor:hand"; if (!Convert.IsDBNull(gvSale.DataKeys[e.Row.RowIndex].Value)) { int cid = Convert.ToInt32(gvSale.DataKeys[e.Row.RowIndex].Value); ProjectCreateInfo pc = new ProjectCreateInfo(cid); if (pc.State != 1) { Button btnSubmit = e.Row.FindControl("btnSubmit") as Button; btnSubmit.Enabled = false; } Label lblState = e.Row.FindControl("lblState") as Label; switch (pc.State) { case 0: lblState.Text = "未提交"; break; case 1: lblState.Text = "待部门领导审批"; break; case 2: lblState.Text = "部门:修正"; break; case 3: lblState.Text = "待总经理审批"; break; case 4: lblState.Text = "通过"; break; case 5: lblState.Text = "总经理:修正"; break; case 6: lblState.Text = "待技术部审批"; break; case 7: lblState.Text = "技术部修正"; break; default: lblState.Text = "其他状态"; break; } } } }
public ProjectCreateInfo GetProjectCreateInfoById(int ProjectCreateId) { ProjectCreateInfo projectCreateInfo = null;// try { projectCreateInfo = new ProjectCreateInfo(ProjectCreateId); } catch (AppException) { return null; } return projectCreateInfo; }
public ProjectCreateInfo GetProjectCreateInfoById(int ProjectCreateId) { ProjectCreateInfo projectCreateInfo = null; // try { projectCreateInfo = new ProjectCreateInfo(ProjectCreateId); } catch (AppException) { return(null); } return(projectCreateInfo); }
protected void btnSubmit_Click(object sender, EventArgs e) { string strDepart = Session["DepartName"].ToString(); int fid = Convert.ToInt32(((Button)sender).CommandArgument.ToString()); ProjectCreateInfo pc = new ProjectCreateInfo(fid); pc.ApplyTime = DateTime.Now.ToString(); if (strDepart == "技术部") { pc.State = 3; } else { pc.State = 6; } pc.Save(); gvDataBind(); }
protected void btnSave_Click(object sender, EventArgs e) { if (IsPageValid()) { try { ProjectCreateInfo pc = new ProjectCreateInfo(); pc.ApplyName = Session["EmployeeName"].ToString(); pc.DepartName = Session["DepartName"].ToString(); pc.State = 0; pc.ApplyDate = txtApplyDate.Text.ToString(); pc.ApplyTime = ""; pc.ClientDescribe = txtClientDes.Text.ToString(); pc.CompitDescribe = txtCompitDes.Text.ToString(); pc.BusinessDescribe = txtBusinessDes.Text.ToString(); pc.NeedDescribe = txtNeedDes.Text.ToString(); pc.RiskDescribe = txtRiskDes.Text.ToString(); pc.StrategyDesribe = txtStrategyDes.Text.ToString(); pc.TechDescribe = txtTechDes.Text.ToString(); pc.CallbidPhaseExp = txtCallBidPhaseExp.Text.ToString(); pc.CarryPhaseExp = txtCarryPhaseExp.Text.ToString(); pc.CreatePhaseExp = txtCratePhaseExp.Text.ToString(); pc.ProposePhaseExp = txtProposePhaseExp.Text.ToString(); pc.TalkPhaseExp = txtTalkPhaseExp.Text.ToString(); pc.ClientId=Convert.ToInt32(ddlClient.SelectedValue); pc.MarketView = txtMarketView.Text.ToString(); pc.Memo = txtMemo.Text.ToString(); pc.PreMoney = txtPreMoney.Text.ToString(); pc.PreProfit = txtPreProfit.Text.ToString(); pc.ProjectLevelId = Convert.ToInt32(ddlProjectLevel.SelectedValue); pc.ProjectName = txtProjectName.Text.ToString(); pc.ProjectTypeId = Convert.ToInt32(ddlProjectType.SelectedValue); pc.SheetNum = lblProjectNum.Text.ToString(); pc.TechView = txtTechView.Text.ToString(); pc.Today = DateTime.Now.ToString("yyyyMMdd").Substring(2); pc.YeWuId = Convert.ToInt32(ddlYewu.SelectedValue); pc.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('��ӳɹ���');</script>"); } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('���ʧ�ܣ�" + Ex.Message + "');", true); } } }
protected void btnSave_Click(object sender, EventArgs e) { if (rblOver.SelectedIndex == -1) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('请选择修正或通过!');</script>"); } else { try { int cid = Convert.ToInt32(Request["ProjectCreateId"].ToString()); ProjectCreateInfo pc = new ProjectCreateInfo(cid); pc.ManagerView = txtManagerView.Text.ToString(); if (rblOver.Items[0].Selected) { pc.State =5; pc.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('您让申请人修正!');</script>"); } else if (rblOver.Items[1].Selected) { pc.State = 4; pc.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('审批通过!');</script>"); MainProjectCreateInfo p = new MainProjectCreateInfo(); p.ClientId = Convert.ToInt32(pc.ClientId); p.PreMoney = pc.PreMoney.ToString(); p.PreProfit = pc.PreProfit.ToString(); p.ProjectLevelId = Convert.ToInt32(pc.ProjectLevelId); p.ProjectName = pc.ProjectName.ToString(); p.ProjectTypeId = Convert.ToInt32(pc.ProjectTypeId); p.SheetNum = pc.SheetNum.ToString(); p.YeWuId = Convert.ToInt32(pc.YeWuId); p.Save(); } } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('保存失败:" + Ex.Message + "');", true); } } }
private void LoadFromId(int projectCreateId) { if (CachedEntityCommander.IsTypeRegistered(typeof(ProjectCreateInfo))) { ProjectCreateInfo projectCreateInfo = Find(GetList(), projectCreateId); if (projectCreateInfo == null) { throw new AppException("未能在缓存中找到相应的键值对象"); } Copy(projectCreateInfo, this); } else { ProjectCreate projectCreate = new ProjectCreate(projectCreateId); if (projectCreate.IsNew) { throw new AppException("尚未初始化"); } LoadFromDAL(this, projectCreate); } }
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(); }
protected void ProjectCreateBind() { int wkid = Convert.ToInt32(Request["ProjectCreateId"].ToString()); ProjectCreateInfo pc = new ProjectCreateInfo(wkid); ddlClient.SelectedValue = pc.ClientId.ToString(); ddlYewu.SelectedValue = pc.YeWuId.ToString(); ddlProjectType.SelectedValue = pc.ProjectTypeId.ToString(); ddlProjectLevel.SelectedValue = pc.ProjectLevelId.ToString(); lblApplyName.Text = pc.ApplyName.ToString(); lblApplyDepart.Text = pc.DepartName.ToString(); lblProjectNum.Text = pc.SheetNum.ToString(); txtProjectName.Text = pc.ProjectName.ToString(); txtPreMoney.Text = pc.PreMoney.ToString(); txtPreProfit.Text = pc.PreProfit.ToString(); txtSheetNum.Text = pc.SheetNum.ToString(); txtApplyDate.Text = pc.ApplyDate.ToString(); txtBusinessDes.Text = pc.BusinessDescribe.ToString(); txtCallBidPhaseExp.Text = pc.CallbidPhaseExp.ToString(); txtCarryPhaseExp.Text = pc.CarryPhaseExp.ToString(); txtClientDes.Text = pc.ClientDescribe.ToString(); txtCompitDes.Text = pc.CompitDescribe.ToString(); txtCratePhaseExp.Text = pc.CreatePhaseExp.ToString(); txtManagerView.Text = pc.ManagerView.ToString(); txtMarketView.Text = pc.MarketView.ToString(); txtMemo.Text = pc.Memo.ToString(); txtNeedDes.Text = pc.NeedDescribe.ToString(); txtProposePhaseExp.Text = pc.ProposePhaseExp.ToString(); txtRiskDes.Text = pc.RiskDescribe.ToString(); txtStrategyDes.Text = pc.StrategyDesribe.ToString(); txtTalkPhaseExp.Text = pc.TalkPhaseExp.ToString(); txtTechDes.Text = pc.TechDescribe.ToString(); txtTechView.Text = pc.TechView.ToString(); }
public object SaveProjectCreateInfo(ProjectCreateInfo projectCreateInfo) { projectCreateInfo.Save(); return(projectCreateInfo.ProjectCreateId); }
public List <ProjectCreateInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount) { return(ProjectCreateInfo.GetPagedList(pPageIndex, pPageSize, pOrderBy, pSortExpression, out pRecordCount)); }
public List <ProjectCreateInfo> GetProjectCreateInfoList() { return(ProjectCreateInfo.GetList()); }
/// <summary> /// 批量装载 /// </summary> internal static void LoadFromDALPatch(List< ProjectCreateInfo> pList, ProjectCreateCollection pCollection) { foreach (ProjectCreate projectCreate in pCollection) { ProjectCreateInfo projectCreateInfo = new ProjectCreateInfo(); LoadFromDAL(projectCreateInfo, projectCreate ); pList.Add(projectCreateInfo); } }
//从后台获取数据 internal static void LoadFromDAL(ProjectCreateInfo pProjectCreateInfo, ProjectCreate pProjectCreate) { pProjectCreateInfo.projectCreateId = pProjectCreate.ProjectCreateId; pProjectCreateInfo.clientId = pProjectCreate.ClientId; pProjectCreateInfo.projectLevelId = pProjectCreate.ProjectLevelId; pProjectCreateInfo.projectTypeId = pProjectCreate.ProjectTypeId; pProjectCreateInfo.yeWuId = pProjectCreate.YeWuId; pProjectCreateInfo.projectName = pProjectCreate.ProjectName; pProjectCreateInfo.preMoney = pProjectCreate.PreMoney; pProjectCreateInfo.preProfit = pProjectCreate.PreProfit; pProjectCreateInfo.applyDate = pProjectCreate.ApplyDate; pProjectCreateInfo.createPhaseExp = pProjectCreate.CreatePhaseExp; pProjectCreateInfo.proposePhaseExp = pProjectCreate.ProposePhaseExp; pProjectCreateInfo.callbidPhaseExp = pProjectCreate.CallbidPhaseExp; pProjectCreateInfo.talkPhaseExp = pProjectCreate.TalkPhaseExp; pProjectCreateInfo.carryPhaseExp = pProjectCreate.CarryPhaseExp; pProjectCreateInfo.needDescribe = pProjectCreate.NeedDescribe; pProjectCreateInfo.compitDescribe = pProjectCreate.CompitDescribe; pProjectCreateInfo.clientDescribe = pProjectCreate.ClientDescribe; pProjectCreateInfo.techDescribe = pProjectCreate.TechDescribe; pProjectCreateInfo.businessDescribe = pProjectCreate.BusinessDescribe; pProjectCreateInfo.riskDescribe = pProjectCreate.RiskDescribe; pProjectCreateInfo.strategyDesribe = pProjectCreate.StrategyDesribe; pProjectCreateInfo.memo = pProjectCreate.Memo; pProjectCreateInfo.marketView = pProjectCreate.MarketView; pProjectCreateInfo.techView = pProjectCreate.TechView; pProjectCreateInfo.managerView = pProjectCreate.ManagerView; pProjectCreateInfo.sheetNum = pProjectCreate.SheetNum; pProjectCreateInfo.today = pProjectCreate.Today; pProjectCreateInfo.applyName = pProjectCreate.ApplyName; pProjectCreateInfo.departName = pProjectCreate.DepartName; pProjectCreateInfo.state = pProjectCreate.State; pProjectCreateInfo.applyTime = pProjectCreate.ApplyTime; pProjectCreateInfo.Loaded=true; }
//数据持久化 internal static void SaveToDb(ProjectCreateInfo pProjectCreateInfo, ProjectCreate pProjectCreate,bool pIsNew) { pProjectCreate.ProjectCreateId = pProjectCreateInfo.projectCreateId; pProjectCreate.ClientId = pProjectCreateInfo.clientId; pProjectCreate.ProjectLevelId = pProjectCreateInfo.projectLevelId; pProjectCreate.ProjectTypeId = pProjectCreateInfo.projectTypeId; pProjectCreate.YeWuId = pProjectCreateInfo.yeWuId; pProjectCreate.ProjectName = pProjectCreateInfo.projectName; pProjectCreate.PreMoney = pProjectCreateInfo.preMoney; pProjectCreate.PreProfit = pProjectCreateInfo.preProfit; pProjectCreate.ApplyDate = pProjectCreateInfo.applyDate; pProjectCreate.CreatePhaseExp = pProjectCreateInfo.createPhaseExp; pProjectCreate.ProposePhaseExp = pProjectCreateInfo.proposePhaseExp; pProjectCreate.CallbidPhaseExp = pProjectCreateInfo.callbidPhaseExp; pProjectCreate.TalkPhaseExp = pProjectCreateInfo.talkPhaseExp; pProjectCreate.CarryPhaseExp = pProjectCreateInfo.carryPhaseExp; pProjectCreate.NeedDescribe = pProjectCreateInfo.needDescribe; pProjectCreate.CompitDescribe = pProjectCreateInfo.compitDescribe; pProjectCreate.ClientDescribe = pProjectCreateInfo.clientDescribe; pProjectCreate.TechDescribe = pProjectCreateInfo.techDescribe; pProjectCreate.BusinessDescribe = pProjectCreateInfo.businessDescribe; pProjectCreate.RiskDescribe = pProjectCreateInfo.riskDescribe; pProjectCreate.StrategyDesribe = pProjectCreateInfo.strategyDesribe; pProjectCreate.Memo = pProjectCreateInfo.memo; pProjectCreate.MarketView = pProjectCreateInfo.marketView; pProjectCreate.TechView = pProjectCreateInfo.techView; pProjectCreate.ManagerView = pProjectCreateInfo.managerView; pProjectCreate.SheetNum = pProjectCreateInfo.sheetNum; pProjectCreate.Today = pProjectCreateInfo.today; pProjectCreate.ApplyName = pProjectCreateInfo.applyName; pProjectCreate.DepartName = pProjectCreateInfo.departName; pProjectCreate.State = pProjectCreateInfo.state; pProjectCreate.ApplyTime = pProjectCreateInfo.applyTime; pProjectCreate.IsNew=pIsNew; string UserName = SubsonicHelper.GetUserName(); try { pProjectCreate.Save(UserName); } catch(Exception ex) { LogManager.getInstance().getLogger(typeof(ProjectCreateInfo)).Error(ex); if(ex.Message.Contains("插入重复键"))//违反了唯一键 { throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示 } throw new AppException("保存失败"); } pProjectCreateInfo.projectCreateId = pProjectCreate.ProjectCreateId; //如果缓存存在,更新缓存 if (CachedEntityCommander.IsTypeRegistered(typeof(ProjectCreateInfo))) { ResetCache(); } }
/// <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<ProjectCreateInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount) { if(pPageIndex<=1) pPageIndex=1; List< ProjectCreateInfo> list = new List< ProjectCreateInfo>(); Query q = ProjectCreate .CreateQuery(); q.PageIndex = pPageIndex; q.PageSize = pPageSize; q.ORDER_BY(pSortExpression,pOrderBy.ToString()); ProjectCreateCollection collection=new ProjectCreateCollection(); collection.LoadAndCloseReader(q.ExecuteReader()); foreach (ProjectCreate projectCreate in collection) { ProjectCreateInfo projectCreateInfo = new ProjectCreateInfo(); LoadFromDAL(projectCreateInfo, projectCreate); list.Add(projectCreateInfo); } pRecordCount=q.GetRecordCount(); return list; }
/// <summary> /// 获得数据列表 /// </summary> /// <returns></returns> public static List<ProjectCreateInfo> GetList() { string cacheKey = GetCacheKey(); //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取 if (CachedEntityCommander.IsTypeRegistered(typeof(ProjectCreateInfo)) && CachedEntityCommander.GetCache(cacheKey) != null) { return CachedEntityCommander.GetCache(cacheKey) as List< ProjectCreateInfo>; } else { List< ProjectCreateInfo> list =new List< ProjectCreateInfo>(); ProjectCreateCollection collection=new ProjectCreateCollection(); Query qry = new Query(ProjectCreate.Schema); collection.LoadAndCloseReader(qry.ExecuteReader()); foreach(ProjectCreate projectCreate in collection) { ProjectCreateInfo projectCreateInfo= new ProjectCreateInfo(); LoadFromDAL(projectCreateInfo,projectCreate); list.Add(projectCreateInfo); } //生成缓存 if (CachedEntityCommander.IsTypeRegistered(typeof(ProjectCreateInfo))) { CachedEntityCommander.SetCache(cacheKey, list); } return list; } }
/// <summary> /// 复制一个对象,采用硬编码的方式,避免反射的低效 /// </summary> /// <param name="pIndustryTypeInfoFrom"></param> /// <param name="pIndustryTypeInfoTo"></param> public static void Copy(ProjectCreateInfo pProjectCreateInfoFrom, ProjectCreateInfo pProjectCreateInfoTo) { pProjectCreateInfoTo.ProjectCreateId = pProjectCreateInfoFrom.projectCreateId; pProjectCreateInfoTo.ClientId = pProjectCreateInfoFrom.clientId; pProjectCreateInfoTo.ProjectLevelId = pProjectCreateInfoFrom.projectLevelId; pProjectCreateInfoTo.ProjectTypeId = pProjectCreateInfoFrom.projectTypeId; pProjectCreateInfoTo.YeWuId = pProjectCreateInfoFrom.yeWuId; pProjectCreateInfoTo.ProjectName = pProjectCreateInfoFrom.projectName; pProjectCreateInfoTo.PreMoney = pProjectCreateInfoFrom.preMoney; pProjectCreateInfoTo.PreProfit = pProjectCreateInfoFrom.preProfit; pProjectCreateInfoTo.ApplyDate = pProjectCreateInfoFrom.applyDate; pProjectCreateInfoTo.CreatePhaseExp = pProjectCreateInfoFrom.createPhaseExp; pProjectCreateInfoTo.ProposePhaseExp = pProjectCreateInfoFrom.proposePhaseExp; pProjectCreateInfoTo.CallbidPhaseExp = pProjectCreateInfoFrom.callbidPhaseExp; pProjectCreateInfoTo.TalkPhaseExp = pProjectCreateInfoFrom.talkPhaseExp; pProjectCreateInfoTo.CarryPhaseExp = pProjectCreateInfoFrom.carryPhaseExp; pProjectCreateInfoTo.NeedDescribe = pProjectCreateInfoFrom.needDescribe; pProjectCreateInfoTo.CompitDescribe = pProjectCreateInfoFrom.compitDescribe; pProjectCreateInfoTo.ClientDescribe = pProjectCreateInfoFrom.clientDescribe; pProjectCreateInfoTo.TechDescribe = pProjectCreateInfoFrom.techDescribe; pProjectCreateInfoTo.BusinessDescribe = pProjectCreateInfoFrom.businessDescribe; pProjectCreateInfoTo.RiskDescribe = pProjectCreateInfoFrom.riskDescribe; pProjectCreateInfoTo.StrategyDesribe = pProjectCreateInfoFrom.strategyDesribe; pProjectCreateInfoTo.Memo = pProjectCreateInfoFrom.memo; pProjectCreateInfoTo.MarketView = pProjectCreateInfoFrom.marketView; pProjectCreateInfoTo.TechView = pProjectCreateInfoFrom.techView; pProjectCreateInfoTo.ManagerView = pProjectCreateInfoFrom.managerView; pProjectCreateInfoTo.SheetNum = pProjectCreateInfoFrom.sheetNum; pProjectCreateInfoTo.Today = pProjectCreateInfoFrom.today; pProjectCreateInfoTo.ApplyName = pProjectCreateInfoFrom.applyName; pProjectCreateInfoTo.DepartName = pProjectCreateInfoFrom.departName; pProjectCreateInfoTo.State = pProjectCreateInfoFrom.state; pProjectCreateInfoTo.ApplyTime = pProjectCreateInfoFrom.applyTime; pProjectCreateInfoTo.Loaded=pProjectCreateInfoFrom.Loaded; }
/// <summary> /// 复制为另一个对象 /// </summary> /// <param name="pIndustryTypeInfoTo"></param> public void CopyTo(ProjectCreateInfo pProjectCreateInfoTo) { Copy(this, pProjectCreateInfoTo); }
public void DeleteById(ProjectCreateInfo pProjectCreateInfo) { ProjectCreateInfo projectCreateInfo = new ProjectCreateInfo(pProjectCreateInfo.ProjectCreateId); projectCreateInfo.Delete(); }
public object SaveProjectCreateInfo(ProjectCreateInfo projectCreateInfo) { projectCreateInfo.Save(); return projectCreateInfo . ProjectCreateId; }