public static void DelFsScore(int Id) { FrontScore.Delete(Id); }
private void LoadFromId(int frontScoreId) { if (CachedEntityCommander.IsTypeRegistered(typeof(FrontScoreInfo))) { FrontScoreInfo frontScoreInfo=Find(GetList(), frontScoreId); if(frontScoreInfo==null) throw new AppException("未能在缓存中找到相应的键值对象"); Copy(frontScoreInfo, this); } else { FrontScore frontScore=new FrontScore( frontScoreId); if(frontScore.IsNew) throw new AppException("尚未初始化"); LoadFromDAL(this, frontScore); } }
//从后台获取数据 internal static void LoadFromDAL(FrontScoreInfo pFrontScoreInfo, FrontScore pFrontScore) { pFrontScoreInfo.frontScoreId = pFrontScore.FrontScoreId; pFrontScoreInfo.dateSpan = pFrontScore.DateSpan; pFrontScoreInfo.evaluateLevelId = pFrontScore.EvaluateLevelId; pFrontScoreInfo.totalScore = pFrontScore.TotalScore; pFrontScoreInfo.upViews = pFrontScore.UpViews; pFrontScoreInfo.yearId = pFrontScore.YearId; pFrontScoreInfo.monthId = pFrontScore.MonthId; pFrontScoreInfo.employeeId = pFrontScore.EmployeeId; pFrontScoreInfo.isSubmit = pFrontScore.IsSubmit; pFrontScoreInfo.selffs1 = pFrontScore.Selffs1; pFrontScoreInfo.selffs2 = pFrontScore.Selffs2; pFrontScoreInfo.selffs3 = pFrontScore.Selffs3; pFrontScoreInfo.selffs4 = pFrontScore.Selffs4; pFrontScoreInfo.selffs5 = pFrontScore.Selffs5; pFrontScoreInfo.selffs6 = pFrontScore.Selffs6; pFrontScoreInfo.selffs7 = pFrontScore.Selffs7; pFrontScoreInfo.selffs8 = pFrontScore.Selffs8; pFrontScoreInfo.selffs9 = pFrontScore.Selffs9; pFrontScoreInfo.selffs10 = pFrontScore.Selffs10; pFrontScoreInfo.selffs11 = pFrontScore.Selffs11; pFrontScoreInfo.selffs12 = pFrontScore.Selffs12; pFrontScoreInfo.selffs13 = pFrontScore.Selffs13; pFrontScoreInfo.selffs14 = pFrontScore.Selffs14; pFrontScoreInfo.selffs15 = pFrontScore.Selffs15; pFrontScoreInfo.selffs16 = pFrontScore.Selffs16; pFrontScoreInfo.selffs17 = pFrontScore.Selffs17; pFrontScoreInfo.selffs18 = pFrontScore.Selffs18; pFrontScoreInfo.selffs19 = pFrontScore.Selffs19; pFrontScoreInfo.selffs20 = pFrontScore.Selffs20; pFrontScoreInfo.selffs21 = pFrontScore.Selffs21; pFrontScoreInfo.upfs1 = pFrontScore.Upfs1; pFrontScoreInfo.upfs2 = pFrontScore.Upfs2; pFrontScoreInfo.upfs3 = pFrontScore.Upfs3; pFrontScoreInfo.upfs4 = pFrontScore.Upfs4; pFrontScoreInfo.upfs5 = pFrontScore.Upfs5; pFrontScoreInfo.upfs6 = pFrontScore.Upfs6; pFrontScoreInfo.upfs7 = pFrontScore.Upfs7; pFrontScoreInfo.upfs8 = pFrontScore.Upfs8; pFrontScoreInfo.upfs9 = pFrontScore.Upfs9; pFrontScoreInfo.upfs10 = pFrontScore.Upfs10; pFrontScoreInfo.upfs11 = pFrontScore.Upfs11; pFrontScoreInfo.upfs12 = pFrontScore.Upfs12; pFrontScoreInfo.upfs13 = pFrontScore.Upfs13; pFrontScoreInfo.upfs14 = pFrontScore.Upfs14; pFrontScoreInfo.upfs15 = pFrontScore.Upfs15; pFrontScoreInfo.upfs16 = pFrontScore.Upfs16; pFrontScoreInfo.upfs17 = pFrontScore.Upfs17; pFrontScoreInfo.upfs18 = pFrontScore.Upfs18; pFrontScoreInfo.upfs19 = pFrontScore.Upfs19; pFrontScoreInfo.upfs20 = pFrontScore.Upfs20; pFrontScoreInfo.upfs21 = pFrontScore.Upfs21; pFrontScoreInfo.secfs1 = pFrontScore.Secfs1; pFrontScoreInfo.secfs2 = pFrontScore.Secfs2; pFrontScoreInfo.secfs3 = pFrontScore.Secfs3; pFrontScoreInfo.secfs4 = pFrontScore.Secfs4; pFrontScoreInfo.secfs5 = pFrontScore.Secfs5; pFrontScoreInfo.secfs6 = pFrontScore.Secfs6; pFrontScoreInfo.secfs7 = pFrontScore.Secfs7; pFrontScoreInfo.secfs8 = pFrontScore.Secfs8; pFrontScoreInfo.secfs9 = pFrontScore.Secfs9; pFrontScoreInfo.secfs10 = pFrontScore.Secfs10; pFrontScoreInfo.secfs11 = pFrontScore.Secfs11; pFrontScoreInfo.secfs12 = pFrontScore.Secfs12; pFrontScoreInfo.secfs13 = pFrontScore.Secfs13; pFrontScoreInfo.secfs14 = pFrontScore.Secfs14; pFrontScoreInfo.secfs15 = pFrontScore.Secfs15; pFrontScoreInfo.secfs16 = pFrontScore.Secfs16; pFrontScoreInfo.secfs17 = pFrontScore.Secfs17; pFrontScoreInfo.secfs18 = pFrontScore.Secfs18; pFrontScoreInfo.secfs19 = pFrontScore.Secfs19; pFrontScoreInfo.secfs20 = pFrontScore.Secfs20; pFrontScoreInfo.secfs21 = pFrontScore.Secfs21; pFrontScoreInfo.Loaded=true; }
//数据持久化 internal static void SaveToDb(FrontScoreInfo pFrontScoreInfo, FrontScore pFrontScore,bool pIsNew) { pFrontScore.FrontScoreId = pFrontScoreInfo.frontScoreId; pFrontScore.DateSpan = pFrontScoreInfo.dateSpan; pFrontScore.EvaluateLevelId = pFrontScoreInfo.evaluateLevelId; pFrontScore.TotalScore = pFrontScoreInfo.totalScore; pFrontScore.UpViews = pFrontScoreInfo.upViews; pFrontScore.YearId = pFrontScoreInfo.yearId; pFrontScore.MonthId = pFrontScoreInfo.monthId; pFrontScore.EmployeeId = pFrontScoreInfo.employeeId; pFrontScore.IsSubmit = pFrontScoreInfo.isSubmit; pFrontScore.Selffs1 = pFrontScoreInfo.selffs1; pFrontScore.Selffs2 = pFrontScoreInfo.selffs2; pFrontScore.Selffs3 = pFrontScoreInfo.selffs3; pFrontScore.Selffs4 = pFrontScoreInfo.selffs4; pFrontScore.Selffs5 = pFrontScoreInfo.selffs5; pFrontScore.Selffs6 = pFrontScoreInfo.selffs6; pFrontScore.Selffs7 = pFrontScoreInfo.selffs7; pFrontScore.Selffs8 = pFrontScoreInfo.selffs8; pFrontScore.Selffs9 = pFrontScoreInfo.selffs9; pFrontScore.Selffs10 = pFrontScoreInfo.selffs10; pFrontScore.Selffs11 = pFrontScoreInfo.selffs11; pFrontScore.Selffs12 = pFrontScoreInfo.selffs12; pFrontScore.Selffs13 = pFrontScoreInfo.selffs13; pFrontScore.Selffs14 = pFrontScoreInfo.selffs14; pFrontScore.Selffs15 = pFrontScoreInfo.selffs15; pFrontScore.Selffs16 = pFrontScoreInfo.selffs16; pFrontScore.Selffs17 = pFrontScoreInfo.selffs17; pFrontScore.Selffs18 = pFrontScoreInfo.selffs18; pFrontScore.Selffs19 = pFrontScoreInfo.selffs19; pFrontScore.Selffs20 = pFrontScoreInfo.selffs20; pFrontScore.Selffs21 = pFrontScoreInfo.selffs21; pFrontScore.Upfs1 = pFrontScoreInfo.upfs1; pFrontScore.Upfs2 = pFrontScoreInfo.upfs2; pFrontScore.Upfs3 = pFrontScoreInfo.upfs3; pFrontScore.Upfs4 = pFrontScoreInfo.upfs4; pFrontScore.Upfs5 = pFrontScoreInfo.upfs5; pFrontScore.Upfs6 = pFrontScoreInfo.upfs6; pFrontScore.Upfs7 = pFrontScoreInfo.upfs7; pFrontScore.Upfs8 = pFrontScoreInfo.upfs8; pFrontScore.Upfs9 = pFrontScoreInfo.upfs9; pFrontScore.Upfs10 = pFrontScoreInfo.upfs10; pFrontScore.Upfs11 = pFrontScoreInfo.upfs11; pFrontScore.Upfs12 = pFrontScoreInfo.upfs12; pFrontScore.Upfs13 = pFrontScoreInfo.upfs13; pFrontScore.Upfs14 = pFrontScoreInfo.upfs14; pFrontScore.Upfs15 = pFrontScoreInfo.upfs15; pFrontScore.Upfs16 = pFrontScoreInfo.upfs16; pFrontScore.Upfs17 = pFrontScoreInfo.upfs17; pFrontScore.Upfs18 = pFrontScoreInfo.upfs18; pFrontScore.Upfs19 = pFrontScoreInfo.upfs19; pFrontScore.Upfs20 = pFrontScoreInfo.upfs20; pFrontScore.Upfs21 = pFrontScoreInfo.upfs21; pFrontScore.Secfs1 = pFrontScoreInfo.secfs1; pFrontScore.Secfs2 = pFrontScoreInfo.secfs2; pFrontScore.Secfs3 = pFrontScoreInfo.secfs3; pFrontScore.Secfs4 = pFrontScoreInfo.secfs4; pFrontScore.Secfs5 = pFrontScoreInfo.secfs5; pFrontScore.Secfs6 = pFrontScoreInfo.secfs6; pFrontScore.Secfs7 = pFrontScoreInfo.secfs7; pFrontScore.Secfs8 = pFrontScoreInfo.secfs8; pFrontScore.Secfs9 = pFrontScoreInfo.secfs9; pFrontScore.Secfs10 = pFrontScoreInfo.secfs10; pFrontScore.Secfs11 = pFrontScoreInfo.secfs11; pFrontScore.Secfs12 = pFrontScoreInfo.secfs12; pFrontScore.Secfs13 = pFrontScoreInfo.secfs13; pFrontScore.Secfs14 = pFrontScoreInfo.secfs14; pFrontScore.Secfs15 = pFrontScoreInfo.secfs15; pFrontScore.Secfs16 = pFrontScoreInfo.secfs16; pFrontScore.Secfs17 = pFrontScoreInfo.secfs17; pFrontScore.Secfs18 = pFrontScoreInfo.secfs18; pFrontScore.Secfs19 = pFrontScoreInfo.secfs19; pFrontScore.Secfs20 = pFrontScoreInfo.secfs20; pFrontScore.Secfs21 = pFrontScoreInfo.secfs21; pFrontScore.IsNew=pIsNew; string UserName = SubsonicHelper.GetUserName(); try { pFrontScore.Save(UserName); } catch(Exception ex) { LogManager.getInstance().getLogger(typeof(FrontScoreInfo)).Error(ex); if(ex.Message.Contains("插入重复键"))//违反了唯一键 { throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示 } throw new AppException("保存失败"); } pFrontScoreInfo.frontScoreId = pFrontScore.FrontScoreId; //如果缓存存在,更新缓存 if (CachedEntityCommander.IsTypeRegistered(typeof(FrontScoreInfo))) { ResetCache(); } }
/// <summary> /// 保存 /// </summary> public override void Save() { if(!m_Loaded)//新增 { FrontScore frontScore=new FrontScore(); SaveToDb(this, frontScore,true); } else//修改 { FrontScore frontScore=new FrontScore(frontScoreId); if(frontScore.IsNew) throw new AppException("该数据已经不存在了"); SaveToDb(this, frontScore,false); } }