public static void AddRecord(DateTime _date, Guid _userId, int _siteId, int _chartId) { PCMSofCCDataContext db = new PCMSofCCDataContext(); var newRecord = new Record { Date = _date.Date, UserId = _userId, SiteId = _siteId, ChartId = _chartId }; db.Record.InsertOnSubmit(newRecord); var entries = from belong in db.EntryBelongToChart where belong.ChartId == _chartId select belong.ScoreEntry; foreach (var entry in entries) { var newRecordEntry = new RecordEntry { Record = newRecord, ScoreEntry = entry, }; db.RecordEntry.InsertOnSubmit(newRecordEntry); } db.SubmitChanges(); }
public static void UpdateSite(int _siteId, Func<Site, Site> predict) { PCMSofCCDataContext db = new PCMSofCCDataContext(); Site site = db.Site.Single(x => x.Id == _siteId); site = predict(site); db.SubmitChanges(); }
public static IQueryable<ScoreChart> GetCharts() { PCMSofCCDataContext db = new PCMSofCCDataContext(); var q = from c in db.ScoreChart select c; return q; }
public static void UpdateTime(Guid _userId, WeekDay _flags, DateTime _date) { PCMSofCCDataContext db = new PCMSofCCDataContext(); var t = db.AvailableDay.Single(x => x.UserId == _userId); t.SubmitDate = _date; t.AvailableDayFlag = (int)_flags; db.SubmitChanges(); }
public static IQueryable<ScoreEntry> GetAllEntries() { PCMSofCCDataContext db = new PCMSofCCDataContext(); var q = from entry in db.ScoreEntry select entry; return q; }
public static IQueryable<aspnet_Users> GetAllUsers() { PCMSofCCDataContext db=new PCMSofCCDataContext(); var q = from u in db.aspnet_Users select u; return q; }
public static Record GetRecord(int _recordId) { PCMSofCCDataContext db = new PCMSofCCDataContext(); var q = from r in db.Record where r.RecordId == _recordId select r; return q.Single(); }
public static IQueryable<Site> GetUnassignedSitesOnSomeDay(DateTime _date) { PCMSofCCDataContext db = new PCMSofCCDataContext(); var q = from s in db.Site where !s.Record.Any(r => r.Date == _date) select s; return q; }
public static IQueryable<Site> GetAssignedSites(DateTime _date) { PCMSofCCDataContext db = new PCMSofCCDataContext(); var q = from s in db.Record where s.Date == _date select s.Site; return q; }
public static Site GetSite(int _siteId) { PCMSofCCDataContext db = new PCMSofCCDataContext(); var query = from s in db.Site where s.Id == _siteId select s; return query.Single(); }
public static IQueryable<Record> GetRecords(DateTime _date) { PCMSofCCDataContext db = new PCMSofCCDataContext(); var q = from r in db.Record where r.Date == _date select r; return q; }
public static Record GetRecord(int _siteId, DateTime _date) { PCMSofCCDataContext db = new PCMSofCCDataContext(); var q = from r in db.Record where r.SiteId == _siteId && r.Date == _date select r; return q.Single(); }
public static void GetAvailableDayAndSubmitDate(Guid _userId, out int? flags, out DateTime? submitDate) { PCMSofCCDataContext db = new PCMSofCCDataContext(); var q = from d in db.AvailableDay where d.UserId == _userId select d; flags = q.Single().AvailableDayFlag; submitDate = q.Single().SubmitDate; }
public static void DeleteEntries(int _chartId) { PCMSofCCDataContext db = new PCMSofCCDataContext(); var q = from b in db.EntryBelongToChart where b.ChartId == _chartId select b; db.EntryBelongToChart.DeleteAllOnSubmit(q); db.SubmitChanges(); }
public static IQueryable<ScoreEntry> GetChartEntries(int _chartId) { PCMSofCCDataContext db = new PCMSofCCDataContext(); var q = from entry in db.ScoreEntry from es in entry.EntryBelongToChart where es.ChartId == _chartId select entry; return q; }
protected void btnSubmit_Click(object sender, EventArgs e) { PCMSofCCDataContext db = new PCMSofCCDataContext(); foreach (GridViewRow row in gvCompleteRecord.Rows) { RecordEntry entry = db.RecordEntry.Single(x => x.Id == (int)gvCompleteRecord.DataKeys[row.RowIndex].Value); entry.Score = int.Parse(((TextBox)row.FindControl("tbxScore")).Text); entry.Problem = ((TextBox)row.FindControl("tbxProblem")).Text; entry.Solution = ((TextBox)row.FindControl("tbxSolution")).Text; } db.SubmitChanges(); }
public static void AddScoreEntry(string _name, int _maxScore, string _criteria, string _remark) { PCMSofCCDataContext db = new PCMSofCCDataContext(); var newScoreEntry = new ScoreEntry { Name = _name, Criteria = StringHelper.ReplaceNewLine(_criteria), MaxScore = _maxScore, Remark = StringHelper.ReplaceNewLine(_remark) }; db.ScoreEntry.InsertOnSubmit(newScoreEntry); db.SubmitChanges(); }
public static void AddEntries(int _chartId, List<int> _entries) { PCMSofCCDataContext db = new PCMSofCCDataContext(); foreach (int id in _entries) { var newBelong = new EntryBelongToChart { ChartId = _chartId, EntryId = id }; db.EntryBelongToChart.InsertOnSubmit(newBelong); } db.SubmitChanges(); }
public static void AddSite(string _name, string _number, string _address, double _lon, double _lati, int _companyId) { PCMSofCCDataContext db = new PCMSofCCDataContext(); var newSite = new Site { Name = _name, Number = _number, Address = _address, Longitude = _lon, Latitude = _lati, CompanyId = _companyId, IsUsed = 1 }; db.Site.InsertOnSubmit(newSite); db.SubmitChanges(); }
public static void AddChart(string _chartName, List<int> _entries) { PCMSofCCDataContext db = new PCMSofCCDataContext(); var newChart = new ScoreChart { Name = _chartName }; db.ScoreChart.InsertOnSubmit(newChart); foreach (int id in _entries) { var newBelong = new EntryBelongToChart { ScoreChart = newChart, EntryId = id }; db.EntryBelongToChart.InsertOnSubmit(newBelong); } db.SubmitChanges(); }
public static System.Data.Linq.ISingleResult<GetCompleteRecordByChartId_个结果> GetCompleteRecord(int _chartId) { PCMSofCCDataContext db = new PCMSofCCDataContext(); return db.GetCompleteRecordByChartId(_chartId); }