protected void loadLastDate() { string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); MRParams entry = db.MRParams.FirstOrDefault(p => p.Key.Trim() == keyLastDate); if (entry != null) { LastDate = Convert.ToDateTime((string)entry.Value); changeDate = (DateTime)entry.ChangeDate; } else { int curyear = etz.eastTimeNow().Year; LastDate = new DateTime(curyear, 3, 1, 23, 59, 59, System.Globalization.CultureInfo.InvariantCulture.Calendar); changeDate = etz.eastTimeNow(); MRParams newParm = new MRParams(); newParm.Key = keyLastDate; newParm.Value = LastDate.ToString(); newParm.ChangeDate = changeDate; db.MRParams.InsertOnSubmit(newParm); db.SubmitChanges(); } lblDateLastChanged.Text = "Date Last Changed: " + changeDate.ToString(); }
protected void DisplayMemberInfo(int pid) { lblMemberCount.Visible = false; string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); var memb = db.Players.FirstOrDefault(p => p.PlayerID == pid); if (memb == null) { lblPIDMissing.Visible = true; Table1.Visible = false; return; } tbPid.Text = memb.PlayerID.ToString(); tbMName.Text = memb.Name; tbMid.Text = memb.MemberID; tbHcp.Text = memb.Hcp; tbHDate.Text = memb.HDate.ToShortDateString(); tbTitle.Text = memb.Title; ddlGender.SelectedIndex = memb.Sex - 1; tbLName.Text = memb.LName; tbFName.Text = memb.FName; ddlDel.SelectedIndex = memb.Delete; // if (prm == null) return ""; // return prm.Value; }
public static SignupList LoadPlayersListDB() { string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); SignupList target = new SignupList(); var slist = from pl in db.PlayersList orderby pl.TransDate select pl; int seqNo = 0; foreach (var item in slist) { seqNo++; SignupEntry entry = new SignupEntry() { SeqNo = seqNo, STDate = item.TransDate, SeventId = item.EventID, SPlayerID = item.PlayerID, Saction = item.Action, Scarpool = item.Carpool, Smarked = item.Marked, SspecialRule = item.SpecialRule, SGuest = item.GuestID, SSelected = false, SDelete = false }; entry.Splayer = GetPlayerName(item.PlayerID); target.entries.Add(entry); } return(target); }
public static int ValidateGuestPlaying(string EventID, int gID, int pID) { int errorCode = 0; string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); PlayersList entry = db.PlayersList.FirstOrDefault(p => p.EventID == EventID && p.GuestID == gID && p.Marked == 0); if (entry != null) { if (entry.PlayerID != pID) { errorCode = 1; // set error that guest is already playing with another member } } Guest gentry = db.Guest.FirstOrDefault(g => g.GuestID == gID); if (gentry != null) { if (gentry.Played > 0) { errorCode = 2; // set erro that guest has already played as a guest once this year. } } return(errorCode); }
protected void deletePlayerInfo(MrMember memb) { ActiveSignups = Convert.ToInt32(Session["ActiveSignups"]); playerID = Convert.ToInt32(Session["PlayerID"]); string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); var item = db.Players.FirstOrDefault(p => p.PlayerID == memb.pID); if (item != null) { db.Players.DeleteOnSubmit(item); var se = from pl in db.PlayersList where ((pl.PlayerID == memb.pID) && (pl.Marked == 1)) select pl; db.PlayersList.DeleteAllOnSubmit(se); db.SubmitChanges(); Label2.Text = string.Format("Player {0} {1} Deleted.", item.PlayerID, item.Name); } else { lblErrorMsg.Text = string.Format("Player {0} {1} NOT deleted because player does not exist in database!", memb.pID, memb.name); } }
public static ParamsList LoadParams() { string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); ParamsList target = new ParamsList(); var prm = from p in db.MRParams orderby p.Key select new { p.Key, p.Value, p.ChangeDate }; foreach (var item in prm) { Param newParam = new Param() { Key = item.Key, Value = item.Value, ChangeDate = item.ChangeDate }; target.Params.Add(newParam); } return(target); }
public static int GetPlayerID(string lName, string fName, int sex) { keyName = Proper(lName.Trim()) + ", " + Proper(fName.Trim()); MrTimeZone tz = new MrTimeZone(); int pid = 0; string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); var query = from p in db.Players where p.Name == keyName select p; Players player = query.FirstOrDefault(); // Lookup Player in Players Datbase if (player != null) { pid = player.PlayerID; } else { Players pl = new Players() { Name = keyName, LName = Proper(lName.Trim()), FName = Proper(fName.Trim()), Hcp = "NONE", MemberID = "", Sex = sex, Title = "", HDate = tz.eastTimeNow(), Delete = 0 }; MRParams param = db.MRParams.FirstOrDefault(p => p.Key == keyPlayers); if (param != null) { pid = Convert.ToInt32(param.Value); pid += 1; pl.PlayerID = pid; db.Players.InsertOnSubmit(pl); param.Value = pid.ToString(); param.ChangeDate = tz.eastTimeNow(); } else { MRParams par = new MRParams(); par.Key = keyPlayers; par.Value = "1"; par.ChangeDate = tz.eastTimeNow(); db.MRParams.InsertOnSubmit(par); pid = 1; pl.PlayerID = pid; db.Players.InsertOnSubmit(pl); } } db.SubmitChanges(); return(pid); }
public static MembersList LoadMembers() { string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); MembersList target = new MembersList(); var memb = from p in db.Players orderby p.Name select p; _count = 0; foreach (var item in memb) { MrMember newMember = new MrMember() { pID = item.PlayerID, name = item.Name, fname = item.FName, lname = item.LName, gender = item.Sex, hcp = item.Hcp, memberNumber = item.MemberID, title = item.Title, hdate = item.HDate, del = item.Delete }; newMember.active = SignupList.CountPlayersActiveSignupEntries(item.PlayerID); target.Members.Add(newMember); _count++; } Count = _count; return(target); }
public static int DeleteMember(int playerID) { int err = 1; // set result to not deleted string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); var pl = db.Players.Single(p => p.PlayerID == playerID); _MembersName = pl.Name; if (SignupList.CountPlayersActiveSignupEntries(playerID) == 0) // delete is active records is zero { db.Players.DeleteOnSubmit(pl); var deleteSignupEntries = from SignupEntries in db.PlayersList where SignupEntries.PlayerID == playerID select SignupEntries; if (deleteSignupEntries != null) { foreach (var SignupEntry in deleteSignupEntries) { // delete all signup records for this member db.PlayersList.DeleteOnSubmit(SignupEntry); } db.SubmitChanges(); err = 0; // set result to deleted } } return(err); }
protected int DeleteDBEntries() { // delete from SignUp database entries in SL that are marked to be deleted int n = 0; string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); foreach (SignupEntry se in this.sl.Entries) { if (se.SDelete) { DateTime timestamp = se.STDate; string eid = se.SeventId; int pid = se.SPlayerID; var oldentry = db.PlayersList.Single(pe => pe.TransDate == timestamp && pe.EventID == eid && pe.PlayerID == pid); db.PlayersList.DeleteOnSubmit(oldentry); n++; } } if (n > 0) { db.SubmitChanges(); } return(n); }
public static SignupList LoadFromPlayersListDB(string EventID) { string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); SignupList target = new SignupList(); var slist = from pl in db.PlayersList join pn in db.Players on pl.PlayerID equals pn.PlayerID where pl.EventID == EventID && pl.Marked == 0 orderby pl.TransDate select new { pl.TransDate, pl.EventID, pl.PlayerID, pn.Name, pn.Sex, pn.Hcp, pl.Action, pl.Carpool, pl.Marked, pl.SpecialRule, pl.GuestID }; int seqNo = 0; foreach (var item in slist) { seqNo++; SignupEntry entry = new SignupEntry() { SeqNo = seqNo, STDate = item.TransDate, SeventId = item.EventID, SPlayerID = item.PlayerID, Splayer = item.Name, Shcp = item.Hcp, Saction = item.Action, Scarpool = item.Carpool, Smarked = item.Marked, SspecialRule = item.SpecialRule, SGuest = item.GuestID, SSelected = false, SDelete = false }; entry.Ssex = ""; if ((int)item.Sex == 2) { entry.Ssex = "[F]"; } if (item.GuestID == 0) { entry.SGuest = 0; } else { // MRParams param = db.MRParams.FirstOrDefault(p => p.Key == keyPlayers); Guest guest = db.Guest.FirstOrDefault(g => g.GuestID == item.GuestID); entry.SGuestName = guest.GuestName; entry.SgHcp = guest.gHcp; entry.SgSex = ""; if (guest.gSex == 2) { entry.SgSex = "[F]"; } } target.entries.Add(entry); } return(target); }
protected void btnUpdate_Click(object sender, EventArgs e) { lblUpdateCount.Text = " "; lblUpdateCount.ForeColor = System.Drawing.Color.Green; // load handicaps.txt file from host server in handicap list int updateCount = 0; int countOfPlayers = 0; // MrResources mr = new MrResources(); // path = Server.MapPath(mr.Root); try { hcpDate = Convert.ToDateTime(tbHcpDate.Text); List <Handicap> hc = Handicap.LoadHandicaps(filename, hcpDate); // update sql Players with handicaps from text file string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); MRParams entry = db.MRParams.FirstOrDefault(p => p.Key == "Players"); if (entry == null) { PlayersCount = 0; } else { PlayersCount = Convert.ToInt32(entry.Value); for (int i = 0; i <= PlayersCount; ++i) { var m = db.Players.FirstOrDefault(h => h.PlayerID == i); if (m != null) { countOfPlayers++; foreach (var hcp in hc) { if (m.MemberID.Trim() == hcp.ID.Trim()) { m.Hcp = hcp.Index; m.HDate = hcp.Date; db.SubmitChanges(); updateCount++; } } } } } ShowMembers(); lblUpdateCount.Text = string.Format("{0} of {1} Handicaps Updated", updateCount, countOfPlayers); } catch (FormatException) { lblUpdateCount.Text = "Invalid Handicap Date"; lblUpdateCount.ForeColor = System.Drawing.Color.Red; } }
public static PrSchedule GetPlayerSchedule(int playerID, string type) { PrSchedule target = new PrSchedule(); string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); MrTimeZone mtz = new MrTimeZone(); DateTime etzNow = mtz.eastTimeNow(); var ps = from pl in db.PlayersList where ((pl.PlayerID == playerID) && (pl.Marked == 0)) join ev in db.Events on pl.EventID equals ev.EventID orderby ev.EventID select new { ev.EventID, ev.Date, ev.Type, ev.Title, ev.Cost, ev.Time, ev.Deadline, ev.HostPhone, pl.Carpool }; futureCount = 0; prevCount = 0; if (ps != null) { foreach (var item in ps) { PrEvent pe = new PrEvent { PrEvID = item.EventID, PrDate = item.Date, PrType = item.Type, PrTitle = item.Title, PrCost = item.Cost, PrTime = item.Time, PrDeadline = item.Deadline, PrHostPhone = item.HostPhone, PrCarpool = item.Carpool }; if (item.Date >= etzNow) { futureCount++; pe.PrCompleted = false; target.PEvents.Add(pe); } else { if (type == "0") { prevCount++; pe.PrCompleted = true; target.PEvents.Add(pe); } } } } return(target); }
protected void SaveParamValue(string Key, string Value) { string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); var chg = db.MRParams.FirstOrDefault(c => c.Key == Key); chg.Value = Value; DateTime chgChangeDate = new MrTimeZone().eastTimeNow(); chg.ChangeDate = chgChangeDate; db.SubmitChanges(); }
private string GetParamValue(String key) { string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); var prm = db.MRParams.FirstOrDefault(p => p.Key == key); if (prm == null) { return(""); } return(prm.Value); }
protected void deleteParam(string k) { string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); MRParams rec = db.MRParams.FirstOrDefault(c => c.Key == k); if (rec != null) { db.MRParams.DeleteOnSubmit(rec); } db.SubmitChanges(); }
protected static string GetPlayerName(int id) { string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); var prm = db.Players.FirstOrDefault(p => p.PlayerID == id); if (prm == null) { return("UNKNOWN"); } return(prm.Name); }
protected void AddParameter(string key, string value) { string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); MRParams prm = new MRParams(); prm.Key = key; prm.Value = value; prm.ChangeDate = new MrTimeZone().eastTimeNow(); db.MRParams.InsertOnSubmit(prm); db.SubmitChanges(); }
public DateTime getDisplayDate() { MrTimeZone ETZ = new MrTimeZone(); sysToday = ETZ.eastTimeNow(); string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); MRParams entry = db.MRParams.FirstOrDefault(p => p.Key == keyLastDate); if (entry != null) { LastDate = Convert.ToDateTime((string)entry.Value); changeDate = (DateTime)entry.ChangeDate; } else { LastDate = new DateTime(2012, 4, 12, 23, 59, 59, System.Globalization.CultureInfo.InvariantCulture.Calendar); changeDate = ETZ.eastTimeNow(); MRParams newParm = new MRParams(); newParm.Key = keyLastDate; newParm.Value = LastDate.ToString(); newParm.ChangeDate = changeDate; db.MRParams.InsertOnSubmit(newParm); db.SubmitChanges(); } MRParams edts = db.MRParams.FirstOrDefault(p => p.Key == keyDaysToShow); daysToShow = defaultDisplayDays; if (edts != null) { daysToShow = Convert.ToInt32((string)edts.Value); } else { changeDate = ETZ.eastTimeNow(); MRParams newParm = new MRParams(); newParm.Key = keyDaysToShow; newParm.Value = daysToShow.ToString(); newParm.ChangeDate = changeDate; db.MRParams.InsertOnSubmit(newParm); db.SubmitChanges(); } displayDate = ETZ.eastTimeNow().AddDays(daysToShow); if (LastDate < displayDate) { displayDate = LastDate; } return(displayDate); }
protected DateTime GetParamDateTimeValue(String key) { string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); var prm = db.MRParams.FirstOrDefault(p => p.Key == key); if (prm == null) { return(nullDate); } DateTime pd = Convert.ToDateTime(prm.Value); return(pd); }
public static string Get(string key) { string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); SysParams entry = db.SysParams.FirstOrDefault(p => p.Key.Trim() == key); if (entry == null) { return(string.Format("No {0} entry", key)); } else { return(entry.Value); } }
protected void cleanPlayersList() { string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); var entry = from p in db.PlayersList where p.PlayerID > 0 select p; foreach (var item in entry) { item.GuestID = 0; } db.SubmitChanges(); }
protected void btnDeleteAll_Click(object sender, EventArgs e) { string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); var entry = from p in db.PlayersList where p.PlayerID > 0 select p; foreach (var item in entry) { db.PlayersList.DeleteOnSubmit(item); } db.SubmitChanges(); }
protected void updateParams() { DateTime lDate = Convert.ToDateTime(newLastDate); LastDate = new DateTime(lDate.Year, lDate.Month, lDate.Day, 23, 59, 59); // MrTimeZone tmz = new MrTimeZone(); DateTime fDate = Convert.ToDateTime(newFirstDate); FirstDate = new DateTime(fDate.Year, fDate.Month, fDate.Day, 0, 0, 1); changeDate = etz.eastTimeNow(); string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); MRParams param = db.MRParams.FirstOrDefault(p => p.Key == keyLastDate); if (param != null) { param.Value = (string)LastDate.ToString(); param.ChangeDate = changeDate; } else { MRParams newParam = new MRParams(); newParam.Key = keyLastDate; newParam.Value = (string)LastDate.ToString(); newParam.ChangeDate = changeDate; db.MRParams.InsertOnSubmit(newParam); } MRParams xparam = db.MRParams.FirstOrDefault(p => p.Key.Trim() == keyFirstDate); if (xparam != null) { xparam.Value = (string)FirstDate.ToString(); xparam.ChangeDate = changeDate; } else { MRParams newParam = new MRParams(); newParam.Key = keyFirstDate; newParam.Value = (string)FirstDate.ToString(); newParam.ChangeDate = changeDate; db.MRParams.InsertOnSubmit(newParam); } db.SubmitChanges(); lblDateChanged.Text = "Last Date Changed Successfully: " + changeDate.ToString(); }
public static void Update(string key, string value) { MrTimeZone etz = new MrTimeZone(); string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); SysParams entry = db.SysParams.FirstOrDefault(p => p.Key.Trim() == key); if (entry != null) { entry.Value = value; entry.ChangeDate = etz.eastTimeNow(); } else { SysParams sp = new SysParams { Key = key, Value = value, ChangeDate = etz.eastTimeNow() }; db.SysParams.InsertOnSubmit(sp); } db.SubmitChanges(); /*) * MRParams entry = db.MRParams.FirstOrDefault(p => p.Key.Trim() == keyLastDate); * if (entry != null) * { * LastDate = Convert.ToDateTime((string)entry.Value); * changeDate = (DateTime)entry.ChangeDate; * } * else * { * int curyear = etz.eastTimeNow().Year; * LastDate = new DateTime(curyear, 3, 1, 23, 59, 59, System.Globalization.CultureInfo.InvariantCulture.Calendar); * changeDate = etz.eastTimeNow(); * MRParams newParm = new MRParams(); * newParm.Key = keyLastDate; * newParm.Value = LastDate.ToString(); * newParm.ChangeDate = changeDate; * db.MRParams.InsertOnSubmit(newParm); * db.SubmitChanges(); * } * lblDateLastChanged.Text = "Date Last Changed: " + changeDate.ToString(); */ }
public static MrSchedule LoadFromDB() { MrSchedule target = new MrSchedule(); MrTimeZone mtz = new MrTimeZone(); DateTime etzNow = mtz.eastTimeNow(); DateTime yesterday = etzNow.Subtract(TimeSpan.FromDays(1)); string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); var qevents = from ev in db.Events where (ev.Date >= yesterday) orderby ev.EventID select ev; foreach (Events item in qevents) { SysEvent e = new SysEvent() { Id = item.EventID.Trim(), EDate = item.Date, EType = item.Type.Trim(), ETitle = item.Title, ECost = item.Cost.Trim(), ETime = item.Date.ToString("h:mm t").ToLower(), EDeadline = item.Deadline, EPlayerLimit = item.PlayerLimit, EHostPhone = item.HostPhone, ESpecialRule = item.SpecialRule.Trim(), EGuest = item.Guest.Trim(), EHostID = item.HostID, EPostDate = item.PostDate }; if (item.PostDate == null) { e.EPostDate = DateTime.MinValue; } target.ScheduleYear = e.EDate.Year; target.Events.Add(e); } return(target); }
private void savePlayerInfo(MrMember memb) { string action = ""; string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); var item = db.Players.FirstOrDefault(p => p.PlayerID == memb.pID); if (item != null) { item.Name = memb.name; item.LName = memb.lname; item.FName = memb.fname; item.Hcp = memb.hcp; item.HDate = memb.hdate; item.MemberID = memb.memberNumber; item.Sex = memb.gender; item.Title = memb.title; item.Delete = memb.del; action = "updated"; } else { Players p = new Players() { PlayerID = memb.pID, Name = memb.name, LName = memb.lname, FName = memb.fname, Hcp = memb.hcp, HDate = memb.hdate, MemberID = memb.memberNumber, Sex = memb.gender, Title = memb.title, Delete = memb.del }; db.Players.InsertOnSubmit(p); action = "inserted"; } db.SubmitChanges(); Label2.Text = string.Format("{0} {1} {2} in database.", memb.pID, memb.name, action); }
protected void ShowEvent(string id) { string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); var query = (from ev in db.Events where (ev.EventID == id) select new { ev.EventID, ev.Date, ev.Type, ev.Title, ev.Time, ev.PlayerLimit }); foreach (var item in query) { evID = item.EventID; evDate = item.Date.ToString("ddd, MMM d"); evType = item.Type; evTitle = item.Title; evTime = item.Time; evPlayerLimit = item.PlayerLimit; } lblEvent.Text = "Event: " + evID + " - " + evType + " - " + evDate + " - " + evTitle + " - Tee Time at " + evTime; }
protected int PurgeEvents(DateTime StartDate, DateTime EndDate) { int result = 0; DateTime vDate; string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); var query = from q in db.Events where ((q.Date >= StartDate) && (q.Date <= EndDate)) select q; foreach (var item in query) { vDate = item.Date; db.Events.DeleteOnSubmit(item); result++; } db.SubmitChanges(); return(result); }
public static void PurgeMarkedEntries() { string MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString(); MRMISGADB db = new MRMISGADB(MRMISGADBConn); var markedEntries = from SignupEntries in db.PlayersList where SignupEntries.Marked > 0 select SignupEntries; _entriesPurged = 0; if (markedEntries != null) { foreach (var entry in markedEntries) { db.PlayersList.DeleteOnSubmit(entry); _entriesPurged++; } db.SubmitChanges(); } }