public static long InsertWorks(ContestDll.Works dr) { using (ContestEntities db = new ContestEntities()) { ContestDll.Works file = new ContestDll.Works(); file.AllotTimes = dr.AllotTimes; file.BackReason = dr.BackReason; file.Comment = dr.Comment; file.Created = dr.Created; file.CreatedBy = dr.CreatedBy; file.DemoURL = dr.DemoURL; file.DesignIdeas = dr.DesignIdeas; file.Flag = dr.Flag; file.InstallationGuide = dr.InstallationGuide; file.IsSample = dr.IsSample; file.KeyPoints = dr.KeyPoints; file.Score = dr.Score; file.WorksCode = dr.WorksCode; file.WorksName = dr.WorksName; file.WorksState = dr.WorksState; file.WorksTypeID = dr.WorksTypeID; file.PeriodID = dr.PeriodID; file.SubmitProfile = dr.SubmitProfile; file.DemoURL = dr.DemoURL; file.DesignIdeas = dr.DesignIdeas; file.KeyPoints = dr.KeyPoints; file.Score = dr.Score; file.Flag = dr.Flag; db.Works.Add(file); db.SaveChanges(); return(file.WorksID); } }
public static long InsertPeriods(ContestDll.Periods dr) { using (ContestEntities db = new ContestEntities()) { ContestDll.Periods pd = new ContestDll.Periods(); pd.Flag = dr.Flag; pd.CourseID = dr.CourseID; pd.Created = dr.Created; pd.CreatedBy = dr.CreatedBy; pd.EndPublic = dr.EndPublic; pd.EndScore = dr.EndScore; pd.EndSubmit = dr.EndSubmit; pd.Modified = dr.Modified; pd.ModifiedBy = dr.ModifiedBy; pd.Number = dr.Number; pd.PeriodStandard = dr.PeriodStandard; pd.PeriodTitle = dr.PeriodTitle; pd.Require = dr.Require; pd.StartPublic = dr.StartPublic; pd.StartScore = dr.StartScore; pd.StartSubmit = dr.StartSubmit; pd.WorksTypeID = dr.WorksTypeID; db.Periods.Add(pd); db.SaveChanges(); return(pd.PeriodID);; } }
public static long UpdateWorksSubmit(ContestEntities db, CSWorksWorksType dr) { ContestDll.Works works = db.Works.SingleOrDefault(p => p.WorksID == dr.WorksID); works.WorksState = dr.WorksState; works.Score = dr.Score; db.SaveChanges(); return(1); }
public static long UpdateRatingDetails(ContestEntities db, RatingDetails dr) { RatingDetails dr1 = db.RatingDetails.SingleOrDefault(p => p.RatingDetailsID == dr.RatingDetailsID); dr1.Score = dr.Score; dr1.Flag = dr.Flag; db.SaveChanges(); return(1); }
// public static long UpdateWorksCode(ContestDll.Works dr) { using (ContestEntities db = new ContestEntities()) { ContestDll.Works file = db.Works.SingleOrDefault(p => p.WorksID == dr.WorksID); file.WorksCode = dr.WorksCode; db.SaveChanges(); return(1); } }
public static long DelPeriodsByID(ContestDll.Periods dr, long editorId, DateTime ediTime) { using (ContestEntities db = new ContestEntities()) { ContestDll.Periods pd = db.Periods.SingleOrDefault(p => p.PeriodID == dr.PeriodID); pd.ModifiedBy = editorId; pd.Modified = ediTime; pd.Flag = 0; db.SaveChanges(); return(1); } }
public static long UpdateWorksTypeScoreStandard(CSWorksTypeScoreStandard dr) { using (ContestEntities db = new ContestEntities()) { WorksTypeScoreStandard wtSS = db.WorksTypeScoreStandard.SingleOrDefault(p => p.StandardID == dr.StandardID); wtSS.Score = dr.Score; wtSS.StandardDescription = dr.StandardDescription; wtSS.WorkTypeID = dr.WorkTypeID; db.SaveChanges(); return(1); } }
public static long InsertWorksExpert(ContestEntities db, WorksExpert dr) { WorksExpert dr1 = new WorksExpert(); dr1.WorksID = dr.WorksID; dr1.ExpertID = dr.ExpertID; dr1.Score = dr.Score; dr1.Flag = 1; db.WorksExpert.Add(dr1); db.SaveChanges(); return(dr1.WorksExpertID); }
public static long UpdateWorksFileForSize(WorksFile dr) { using (ContestEntities db = new ContestEntities()) { WorksFile file = db.WorksFile.SingleOrDefault(p => p.WorksFileID == dr.WorksFileID); file.FileSize = dr.FileSize; file.Modified = dr.Modified; file.ModifiedBy = dr.ModifiedBy; db.SaveChanges(); return(1); } }
/// <summary> /// 作品评分明细 /// </summary> /// <param name="dr"></param> /// <returns></returns> public static long InsertRatingDetails(ContestEntities db, RatingDetails dr) { RatingDetails dr1 = new RatingDetails(); dr1.WorksExpertID = dr.WorksExpertID; dr1.StandardID = dr.StandardID; dr1.Score = dr.Score; dr1.Flag = 1; db.RatingDetails.Add(dr1); db.SaveChanges(); return(dr1.RatingDetailsID); }
public static long UpdateWorksExpert(ContestEntities db, WorksExpert dr) { WorksExpert dr1 = db.WorksExpert.SingleOrDefault(p => p.WorksExpertID == dr.WorksExpertID); dr1.WorksID = dr.WorksID; dr1.ExpertID = dr.ExpertID; dr1.Score = dr.Score; dr1.Comments = dr.Comments; dr1.Modified = dr.Modified; dr1.Flag = dr.Flag; db.SaveChanges(); return(1); }
public static long UpdateUserWorks(UserWorks dr) { using (ContestEntities db = new ContestEntities()) { UserWorks file = db.UserWorks.SingleOrDefault(p => p.UserWorksID == dr.UserWorksID); file.Flag = dr.Flag; file.Relationship = dr.Relationship; file.UserID = dr.UserID; file.WorksID = dr.WorksID; db.SaveChanges(); return(1); } }
/// <summary> /// 加入新记录 /// </summary> /// <param name="dr"></param> /// <returns></returns> public static long InsertWorksComments(CSWorksExpertUser dr) { using (ContestEntities db = new ContestEntities()) { WorksComments dr1 = new WorksComments(); dr1.WorksID = dr.WorksID; dr1.UserID = dr.ExpertID; dr1.Flag = 1; db.WorksComments.Add(dr1); db.SaveChanges(); return(dr1.CommentsID); } }
public static long InsertWorksExpert(ContestEntities db, WorksExpert dr) { ContestDll.WorksExpert at = new WorksExpert(); at.Comments = dr.Comments; at.Created = dr.Created; at.ExpertID = dr.ExpertID; at.Flag = 1; at.Score = dr.Score; at.ScoreState = dr.ScoreState; at.WorksID = dr.WorksID; db.WorksExpert.Add(at); db.SaveChanges(); return(at.WorksExpertID); }
public static long InsertUserWorks(UserWorks dr) { using (ContestEntities db = new ContestEntities()) { UserWorks file = new UserWorks(); file.Flag = dr.Flag; file.Relationship = dr.Relationship; file.UserID = dr.UserID; file.WorksID = dr.WorksID; db.UserWorks.Add(file); db.SaveChanges(); return(file.UserWorksID); } }
/// <summary> /// 无返回ID /// </summary> /// <param name="dr"></param> /// <returns></returns> public static int InsertWorksTypeScoreStandard(CSWorksTypeScoreStandard dr) { using (ContestEntities db = new ContestEntities()) { WorksTypeScoreStandard wtSS = new WorksTypeScoreStandard(); wtSS.StandardID = dr.StandardID; wtSS.Score = dr.Score; wtSS.StandardDescription = dr.StandardDescription; wtSS.WorkTypeID = dr.WorkTypeID; db.WorksTypeScoreStandard.Add(wtSS); db.SaveChanges(); return(1); } }
public static int UpdateUserRole(ContestEntities db, UserRole dr) { UserRole at = db.UserRole.SingleOrDefault(p => p.UserRoleID == dr.UserRoleID); at.UserID = dr.UserID; at.RoleID = dr.RoleID; at.Flag = dr.Flag; at.Approved = DateTime.Now; at.ApprovedBy = at.ApprovedBy; at.StateID = dr.StateID; at.Created = DateTime.Now; db.SaveChanges(); return(1); }
public static long InsertUserRole(ContestEntities db, UserRole dr) { UserRole at = new UserRole(); at.UserID = dr.UserID; at.RoleID = dr.RoleID; at.StateID = dr.StateID; at.Flag = dr.Flag; at.Created = DateTime.Now; at.CreatedBy = dr.CreatedBy; at.Approved = DateTime.Now; at.ApprovedBy = at.ApprovedBy; at.ContestID = dr.ContestID; db.UserRole.Add(at); db.SaveChanges(); return(at.UserRoleID); }
public static long InsertWorksImages(WorksFile dr) { using (ContestEntities db = new ContestEntities()) { WorksFile file = new WorksFile(); file.WorksID = dr.WorksID; file.Type = dr.Type; file.FileName = dr.FileName; file.FilePath = dr.FilePath; file.FileSize = dr.FileSize; file.Created = dr.Created; file.CreatedBy = dr.CreatedBy; db.WorksFile.Add(file); db.SaveChanges(); return(file.WorksFileID); } }
/// <summary> /// 作品评分明细 /// </summary> /// <param name="dr"></param> /// <returns></returns> public static long InsertPeriodStandard(PeriodStandard dr) { using (ContestEntities db = new ContestEntities()) { PeriodStandard pS = new PeriodStandard(); pS.WorkTypeID = dr.WorkTypeID; pS.PeriodID = dr.PeriodID; pS.Score = dr.Score; pS.StandardDescription = dr.StandardDescription; pS.StandardID = dr.StandardID; pS.Created = dr.Created; pS.CreatedBy = dr.CreatedBy; pS.Flag = dr.Flag; db.PeriodStandard.Add(pS); db.SaveChanges(); return(1); } }
/// <summary> /// 更新期次标准 /// </summary> /// <param name="dr"></param> /// <returns></returns> public static long UpdatePeriodStandard(CSPeriodScoreStandard dr) { using (ContestEntities db = new ContestEntities()) { PeriodStandard loginUser = db.PeriodStandard.Where(p => p.WorkTypeID == dr.WorkTypeID && p.PeriodID == dr.PeriodID && p.StandardID == dr.StandardID).SingleOrDefault(); if (loginUser != null) { loginUser.StandardDescription = dr.StandardDescription; loginUser.Score = dr.Score; loginUser.Modified = dr.Modified; loginUser.ModifiedBy = dr.ModifiedBy; loginUser.Flag = dr.Flag; db.SaveChanges(); return(1); } return(0); } }
public static long UpdatePeriodsByID(ContestDll.Periods dr) { using (ContestEntities db = new ContestEntities()) { ContestDll.Periods pd = db.Periods.SingleOrDefault(p => p.PeriodID == dr.PeriodID); pd.Modified = dr.Modified; pd.ModifiedBy = dr.ModifiedBy; pd.Number = dr.Number; pd.PeriodStandard = dr.PeriodStandard; pd.PeriodTitle = dr.PeriodTitle; pd.Require = dr.Require; pd.StartPublic = dr.StartPublic; pd.StartScore = dr.StartScore; pd.StartSubmit = dr.StartSubmit; pd.WorksTypeID = dr.WorksTypeID; db.SaveChanges(); } return(1); }
public static long InsertUser(ContestEntities db, ContestDll.User dr) { ContestDll.User at = new ContestDll.User(); at.Account = dr.Account; at.Department = dr.Department; at.Duty = dr.Duty; at.Email = dr.Email; at.Department = dr.Department; at.Telephone = dr.Telephone; at.IDCard = dr.IDCard; at.Name = dr.Name; at.SchoolID = dr.SchoolID; at.Major = dr.Major; at.RoleID = dr.RoleID; at.Sex = dr.Sex; at.StateID = dr.StateID; at.Created = DateTime.Now; db.User.Add(at); db.SaveChanges(); return(at.UserID); }
public static long UpdateWorksInfo(ContestDll.Works dr) { using (ContestEntities db = new ContestEntities()) { ContestDll.Works file = db.Works.SingleOrDefault(p => p.WorksID == dr.WorksID); file.WorksName = dr.WorksName; file.WorksTypeID = dr.WorksTypeID; file.WorksCode = dr.WorksCode; file.PeriodID = dr.PeriodID; file.SubmitProfile = dr.SubmitProfile; file.DesignIdeas = dr.DesignIdeas; file.KeyPoints = dr.KeyPoints; file.DemoURL = dr.DemoURL; file.Created = dr.Created; file.CreatedBy = dr.CreatedBy; file.WorksState = dr.WorksState; file.Score = dr.Score; file.Flag = dr.Flag; db.SaveChanges(); return(1); } }
public static int UpdateUser(ContestDll.User dr) { using (ContestEntities db = new ContestEntities()) { ContestDll.User at = db.User.SingleOrDefault(p => p.UserID == dr.UserID); at.Account = dr.Account; at.Department = dr.Department; at.Duty = dr.Duty; at.Email = dr.Email; at.Department = dr.Department; at.Telephone = dr.Telephone; at.IDCard = dr.IDCard; at.Name = dr.Name; at.SchoolID = dr.SchoolID; at.Major = dr.Major; at.RoleID = dr.RoleID; at.Sex = dr.Sex; at.StateID = dr.StateID; at.Created = DateTime.Now; db.SaveChanges(); return(1); } }
public static long SampleScore(long worksExpertID, long worksID, long expertID, SortedList <int, int> scoreDeltails, string txtPingYu) { ContestEntities db = new ContestEntities(); using (TransactionScope scope = new TransactionScope()) { try { float scores = 0; for (int i = 0; i < scoreDeltails.Count; i++) { int standardID = scoreDeltails.Keys[i]; scores += scoreDeltails[standardID]; } long flag = GetScoreResult(worksID, scores); List <WorksExpert> ds = DAL.Works.GetWorksExpertByID(worksExpertID); WorksExpert drWorksExpert; if (ds.Count > 0) { drWorksExpert = ds[0]; } else { drWorksExpert = new WorksExpert(); drWorksExpert.WorksID = worksID; drWorksExpert.ExpertID = expertID; } drWorksExpert.Comments = txtPingYu; drWorksExpert.Score = scores; drWorksExpert.Flag = flag;//样式作品评价训练通过 if (worksExpertID == 0) { drWorksExpert.Created = DateTime.Now; worksExpertID = DAL.User.InsertWorksExpert(db, drWorksExpert); } else { drWorksExpert.Modified = DateTime.Now; DAL.Works.UpdateWorksExpert(drWorksExpert); } List <RatingDetails> dtDetail = DAL.Works.GetRatingDetailsByWorksExpertID(worksExpertID); for (int i = 0; i < scoreDeltails.Count; i++) { int standardID = scoreDeltails.Keys[i]; RatingDetails dr; List <RatingDetails> drs; drs = dtDetail.Where(p => p.StandardID == standardID).ToList();// ("StandardID=" + standardID); if (drs.Count > 0) { dr = drs[0]; } else { dr = new RatingDetails(); dr.WorksExpertID = worksExpertID; dr.StandardID = standardID; dr.Flag = 1; } dr.Score = scoreDeltails[standardID]; if (drs.Count == 0) { DAL.Works.InsertRatingDetails(db, dr); } else { DAL.Works.UpdateRatingDetails(db, dr); } } ////执行多个操作 //var user1 = new User //{ // Name = "bomo", // Age = 21, // Gender = "male" //}; //db.User.Add(user1); //db.SaveChanges(); //var user2 = new User //{ // Name = "toroto", // Age = 20, // Gender = "female" //}; //db.User.Add(user2); db.SaveChanges(); //提交事务 scope.Complete(); return(flag); } catch (Exception ex) { scope.Dispose(); return(0); } } }