public void UpdateAllPrayers(Parashot lastShabat, IEnumerable <Prayer> aliyot) { Prayer temPrayer = new Prayer(); if (lastShabat != Parashot.לא_ידוע || lastShabat != Parashot.ראש_השנה || lastShabat != Parashot.יום_כיפור || lastShabat != Parashot.סוכות || lastShabat != Parashot.פסח) { foreach (Prayer prayer in GetAllPrayers()) { if (prayer.LastAliyaParasha != lastShabat) { continue; } prayer.LastAliyaInThisYear = false; UpdatePrayer(prayer); } } foreach (Prayer p in aliyot) { temPrayer = p; temPrayer.LastAliyaInThisYear = true; temPrayer.LastAliyaParasha = lastShabat; UpdatePrayer(temPrayer); } }
public List <Parashah> CreateParashotDataIfNotExistAndLoad( bool reset = false, bool noText = false, bool keepMemo = false) { CheckConnected(); if (CreateParashotDataMutex) { throw new SystemException($"{nameof(CreateParashotDataIfNotExistAndLoad)} is already running."); } bool temp = Globals.IsReady; Globals.IsReady = false; CreateParashotDataMutex = true; try { if (reset || Connection.CountRows(ParashotTableName) != ParashotFactory.Instance.All.Count()) { SystemManager.TryCatchManage(() => { Connection.BeginTransaction(); try { List <string> memos = keepMemo ? new List <string>() : null; memos?.AddRange(Parashot.Select(p => p.Memo)); DeleteParashot(true); var list = ParashotFactory.Instance.All.Select(p => p.Clone()).Cast <Parashah>().ToList(); if (noText) { list.ForEach(p => { p.Translation = ""; p.Lettriq = ""; p.Memo = ""; }); } if (memos is not null) { for (int index = 0, indexCheck = 0; index < list.Count && indexCheck < memos.Count; index++) { list[index].Memo = memos[index]; } } Connection.InsertAll(list); Connection.Commit(); } catch { Connection.Rollback(); throw; } }); } return(LoadParashot()); } finally { CreateParashotDataMutex = false; Globals.IsReady = temp; } }
public void DeleteParashot(bool nocheckaccess = false) { CheckConnected(); if (!nocheckaccess) { CheckAccess(Parashot, nameof(Parashot)); } Connection.DeleteAll <Parashah>(); Parashot?.Clear(); }
public void ReleaseParashot() { if (Parashot is null) { return; } Interlocks.Release(ParashotTableName); if (ClearListsOnCloseOrRelease) { Parashot.Clear(); } Parashot = null; }