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 ContestDll.Periods GetPeriodsByTitle(string periodsTitle) { using (ContestEntities db = new ContestEntities()) { ContestDll.Periods ps = db.Periods.FirstOrDefault(p => p.PeriodTitle == periodsTitle); return(ps); } }
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 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); }