private void Setup(int hvoPara) { int vernWs = StTxtPara.GetWsAtParaOffset(m_cache, hvoPara, 0); if (vernWs == m_vernWs) { return; // already setup. } m_vernWs = vernWs; string sql = string.Format("select txt from WfiWordform_Form where ws={0}", vernWs); IOleDbCommand odc = DbOps.MakeRowSet(m_cache, sql, null); m_maxChars = 0; try { bool fMoreRows; odc.NextRow(out fMoreRows); while (fMoreRows) { string word = DbOps.ReadString(odc, 0); m_words.Add(word); m_maxChars = Math.Max(m_maxChars, word.Length); odc.NextRow(out fMoreRows); } } finally { DbOps.ShutdownODC(ref odc); } }
public bool OnClearSelectedWordParserAnalyses(object argument) { WfiWordform wf = CurrentWordform; if (wf == null) { MessageBox.Show(ParserUIStrings.ksSelectWordFirst); } else { if (CurrentWordformHvo > 0) { using (WfiWordformUi wfui = new WfiWordformUi(WfiWordform.CreateFromDBObject(m_cache, CurrentWordformHvo))) { if (m_cache.DatabaseAccessor.IsTransactionOpen()) { m_cache.DatabaseAccessor.CommitTrans(); } m_cache.DatabaseAccessor.BeginTrans(); DbOps.ExecuteStoredProc( m_cache, string.Format("EXEC RemoveParserApprovedAnalyses$ {0}", CurrentWordformHvo), null); m_cache.DatabaseAccessor.CommitTrans(); wfui.UpdateWordsToolDisplay(CurrentWordformHvo, false, false, true, true); } } } return(true); //we handled this. }
/// ------------------------------------------------------------------------------------ /// <summary> /// Fix any writing system references in the database that should be using the newly /// created vernacular writing system. Currently this only affects Sort methods. /// </summary> /// ------------------------------------------------------------------------------------ protected void FixVernacularWritingSystemReferences(FdoCache cache) { // Force the first vernacular writing system into the canned sort specs coming // from NewLangProj.xml where they refer to names or abbreviations in people and // location lists, since these default to showing vernacular languages first. string sSql = "declare @ws int " + "select top 1 @ws = Dst from LangProject_CurVernWss " + "update CmSortSpec set PrimaryWs = @ws " + " where PrimaryField in ('13,13009,7001','13,13006,7001','13,7001','13,7002'," + "'12,7001','12,7002','4006,4006003,7001','4006,4006007,7001','4006,4006002,7001') " + "update CmSortSpec set SecondaryWs = @ws " + " where SecondaryField in ('13,13009,7001','13,13006,7001','13,7001','13,7002'," + "'12,7001','12,7002','4006,4006003,7001','4006,4006007,7001','4006,4006002,7001') " + "update CmSortSpec set TertiaryWs = @ws " + " where TertiaryField in ('13,13009,7001','13,13006,7001','13,7001','13,7002'," + "'12,7001','12,7002','4006,4006003,7001','4006,4006007,7001','4006,4006002,7001')"; IOleDbCommand odc = null; cache.DatabaseAccessor.CreateCommand(out odc); try { odc.ExecCommand(sSql, (int)SqlStmtType.knSqlStmtNoResults); } finally { DbOps.ShutdownODC(ref odc); } }
static public SimpleListChooser MakeSenseChooser(FdoCache cache) { List <int> lexSenses = new List <int>(DbOps.ReadIntArrayFromCommand(cache, "SELECT Dst FROM LexEntry_Senses", null)); ObjectLabelCollection labels = new ObjectLabelCollection(cache, lexSenses, "LongNameTSS"); SimpleListChooser chooser = new SimpleListChooser(null, labels, LexEdStrings.ksSenses); chooser.Cache = cache; return(chooser); }
/// <summary> /// Load the information about the domains of hvoEntry. Returns false /// if the entry has no associated domains or none of them are linked to any other entries. /// </summary> /// <param name="cache"></param> /// <param name="hvoEntry"></param> /// <param name="domains"></param> /// <param name="cdaTemp"></param> /// <param name="fMoreRows"></param> /// <param name="owner"></param> /// <returns></returns> static private bool LoadDomainInfo(FdoCache cache, int hvoEntry, out int[] domainsOut, out IVwCacheDa cdaTemp, IWin32Window owner) { // This produces first the Semantic domains of the senses of the entry, // then restricts to those that occur on some other entry, // then looks up the vernacular (or, if none, analysis) name of the domains. The are sorted by // domain name. // We do left outer joins for the last two so we can distinguish the failure // modes "no SDs on senses of initial entry" versus "no other entries in those SDs" string sql1 = string.Format("select lssd2.dst, cn.txt, cn.ws from LexEntry le" + " join LexSense_ ls on ls.owner$ = le.id" + " join LexSense_SemanticDomains lssd on lssd.src = ls.id " + " left outer join LexSense_SemanticDomains lssd2 on lssd2.dst = lssd.dst" + " and exists (select * from CmObject lsother" + " join LexEntry leother on leother.id = lsother.owner$ and lsother.id = lssd2.src and leother.id != le.id)" + " left outer join CmPossibility_Name cn on lssd2.dst = cn.obj and cn.ws" + " in ({0}, {1}) where le.id = {2}" + " group by lssd2.dst, cn.txt, cn.ws" + " order by cn.txt", cache.DefaultVernWs, cache.DefaultAnalWs, hvoEntry); IOleDbCommand odc = DbOps.MakeRowSet(cache, sql1, null); bool fGotSrcDomain = false; // true if we found a semantic domain on some sense of the source entry try { bool fMoreRows; List <int> domains = new List <int>(); cdaTemp = VwCacheDaClass.Create(); for (odc.NextRow(out fMoreRows); fMoreRows; odc.NextRow(out fMoreRows)) { fGotSrcDomain = true; // any row indicates success here. int hvoDomain = DbOps.ReadInt(odc, 0); if (hvoDomain == 0) { continue; // null row, an SD that occurs on no other entry. } if (!((ISilDataAccess)cdaTemp).get_IsPropInCache(hvoDomain, RelatedWordsVc.ktagName, (int)CellarModuleDefns.kcptString, 0)) { ITsString tss = DbOps.ReadTss2(odc, 1); if (tss == null) { tss = FDO.Cellar.CmPossibility.BestAnalysisOrVernName(cache, hvoDomain); } cdaTemp.CacheStringProp(hvoDomain, RelatedWordsVc.ktagName, tss); domains.Add(hvoDomain); } } domainsOut = DbOps.ListToIntArray(domains); } finally { DbOps.ShutdownODC(ref odc); } return(fGotSrcDomain); }
/// <summary> /// Return the Row(CCR) and WficGroup(CCA) of a charted Wfic as an array of integers. /// [0] is CCR.hvo; [1] is CCA.hvo or empty array if the Wfic isn't charted in the given Chart. /// </summary> /// <param name="cache"></param> /// <param name="hvoChart"></param> /// <param name="hvoWfic"></param> /// <returns></returns> public static int[] FindChartLocOfWfic(FdoCache cache, int hvoChart, int hvoWfic) { string sql = "select row_at.src, cca_at.src from CmIndirectAnnotation_AppliesTo cca_at" + " join CmIndirectAnnotation_AppliesTo row_at on row_at.dst = cca_at.Src" + " and cca_at.Dst = " + hvoWfic + " join DsConstChart_Rows cc_rows on cc_rows.dst = row_at.src and cc_rows.src = " + hvoChart; return(DbOps.ReadIntsFromRow(cache, sql, "", 2)); }
public object DeleteIcu(string icuId) { var statusCode = this._config.DeleteIcu(icuId, DbOps.GetDbPath()); if (statusCode.Equals(HttpStatusCode.InternalServerError)) { return(BadRequest()); } return(Ok()); }
public IActionResult PostIcuModelData([FromBody] IcuModel newIcuModel) { var statusCode = this._config.AddNewIcuConfiguration(newIcuModel, DbOps.GetDbPath()); if (statusCode.Equals(HttpStatusCode.InternalServerError)) { return(BadRequest()); } return(Ok()); }
/// <summary> /// Have the utility do what it does. /// </summary> public void Process() { Debug.Assert(m_dlg != null); FdoCache cache = (FdoCache)m_dlg.Mediator.PropertyTable.GetValue("cache"); List <int> wordformIds = DbOps.ReadIntsFromCommand( cache, "SELECT Id FROM WfiWordform", null); int curObjId = 0; if (m_dlg.Mediator != null) { Mediator mediator = m_dlg.Mediator; RecordClerk activeClerk = (RecordClerk)mediator.PropertyTable.GetValue("ActiveClerk"); if (activeClerk != null && activeClerk.Id == "concordanceWords" && activeClerk.CurrentObject != null) { curObjId = activeClerk.CurrentObject.Hvo; } } // Set up progress bar. m_dlg.ProgressBar.Minimum = 0; m_dlg.ProgressBar.Maximum = wordformIds.Count; m_dlg.ProgressBar.Step = 1; // stop parser if it's running. m_dlg.Mediator.SendMessage("StopParser", null); if (wordformIds.Count > 0) { if (cache.DatabaseAccessor.IsTransactionOpen()) { cache.DatabaseAccessor.CommitTrans(); } foreach (int wfId in wordformIds) { cache.DatabaseAccessor.BeginTrans(); DbOps.ExecuteStoredProc( cache, string.Format("EXEC RemoveParserApprovedAnalyses$ {0}", wfId), null); cache.DatabaseAccessor.CommitTrans(); using (WfiWordformUi wfui = new WfiWordformUi(WfiWordform.CreateFromDBObject(cache, wfId))) { wfui.UpdateWordsToolDisplay(curObjId, false, false, true, true); } m_dlg.ProgressBar.PerformStep(); } } else { m_dlg.ProgressBar.PerformStep(); } }
/// <summary> /// The value of this property is the hvo of the owning object that is of class m_clid (or is a subclass of that). /// </summary> /// <param name="hvo"></param> /// <param name="tag"></param> /// <param name="ws"></param> /// <param name="cda"></param> public override void Load(int hvo, int tag, int ws, IVwCacheDa cda) { ISilDataAccess sda = cda as ISilDataAccess; // Do we want the subentries? string sql = string.Format("SELECT Id FROM dbo.fnGetOwnedIds({0},{1},{2})", hvo, (int)ReversalIndex.ReversalIndexTags.kflidEntries, (int)ReversalIndexEntry.ReversalIndexEntryTags.kflidSubentries); int[] vals = DbOps.ReadIntArrayFromCommand(m_cache, sql, null); cda.CacheVecProp(hvo, tag, vals, vals.Length); }
public ViewResult Index() { DbOps context = HttpContext.RequestServices.GetService(typeof(DbOps)) as DbOps; context.UpdatePeopleRecordCounterInDb(); ViewBag.peopleOnConvention = context.NumberOfPeopleActuallyOnConvention(); ViewBag.uniqueBarcodes = context.UniqueBarCodes(); ViewBag.peopleRecord = context.GetPeopleMaxRecordCounterFromDb(); return(View()); }
public Dictionary <string, PatientVital> CheckVitalOfAllPatients() { var patientsObj = new PatientDbOps(DbOps.GetDbPath()); Patients = patientsObj.GetAllPatientsFromDb(); var vitals = new Dictionary <string, PatientVital>(); foreach (var var1 in Patients) { var ret = GetRandomDataForPatient(var1.Key); vitals.Add(var1.Key, ret); } return(vitals); }
public IActionResult Post([FromBody] PatientModel newPatient) { var dbPath = DbOps.GetDbPath(); if (newPatient.Equals(null)) { return(BadRequest()); } var patientModelData = this._occupancyService.AddNewPatient(newPatient, dbPath); if (patientModelData.Equals(HttpStatusCode.InternalServerError)) { return(BadRequest()); } return(Ok(patientModelData)); }
/// <summary> /// Return the next wfics that have not yet been added to the chart (up to maxContext of them). /// </summary> /// <param name="maxContext"></param> /// <returns></returns> public static int[] NextUnusedInput(FdoCache cache, int hvoStText, int maxContext, int hvoChart) { int hvoWficDefn = CmAnnotationDefn.Twfic(cache).Hvo; int hvoCcaDefn = CmAnnotationDefn.ConstituentChartAnnotation(cache).Hvo; // First two lines yield annotations on the right text of the right type (wfics). // balance further limits it to uncharted ones string sql = "select top(" + maxContext + ") cba.id, stp.owner$ from CmBaseAnnotation_ cba" + " join StTxtPara_ stp on cba.BeginObject = stp.id and cba.AnnotationType = " + hvoWficDefn + " and stp.OwnFlid$ = 14001 and stp.Owner$ = " + hvoStText + " where not exists(Select * from DsConstChart_Rows row" + " join CmIndirectAnnotation_AppliesTo row_cca on row_cca.src = row.Dst and row.Src = " + hvoChart + " join CmIndirectAnnotation_AppliesTo cca_cba on cca_cba.src = row_cca.dst and cca_cba.Dst = cba.id)" + " order by stp.OwnOrd$, cba.BeginOffset"; return(DbOps.ReadIntArrayFromCommand(cache, sql, null)); }
/// <summary> /// Find the list of LexEntry objects which conceivably match the given wordform. /// </summary> /// <param name="cache"></param> /// <param name="tssWf"></param> /// <returns></returns> public static List <int> FindEntriesForWordform(FdoCache cache, ITsString tssWf) { if (tssWf == null) { return(new List <int>()); } string wf = tssWf.Text; if (wf == null || wf == string.Empty) { return(new List <int>()); } int wsVern = StringUtils.GetWsAtOffset(tssWf, 0); // Adjust the wf string to escape any single quotes that may be present, // else the SQL query will cause a crash (TE-7033): string wfSqlSafe = wf.Replace("'", "''"); // Check for Wordform, Lexeme Form, Alternate Form, and Citation Form. string sql = String.Format("SELECT le.Id, le.HomographNumber" + " FROM WfiWordform_Form wwf" + " JOIN WfiWordform_Analyses wwa ON wwa.Src=wwf.Obj" + " JOIN WfiAnalysis_MorphBundles wamb ON wamb.Src=wwa.Dst" + " JOIN WfiMorphBundle wmb ON wmb.Id=wamb.Dst" + " JOIN MoStemMsa msm ON msm.Id=wmb.Msa" + " JOIN CmObject co ON co.Id=msm.Id" + " JOIN LexEntry le ON le.Id=co.Owner$" + " WHERE wwf.Ws={0} AND wwf.Txt=N'{1}'" + " UNION" + " SELECT le.Id, le.HomographNumber" + " FROM MoForm_Form mff" + " JOIN CmObject co ON co.Id=mff.Obj" + " JOIN LexEntry le ON le.Id=co.Owner$" + " WHERE mff.Ws={0} AND mff.Txt=N'{1}'" + " UNION" + " SELECT le.Id, le.HomographNumber" + " FROM LexEntry le" + " JOIN LexEntry_CitationForm lcf ON lcf.Obj=le.Id AND lcf.Ws={0} AND lcf.Txt=N'{1}'" + " ORDER BY le.HomographNumber", wsVern, wfSqlSafe); return(DbOps.ReadIntsFromCommand(cache, sql, null)); }
public ViewResult Index(Player model) { DbOps context = HttpContext.RequestServices.GetService(typeof(DbOps)) as DbOps; if (ModelState.IsValid) { context.PeopleMigration(model.Barcode); context.UpdatePeopleRecordCounterInDb(); ModelState.Clear(); } //ModelState is a property of base class - Controller //if false - razor engine will generate info about error in view (based on return View() below) //we can set the view basing on if statement //ModelState.Clear(); to clear the form in view ViewBag.peopleOnConvention = context.NumberOfPeopleActuallyOnConvention(); ViewBag.uniqueBarcodes = context.UniqueBarCodes(); ViewBag.peopleRecord = context.GetPeopleMaxRecordCounterFromDb(); return(View()); }
/// <summary> /// Record the current parse timestamp of a whole collection of StTexts /// Equivalent to calling RecordParseTimestamp on each of them. /// </summary> /// <param name="texts"></param> public static void RecordParseTimestamps(List <IStText> texts) { if (texts.Count == 0) { return; } FdoCache cache = texts[0].Cache; int[] targetHvos = new int[texts.Count]; for (int i = 0; i < targetHvos.Length; i++) { targetHvos[i] = texts[i].Hvo; } int index = 0; string Hvos = DbOps.MakePartialIdList(ref index, targetHvos); string whereClause = ""; if (index == targetHvos.Length) { // If we can make a single where clause we'll do it; otherwise do them all. whereClause = " where Owner$ in (" + Hvos + ")"; } string sql = "select owner$, max(UpdStmp) from StTxtPara_ " + whereClause + " group by owner$"; IDbColSpec dcs = DbColSpecClass.Create(); dcs.Push((int)DbColType.koctBaseId, 0, 0, 0); int modifyTimestampTag = ParagraphsModifiedTimestampTag(cache); dcs.Push((int)DbColType.koctInt64, 1, modifyTimestampTag, 0); cache.VwOleDbDaAccessor.Load(sql, dcs, 0, 0, null, false); ISilDataAccess sda = cache.MainCacheAccessor; foreach (StText text in texts) { // Much of the logic of RecordParseTimestamp, but can assume modify timestamp is already loaded. text.LastParsedTimestamp = sda.get_Int64Prop(text.Hvo, modifyTimestampTag); text.ClearLastModifiedTimestamp(); } }
public override void GenerateChildren(XmlNode node, XmlNode caller, ICmObject obj, int indent, ref int insPos, ArrayList path, ObjSeqHashMap reuseMap) { CheckDisposed(); // If node has children, figure what to do with them... XmlNodeList children = node.ChildNodes; // It's important to initialize m_refs here rather than in FinishInit, because we need it // to be updated when the slice is reused in a regenerate. // Refactor JohnT: better still, make it a virtual attribute, and Refresh will automatically // clear it from the cache. if (m_vh != null) { m_refs = m_vh.LexReferences(m_obj.Hvo); } else { // DEPRECATED. string className = m_cache.MetaDataCacheAccessor.GetClassName((uint)m_obj.ClassID); // m_flid = AutoDataTreeMenuHandler.ContextMenuHelper.GetFlid(m_cache.MetaDataCacheAccessor, // className, m_fieldName); string qry = string.Format("SELECT DISTINCT [Src] FROM LexReference_Targets WHERE [Dst]={0}", m_obj.Hvo); m_refs = DbOps.ReadIntsFromCommand(m_cache, qry, null); } if (m_refs.Count == 0) { // It could have children but currently can't: we always show this as collapsedEmpty. Expansion = DataTree.TreeItemState.ktisCollapsedEmpty; return; } for (int i = 0; i < m_refs.Count; i++) { GenerateChildNode(i, node, caller, indent, ref insPos, path, reuseMap); } Expansion = DataTree.TreeItemState.ktisExpanded; }
public IActionResult Delete(string pId) { var dischargePatient = this._occupancyService.DischargePatient(pId, DbOps.GetDbPath()); return(Ok(dischargePatient)); }
public IActionResult PostBedModelData([FromBody] BedModel newBedModel) { this._config.AddNewBedConfiguration(newBedModel, DbOps.GetDbPath()); return(Ok(200)); }
public IActionResult GetIcuModelInformation() { var icuData = this._config.GetIcuConfiguration(DbOps.GetDbPath()); return(Ok(icuData)); }
public Dictionary <int, BedModel> GetBedModelInformation() { var bedData = this._config.GetBedConfigurationInformation(DbOps.GetDbPath()); return(bedData); }
public IActionResult GetAllBedLayouts() { var bedLayouts = this._config.GetAllBedLayouts(DbOps.GetDbPath()); return(Ok(bedLayouts)); }
public virtual void Init(Mediator mediator, XmlNode configurationParameters) { CheckDisposed(); m_mediator = mediator; m_configurationParameters = configurationParameters; m_mediator.AddColleague(this); FdoCache cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache"); List <ILgWritingSystem> usedWses = new List <ILgWritingSystem>(); using (new SuppressSubTasks(cache)) { foreach (IReversalIndex rev in cache.LangProject.LexDbOA.ReversalIndexesOC) { // This benign looking check of the count appears to do nothing, // but it is very important as it ensures the vector is cached. Without it, // crashes turn up in bulk deletion, as no PropChanged is sent, // as the vector is not in the cache. int entryCount = 0; entryCount = rev.EntriesOC.Count; usedWses.Add(rev.WritingSystemRA); if (rev.PartsOfSpeechOA == null) { (rev as ReversalIndex).InitNewInternal(); } if (rev.PartsOfSpeechOA.ItemClsid != PartOfSpeech.kClassId) { rev.PartsOfSpeechOA.ItemClsid = PartOfSpeech.kClassId; } } List <IReversalIndex> corruptReversalIndices = new List <IReversalIndex>(); foreach (IReversalIndex rev in cache.LangProject.LexDbOA.ReversalIndexesOC) { // Make sure each index has a name, if it is available from the writing system. if (rev.WritingSystemRA == null) { // Delete a bogus ReversalIndex that has no writing system. // But, for now only store them for later deletion, // as immediate removal will wreck the looping. corruptReversalIndices.Add(rev); continue; } ILgWritingSystem revWs = rev.WritingSystemRA; string sql = string.Format("SELECT Ws, Txt FROM LgWritingSystem_Name WHERE Obj = {0}", revWs.Hvo); IOleDbCommand odc = DbOps.MakeRowSet(cache, sql, null); try { bool fMoreRows; odc.NextRow(out fMoreRows); while (fMoreRows) { int wsHvo = DbOps.ReadInt(odc, 0); string nameWs = DbOps.ReadString(odc, 1); string nameRev = rev.Name.GetAlternative(wsHvo); if ((nameRev == null || nameRev == String.Empty) && (nameWs != null && nameWs.Length > 0)) { rev.Name.SetAlternative(nameWs, wsHvo); } odc.NextRow(out fMoreRows); } } finally { DbOps.ShutdownODC(ref odc); } } // Delete any corrupt reversal indices. foreach (IReversalIndex rev in corruptReversalIndices) { rev.DeleteUnderlyingObject(); } } // Set up for the reversal index combo box or dropdown menu. int firstId = 0; List <int> reversalIds = cache.LangProject.LexDbOA.CurrentReversalIndices; if (reversalIds.Count > 0) { firstId = reversalIds[0]; } else if (cache.LangProject.LexDbOA.ReversalIndexesOC.Count > 0) { firstId = cache.LangProject.LexDbOA.ReversalIndexesOC.HvoArray[0]; } if (firstId > 0) { SetReversalIndexHvo(firstId); } }
public IActionResult Delete(int bedId) { var removeBed = this._config.RemoveBed(bedId, DbOps.GetDbPath()); return(Ok(removeBed)); }
public IActionResult GetAllPatients() { var patientModels = this._occupancyService.GetPatientsDetails(DbOps.GetDbPath()); return(Ok(patientModels)); }
public IActionResult Get(string icuId) { var patientModels = this._occupancyService.GetPatientsDetailsInIcu(icuId, DbOps.GetDbPath()); return(Ok(patientModels)); }
public IActionResult GetBedDetails() { var bedModel = this._occupancyService.GetBedDetails(DbOps.GetDbPath()); return(Ok(bedModel)); }
public IActionResult GetBedDetailsForIcu(string icuId) { var bedModel = this._occupancyService.GetBedDetailsForIcu(icuId, DbOps.GetDbPath()); return(Ok(bedModel)); }
public IActionResult GetBedStatus(int bedId) { var bedStatus = this._occupancyService.IsBedFree(bedId, DbOps.GetDbPath()); return(Ok(bedStatus)); }