public IEnumerable <IDictionary <string, string> > Search(string q) { var query = _parser.Parse(q); var topFieldCollector = TopFieldCollector.Create( sort: Sort.RELEVANCE, numHits: 1000, fillFields: false, trackDocScores: true, trackMaxScore: false, docsScoredInOrder: false ); _searcher.Search(query, topFieldCollector); var topDocs = topFieldCollector.TopDocs(); if (topDocs == null) { return(new List <IDictionary <string, string> >()); } var missingIndices = topDocs.ScoreDocs.Select(hit => Docs.DocToDict(_searcher.Doc(hit.Doc), hit.Score)).ToArray(); _logger.Debug("Search of '{0}' return {1} results.", q, missingIndices.Count()); return(missingIndices.OrderByDescending(dict => dict["score"]).ThenByDescending(dict => dict["rank"]).Take(_resultsLimit)); }
public async Task <IActionResult> PostEmployeeAuthtorizationAsync([FromBody] EmployeeAuthtorizationRequest request) { var entity = request; entity.UserInsert = UserInfo.UserId; entity.DateFrom = DateTime.Now.Date; var response = await EmployeeService.CreateEmployeeAuthtorizationAsync(entity); Docs docs = new Docs(); docs.EntityId = response.Model.EmployeeAuthorizationId; docs.EntityTypeId = (int)EntityTypeEnum.EmployeeAuthtorization; var DOCSResponse = await EmployeeService.CreateDocsAsync(docs, typeof(EmployeeAuthtorization), request.EmployeeAuthorizationName, request.fileRequest, (int)DocumentType.Authtorization); if (DOCSResponse.DIdError) { throw new Exception("Error in create Document EmployeeAuthtorization" + response.Message); } SingleResponse <EmployeeAuthtorizationRequest> res = new SingleResponse <EmployeeAuthtorizationRequest>(); res.Model = response.Model.ToEntity(DOCSResponse.Model); return(res.ToHttpResponse()); }
void test_Mtch_3() { Log.set(" test_Mtch_3: Rule 5 и Group < C235, Pl30 >"); rule = new Rule.Rule(5); ElmAttSet.ElmAttSet elm = new ElmAttSet.ElmAttSet( "ID56A7442F-0000-0D74-3134-353338303236", "C235", "Steel", "Pl30", 0, 0, 0, 1001); Dictionary<string, ElmAttSet.ElmAttSet> els = new Dictionary<string, ElmAttSet.ElmAttSet>(); els.Add(elm.guid, elm); List<string> guids = new List<string>(); guids.Add(elm.guid); var model = new Model.Model(); model.setElements(els); model.getGroups(); var gr = model.elmGroups[0]; //6/4/17 TST.Eq(gr.guids.Count, 1); //6/4/17 TST.Eq(gr.mat, "c235"); //6/4/17TST.Eq(gr.prf, "pl30"); var doc = Docs.getDoc("Полоса СтальхолдингM"); var csDP = new Dictionary<SType, string>(); //31/3 csFPs = rule.Parser(FP.type.CompSet, doc.LoadDescription); // 2/4 Comp comp1 = new Comp(doc, 2, csDP); // 2/4 Comp comp2 = new Comp(doc, 12, csDP); // 2/4 List<Comp> comps = new List<Comp> { comp1, comp2 }; // 2/4 CS cs = new CS("test_CS", null, rule, doc.LoadDescription, comps); // 2/4 TST.Eq(cs.csDP.Count, 4); //////////////////////////TST.Eq(comp1.isMatch(gr, rule), false); //////////////////////////TST.Eq(comp2.isMatch(gr, rule), true); Log.exit(); }
public IEnumerable <IDictionary <string, string> > ReadHighScores(int limit) { var results = new List <IDictionary <string, string> >(); if (_directory != null) { try { var reader = IndexReader.Open(_directory, true); var numDocs = reader.NumDocs(); for (var i = 0; i < numDocs; i++) { if (reader.IsDeleted(i)) { continue; } results.Add(Docs.DocToDict(reader.Document(i))); } _logger.Debug("Closing"); reader.Dispose(); } catch (Exception) { _logger.Info("Attempted to read empty search index."); } } _logger.Info("Found {0}.", results.Count); return(results.OrderByDescending(dict => dict["score"]).Take(limit)); }
public async Task <IActionResult> PutOrganizationAsync(int Id, [FromBody] OrganizationRequest request) { // Get Organization by Id var entity = await OrganizationService.GetOrganizationsAsync(request.OrganizationId ?? 0); //// ValIdate if entity exists if (entity == null) { return(NotFound()); } var Organization = request;//.ToEntity(); // Organization.OrganizationId = Id; var response = await OrganizationService.UpdateOrganizationAsync(Organization); Docs docs = new Docs(); docs.EntityId = Organization.OrganizationId; docs.EntityTypeId = (int)EntityTypeEnum.Organization; var DOCSResponse = await OrganizationService.CreateDocsAsync(docs, typeof(Organization), request.OrganizationName, request.fileRequest, (int)DocumentType.Logo); if (DOCSResponse.DIdError) { throw new Exception("Error in update Document Organization" + response.Message); } response.Message = string.Format("Sucsses Put for Site Organization = {0} ", request.OrganizationId); return(response.ToHttpResponse()); }
public int SaveDoc(Docs Doc) { try { int count = 0; _connection?.Open(); try { OleDbCommand myAccessCommand = new OleDbCommand($"insert into Docs (Name, [Date], exId, PId) values ('{Doc.Name}', '{Doc.Date}', {Doc.exId}, {Doc.Pid});", _connection); myAccessCommand.ExecuteNonQuery(); count++; } catch (Exception ex) { } return(count); } catch (Exception ex) { return(-1); } finally { _connection?.Close(); } }
private static Docs?ParseDocs(GeneratorExecutionContext context) { Docs?docs = null; if (context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.CsWin32InputDocPaths", out string?delimitedApiDocsPaths) && !string.IsNullOrWhiteSpace(delimitedApiDocsPaths)) { string[] apiDocsPaths = delimitedApiDocsPaths !.Split('|'); if (apiDocsPaths.Length > 0) { List <Docs> docsList = new(apiDocsPaths.Length); foreach (string path in apiDocsPaths) { try { docsList.Add(Docs.Get(path)); } catch (Exception e) { context.ReportDiagnostic(Diagnostic.Create(DocParsingError, null, path, e.Message)); } } docs = Docs.Merge(docsList); } } return(docs); }
public static void WriteCustomContentIfAny(string uid, Docs docs, string folder) { List <string> blocks = new List <string>(); if (!string.IsNullOrEmpty(docs.ThreadSafety)) { blocks.Add(GenerateOverwriteBlockForMarkup(uid, OPSMetadata.ThreadSafety, docs.ThreadSafety.TrimEnd())); } string fileName = null; if (blocks.Count > 0) { try { fileName = Path.Combine(folder, TruncateUid(uid.Replace("*", "_")) + ".misc.md"); File.WriteAllLines(fileName, blocks); } catch (Exception ex) { OPSLogger.LogUserError(LogCode.ECMA2Yaml_OverwriteMDFile_SaveFailed, null, $"{uid}: {ex}"); return; } } }
public IActionResult AddFile(FileViewModel fileViewModel) { Docs document = new Docs() { Annotation = fileViewModel.Annotation }; if (fileViewModel.FileDocument != null && (fileViewModel.FileDocument.FileName.Contains("docx") || fileViewModel.FileDocument.FileName.Contains("xlsx"))) { byte[] docData = null; using (var binaryReader = new BinaryReader(fileViewModel.FileDocument.OpenReadStream())) { docData = binaryReader.ReadBytes((int)fileViewModel.FileDocument.Length); } document.FileDocument = docData; document.Name = fileViewModel.FileDocument.FileName; if (fileViewModel.MasterGuid != Guid.Empty) { document.ParentId = fileViewModel.MasterGuid; } _context.Docs.Add(document); _context.SaveChanges(); } return(RedirectToAction("Index")); }
public EmuLuaLibrary(LuaConsole passed) : this() { LuaWait = new AutoResetEvent(false); Docs.Clear(); _caller = passed.Get(); // Register lua libraries var libs = Assembly .Load("BizHawk.Client.Common") .GetTypes() .Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t)) .Where(t => t.IsSealed) .ToList(); libs.AddRange( Assembly .GetAssembly(typeof(EmuLuaLibrary)) .GetTypes() .Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t)) .Where(t => t.IsSealed) ); foreach (var lib in libs) { var instance = (LuaLibraryBase)Activator.CreateInstance(lib, _lua); instance.LuaRegister(lib, Docs); Libraries.Add(lib, instance); } _lua.RegisterFunction("print", this, GetType().GetMethod("Print")); EmulatorLuaLibrary.FrameAdvanceCallback = Frameadvance; EmulatorLuaLibrary.YieldCallback = EmuYield; }
public void ProcessGroupMessage(GroupMessageReceivedContext context) { if (context.Message == "/help") { _mahuaApi.SendGroupMessage(context.FromGroup, Docs.GetDocsString()); } }
private IEnumerable <OpenApiParameter> GetParameters() { if (Docs.ContainsKey(PathKey)) { JToken parameters = Docs.SelectToken($"{PathKey}.{ParametersKey}"); if (parameters != null) { return(parameters.ToObject <IEnumerable <OpenApiParameter> >() .Select(d => { KeyValuePair <string, string>?map = ParametersMap?.FirstOrDefault(p => p.Value.Equals(d.Name, StringComparison.OrdinalIgnoreCase)); if (map != null && map.HasValue && map.Value.Key != null) { d.Name = map.Value.Key; } return d; })); } } return(Enumerable.Empty <OpenApiParameter>()); }
private void dgvHistoryExam_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } string docno = dgvHistoryExam.Rows[e.RowIndex].Cells["docno"].Value.ToString(); //show thông tin khám hồ sơ cũ List <Fee> lstDrug = new List <Fee>(); var dt = new DrugOrderLine().Select(long.Parse(docno)); foreach (DataRow r in dt.Rows) { lstDrug.Add(new Fee() { name = r["name"].ToString(), unit = r["unit"].ToString(), price = int.Parse(r["price"].ToString()), quantity = int.Parse(r["quantity"].ToString()), usage = r["usage"].ToString() }); } DataRow doc = new Docs().Select(long.Parse(docno)); frmDrugReport frm = new frmDrugReport(); frm.PrintOrder(s.SelectValue("clinic_name"), s.SelectValue("clinic_phone"), s.SelectValue("clinic_address"), txtPatientno.Text, docno, doc["examdate"].ToString(), txtFullname.Text, mtbBirthdate.Text, cbbGender.Text, actAddress.Text, txtPhone.Text, actSymptom.Text, doc["diagnostic"].ToString(), doc["advice"].ToString(), doc["doctor"].ToString(), lstDrug); frm.ShowInTaskbar = false; frm.ShowDialog(); //-----kết thúc show thông tin khám hồ sơ cũ }
public async Task <IActionResult> PostEmployeeNoteAsync([FromBody] NoteRequest request) { var entity = request; entity.EntityTypeId = (int)EntityTypeEnum.Employee; entity.EntityId = request.EmployeeId; var response = await EmployeeService.CreateEmployeeNoteAsync(entity); Docs docs = new Docs(); docs.EntityId = response.Model.NoteId; docs.EntityTypeId = (int)EntityTypeEnum.Note; var DOCSResponse = await EmployeeService.CreateDocsAsync(docs, typeof(Notes), request.NoteContent, request.FileRequest, (int)DocumentType.Note); if (DOCSResponse.DIdError) { throw new Exception("Error in create Document Notes" + response.Message); } SingleResponse <NoteRequest> res = new SingleResponse <NoteRequest>(); res.Model = response.Model.ToEntity(null, request.EmployeeId, DOCSResponse.Model); return(res.ToHttpResponse()); }
/// <summary> /// Создать XML файлы из данных, считанных из БД /// </summary> /// <param name="rep_year">Отчетный год</param> /// <param name="org">Организация</param> /// <param name="list_id">Список идентификаторов пакетов</param> /// <param name="connectionStr">Строка подключения</param> /// <param name="mapXml">Карта - выходной параметр</param> /// <param name="szv3Xml">Сводная ведомость - выходной параметр</param> /// <param name="szv2XmlArray">Описи - выходной параметр</param> /// <param name="szv1XmlArray">Документы СЗВ1 - выходной параметр</param> /// <returns></returns> public static int MakeXml(int repYear, Org org, IEnumerable <long> listId, string connectionStr, out XmlDocument mapXml, out XmlDocument szv3Xml, out IEnumerable <XmlDocument> szv2XmlArray, out IEnumerable <IEnumerable <XmlDocument> > szv1XmlArray) { int res = 0; XmlDocument szv3 = Szv3Xml.GetXml(org.idVal, repYear, connectionStr); LinkedList <XmlDocument> szv2Array = new LinkedList <XmlDocument>(); LinkedList <IEnumerable <XmlDocument> > szv1Array = new LinkedList <IEnumerable <XmlDocument> >(); foreach (long listID in listId) { XmlDocument szv2 = Szv2Xml.GetXml(listID, connectionStr); long[] docsID = Docs.GetDocsID(listID, connectionStr); IEnumerable <XmlDocument> szv1 = Szv1Xml.GetXml(docsID, org, connectionStr); if (szv1 != null && szv2 != null) { szv2Array.AddLast(szv2); szv1Array.AddLast(szv1); } else { res = -1; } } mapXml = MapXml.GetXml(szv2Array, szv1Array); szv3Xml = szv3; szv2XmlArray = szv2Array; szv1XmlArray = szv1Array; // return(res); }
private void SetKeywords(string text) { var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://westeurope.api.cognitive.microsoft.com/text/analytics/v2.0/keyphrases"); httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "POST"; httpWebRequest.Headers.Add("Ocp-Apim-Subscription-Key", "3bf9297b9a4f436d9eec7e7273a1fce0"); using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { string json = "{\"documents\": [ { \"language\": \"en\", \"id\": \"1\", \"text\": \"" + text + "\"}]}"; streamWriter.Write(json); } var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { var result = streamReader.ReadToEnd(); Docs data = JsonConvert.DeserializeObject <Docs>(result); foreach (var keyword in data.documents[0].keyPhrases) { keywords.Add(keyword); } } }
public string AddNewDocsOffUko(Docs _newdoc) { try { SqlCommand cmd = new SqlCommand("AddDocumentToUko", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ID", _newdoc.Id); cmd.Parameters.AddWithValue("@DocName", nullCheck.checkStringNull(_newdoc.Name)); cmd.Parameters.AddWithValue("@DocFile", nullCheck.checkStringNull(_newdoc.File)); con.Open(); cmd.ExecuteNonQuery(); con.Close(); return("Документ добавлен"); } catch { con.Close(); throw; } }
/// <summary> /// Loads docs from a file. /// </summary> /// <param name="docsPath">The messagepack docs file to read from.</param> /// <returns>An instance of <see cref="Docs"/> that accesses the documentation in the file specified by <paramref name="docsPath"/>.</returns> public static Docs Get(string docsPath) { lock (DocsByPath) { if (DocsByPath.TryGetValue(docsPath, out Docs? existing)) { return(existing); } } using FileStream docsStream = File.OpenRead(docsPath); Dictionary <string, ApiDetails>?data = MessagePackSerializer.Deserialize <Dictionary <string, ApiDetails> >(docsStream); var docs = new Docs(data); lock (DocsByPath) { if (DocsByPath.TryGetValue(docsPath, out Docs? existing)) { return(existing); } DocsByPath.Add(docsPath, docs); return(docs); } }
public virtual void CadastraDados() { Pessoa novapessoa; Console.WriteLine("Digite seu nome"); string nome = Console.ReadLine(); Console.WriteLine("Digite sua Cidade"); string cidade = Console.ReadLine(); Console.WriteLine("Digite sua data de nascimento"); string dataNasc = Console.ReadLine(); Console.WriteLine("Digite seu estado"); string estado = Console.ReadLine(); Console.WriteLine("Digite o numero do endereço"); int numEndereco = Convert.ToInt32(Console.ReadLine()); Docs _docs = new Docs(); string _cpfCnpj = _docs.LerCPFCNPJ(); string _tipoPessoa = _docs.PedeCpfOuCnpj(ref _cpfCnpj); novapessoa = new Pessoa(nome, cidade, dataNasc, numEndereco, _tipoPessoa, estado, _cpfCnpj); _pessoaDao.CadastraDados(novapessoa); Console.Clear(); Console.WriteLine("Pessoa cadastrada com sucesso \n Pressione qualquer tecla para voltar ao menu"); Console.ReadKey(); Console.Clear(); }
public static async Task <List <AzureSentiment> > VaderSentimentAnalytics(Docs json, string score_type, bool stopword) { SentimentIntensityAnalyzer analyzer = new SentimentIntensityAnalyzer(); List <AzureSentiment> azureSentiments = new List <AzureSentiment> { }; foreach (var item in json.documents) { string text = item.text; if (stopword) { //if stops words, clean the text. text = Stopword.cleaner(item.text); } var score = analyzer.PolarityScores(text); var type = new Hashtable { { "compound", score.Compound }, { "neutral", score.Neutral }, { "positive", score.Positive }, { "negative", score.Negative } }; azureSentiments.Add(new AzureSentiment { id = item.id, score = (double)type[score_type] }); } return(azureSentiments.ToList()); }
async Task Rename(DocumentReference docRef, string newName) { try { var oldIndex = Docs.FindIndex(x => x.File.Path == docRef.File.Path); var r = await docRef.Rename(newName); if (r) { Console.WriteLine("RENAME to {0}: {1}", newName, r); if (oldIndex >= 0) { await LoadDocs(); var newIndex = Docs.FindIndex(x => x.File.Path == docRef.File.Path); if (newIndex >= 0 && newIndex != oldIndex) { docsView.ShowItem(newIndex, true); } } } else { alert = new UIAlertView("Failed to Rename", "You may not have permission.", null, "OK"); alert.Show(); } // AppDelegate.Shared.UpdateDocListName (docIndex); } catch (Exception ex) { Debug.WriteLine(ex); } }
public List <Docs> findList(string mail) { List <Docs> l = new List <Docs>(); if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); MySqlCommand cmd = new MySqlCommand("select * from Docs where clientId=@clientmail", con); cmd.Parameters.AddWithValue("@clientmail", mail); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Docs p = new Docs(); p.Id = Convert.ToInt32(reader["Id"].ToString()); p.clientId = reader["clientId"].ToString(); p.Name = reader["Name"].ToString(); p.ContentType = reader["ContentType"].ToString(); p.Data = (byte[])reader["Data"]; p.Request = reader["Request"].ToString(); l.Add(p); } con.Close(); return(l); }
public Docs findProofdoc(int id) { Docs p = new Docs(); using (MySqlCommand cmd = new MySqlCommand()) { if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); cmd.CommandText = "select Name, Data, ContentType,Request from Docs where Id=@Id"; cmd.Parameters.AddWithValue("@Id", id); cmd.Connection = con; using (MySqlDataReader sdr = cmd.ExecuteReader()) { sdr.Read(); p.Data = (byte[])sdr["Data"]; p.ContentType = sdr["ContentType"].ToString(); p.Name = sdr["Name"].ToString(); p.Request = sdr["Request"].ToString(); } con.Close(); } return(p); }
public static string BuildSeeAlsoList(Docs docs, ECMAStore store) { if ((docs.AltMemberCommentIds == null || docs.AltMemberCommentIds?.Count == 0) && (docs.Related == null || docs.Related?.Count == 0)) { return(null); } StringBuilder sb = new StringBuilder(); if (docs.AltMemberCommentIds != null) { foreach (var altMemberId in docs.AltMemberCommentIds) { var uid = altMemberId.ResolveCommentId(store)?.Uid ?? altMemberId.Substring(altMemberId.IndexOf(':') + 1); uid = System.Web.HttpUtility.UrlEncode(uid); sb.AppendLine($"- <xref:{uid}>"); } } if (docs.Related != null) { foreach (var rTag in docs.Related) { var uri = rTag.Uri.Contains(' ') ? rTag.Uri.Replace(" ", "%20") : rTag.Uri; sb.AppendLine($"- [{rTag.OriginalText}]({uri})"); } } return(sb.ToString()); }
public Docs findSfdoc(string uid) { Docs p = new Docs(); using (MySqlCommand cmd = new MySqlCommand()) { while (con.State == ConnectionState.Open) { System.Threading.Thread.Sleep(500); } con.Open(); cmd.CommandText = "select * from Docs where clientId=@cid AND Request=@Request"; cmd.Parameters.AddWithValue("@cid", uid); cmd.Parameters.AddWithValue("@Request", "Source Loan 2"); cmd.Connection = con; MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { p.Data = (byte[])reader["Data"]; p.ContentType = reader["ContentType"].ToString(); p.Name = reader["Name"].ToString(); p.Request = reader["Request"].ToString(); } con.Close(); } return(p); }
public static void GetTfIdfFile() { var indexWords = CommonService.IndexWords; var idfDictionary = CommonService.IdfWords; var docs = new List <Docs>(); foreach (var file in CommonService.SortedLemmitedFiles) { var words = File.ReadAllLines(file); var tfDictionary = GetWordsLengthInFile(words); var tfIdfValues = GetThIdfWords(tfDictionary, idfDictionary); Docs document = new Docs { DocumentName = Path.GetFileNameWithoutExtension(file), ThIdfWords = tfIdfValues, VectorLength = Math.Sqrt(tfIdfValues.Select(x => x.TfIdf).Sum(y => Math.Pow(y, 2))) }; docs.Add(document); } var json = JsonConvert.SerializeObject(docs); File.WriteAllText($@"{CommonService.ProjectDir}\Resources\TfIdf\TfIdf.json", json); }
public static async Task <string> CallTextAnalyticsAPI(Docs json, string RequestType, string azure_key) { var queryString = HttpUtility.ParseQueryString(string.Empty); client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", azure_key); var uri = $"https://actualizer.cognitiveservices.azure.com/text/analytics/v2.1/" + RequestType + queryString; Console.WriteLine(uri); HttpResponseMessage response; string output = JsonSerializer.Serialize(json); byte[] byteData = Encoding.UTF8.GetBytes(output); using (var content = new ByteArrayContent(byteData)) { content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); response = await client.PostAsync(uri, content); string res = ""; using (HttpContent x = response.Content) { // ... Read the string. Task <string> result = x.ReadAsStringAsync(); res = result.Result; return(res); } } }
public void OnGet(int Id) { TargetDirectory = m_documentManager.GetTargetDirectoryByID(Id); string[] filesindirectory = Directory.GetDirectories(TargetDirectory.DirectoryPath); FilePaths = filesindirectory.ToList(); Docs = m_context.DMS.ToList(); //for elke filepath kijken of deze al bestaat, anders toevoegen aan DB foreach (var item in FilePaths) { var newPath = Docs.Find(x => x.FilePath == item); if (newPath == null) { TargetDirectory.FilePaths.Add(new Models.DMS { FilePath = item, DocumentLevel = Models.DocumentLevel.Invisible }); //add new => document always invisible m_context.SaveChanges(); } else { //path already in DataBase => content will still be available } } Docs = TargetDirectory.FilePaths.ToList(); }
public async Task <SingleResponse <Docs> > UpdateDocsAsync(Docs docs, Type type) { var response = new SingleResponse <Docs>(); var EntityTypeId = DbContext.GetEntityTypeIdByEntityTypeName(type).Result; docs.EntityTypeId = EntityTypeId; var entity = GetDocsAsync((int)docs.EntityTypeId, (int)docs.EntityId, (int)docs.DocumentTypeId); if (entity.Result.Model != null) { entity.Result.Model.DocumentPath = docs.DocumentPath; entity.Result.Model.IsDocumentSigned = docs.IsDocumentSigned; entity.Result.Model.LanguageId = docs.LanguageId; DbContext.Update(entity.Result.Model, UserInfo); await DbContext.SaveChangesAsync(); } response.SetMessageSucssesPost(nameof(UpdateDocsAsync), docs.EntityId ?? 0); response.Model = docs; return(response); }
public IEnumerable <IDictionary <string, string> > Search(string q) { q = q.ToLower(); // by default, results will not include dropped objects, but you can add dropped:? to over-ride this if (!q.Contains("dropped:")) { q = string.Format("({0}) -dropped:true", q); } var query = _parser.Parse(q); var topFieldCollector = TopFieldCollector.Create( sort: Sort.RELEVANCE, numHits: _resultsLimit, fillFields: false, trackDocScores: true, trackMaxScore: false, docsScoredInOrder: false ); _searcher.Search(query, topFieldCollector); var topDocs = topFieldCollector.TopDocs(); if (topDocs == null) { return(Enumerable.Repeat(new Dictionary <string, string>(), 0)); } var results = topDocs.ScoreDocs.Select(hit => Docs.DocToDict(_searcher.Doc(hit.Doc), hit.Score)).ToArray(); _logger.Debug("Search of '{0}' return {1} results.", q, results.Count()); return(results); }
public DocController(Common.Data.IUnitOfWork unitOfWork, Docs.Api.Repositories.DocRepository.IDocRepository docRepository, Docs.Api.Repositories.ClassificationRepository.IClassificationRepository classificationRepository, Docs.Api.Repositories.EmailRepository.IEmailRepository emailRepository) { this.unitOfWork = unitOfWork; this.docRepository = docRepository; this.classificationRepository = classificationRepository; this.emailRepository = emailRepository; }
public ChecklistController(Common.Data.IUnitOfWork unitOfWork, Aop.Api.Repositories.Aop.IAppRepository appRepository, Docs.Api.Repositories.DocRepository.IDocRepository docRepository, Aop.Api.WordTemplates.IDataGenerator dataGenerator) { this.unitOfWork = unitOfWork; this.appRepository = appRepository; this.docRepository = docRepository; this.dataGenerator = dataGenerator; }
public IndexReplication() { #region indexreplication1 var q = new Question { Title = "How to replicate to relational database?", Votes = new[] { new Vote { Up = true, Comment = "Good!" }, new Vote { Up = false, Comment = "Nah!" }, new Vote { Up = true, Comment = "Nice..." }, new Vote { Up = false, Comment = "No!" } } }; #endregion var docs = new Docs(); var z = #region indexreplication2 // Questions/TitleAndVoteCount from question in docs.Questions select new { Title = question.Title, UpVotes = question.Votes.Count(x => x.Up), DownVotes = question.Votes.Count(x => !x.Up) }; #endregion #region indexreplication3 new Raven.Bundles.IndexReplication.Data.IndexReplicationDestination { Id = "Raven/IndexReplication/Questions/TitleAndVoteCount", ColumnsMapping = { { "Title", "Title" }, { "UpVotes", "UpVotes" }, { "DownVotes", "DownVotes" }, }, ConnectionStringName = "Reports", PrimaryKeyColumnName = "Id", TableName = "QuestionSummaries" }; #endregion }
public AdmissionsController( IUnitOfWork unitOfWork, ILotRepository lotRepository, IAdmissionRepository admissionRepository, Docs.Api.Repositories.DocRepository.IDocRepository docRepository, ILotEventDispatcher lotEventDispatcher) { this.unitOfWork = unitOfWork; this.lotRepository = lotRepository; this.admissionRepository = admissionRepository; this.docRepository = docRepository; this.lotEventDispatcher = lotEventDispatcher; }
private static Docs PullFromFile() { string methodsIndex = File.ReadAllText("..\\..\\html\\methods.htm"); string typesIndex = File.ReadAllText("..\\..\\html\\types.htm"); var docs = new Docs { MethodsIndex = methodsIndex, TypesIndex = typesIndex }; PullMethodDocsFromFile(docs); PullTypesFromFile(docs); return docs; }
private static void PullMethodDocsFromFile(Docs docs) { foreach (MethodGroup group in docs.MethodGroups) { foreach (MethodInfo method in group.Methods) { string methodName = method.Name; string filename = "..\\..\\html\\methods\\" + methodName + ".htm"; string source = File.ReadAllText(filename); method.Source = source; } } }
private static Docs PullFromWeb() { var client = new WebClient(); string methodsIndex = client.DownloadString("https://api.stackexchange.com/docs"); File.WriteAllText("..\\..\\html\\methods.htm", methodsIndex); string typesIndex = client.DownloadString("https://api.stackexchange.com/docs?tab=type"); File.WriteAllText("..\\..\\html\\types.htm", typesIndex); var docs = new Docs { MethodsIndex = methodsIndex, TypesIndex = typesIndex }; PullMethodDocsFromWeb(docs); PullTypeDocsFromWeb(docs); return docs; }
private static void PullMethodDocsFromWeb(Docs docs) { foreach (MethodGroup group in docs.MethodGroups) { foreach (MethodInfo method in group.Methods) { string methodName = method.Name; if (string.IsNullOrEmpty(methodName)) { throw new Exception("methodName null"); } var client = new WebClient(); string filename = "..\\..\\html\\methods\\" + methodName + ".htm"; string source = client.DownloadString("https://api.stackexchange.com" + method.Url); method.Source = source; File.WriteAllText(filename, source); new AutoResetEvent(false).WaitOne(1000); } } }
public DocListItemDO(Docs.Api.Models.Doc d, UnitUser unitUser = null) : this() { if (d != null) { this.DocId = d.DocId; this.RegDate = d.RegDate; this.RegUri = d.RegUri; this.DocSubject = d.DocSubject; if (d.DocStatus != null) { this.DocStatusName = d.GetDocStatusName(); } if (d.DocType != null) { this.DocTypeName = d.DocType.Name; } if (d.DocDirection != null) { this.DocDirectionName = d.DocDirection.Name; } if (d.DocHasReads != null && d.DocHasReads.Any()) { this.IsRead = d.DocHasReads.Any(e => e.HasRead); } if (d.DocSourceType != null) { this.IsElectronic = d.DocSourceType.Alias == "Internet"; } } }
public TypeInfo(Docs docs) { Docs = docs; Fields = new List<FieldInfo>(); }
public static void setRngValue(Docs doc, int rowToPaste = 1, string msg = "") { Log.set("setRngValue"); int r0 = doc.Body.LBoundR(), r1 = doc.Body.iEOL(), c0 = doc.Body.LBoundC(), c1 = doc.Body.iEOC(); try { object[,] obj = new object[r1, c1]; for (int i = 0; i < r1; i++) for (int j = 0; j < c1; j++) obj[i, j] = doc.Body[i + 1, j + 1]; r1 = r1 - r0 + rowToPaste; r0 = rowToPaste; Excel.Worksheet Sh = doc.Sheet; Excel.Range cell1 = Sh.Cells[r0, c0]; Excel.Range cell2 = Sh.Cells[r1, c1]; Excel.Range rng = Sh.Range[cell1, cell2]; rng.Value2 = obj; for(int i=1; i <= c1; i++) Sh.Columns[i].AutoFit(); } catch (Exception e) { if (msg == "") { msg = "Range[ [" + r0 + ", " + c0 + "] , [" + r1 + ", " + c1 + "] ]"; } Log.FATAL(msg); } Log.exit(); }
public DocDO(Docs.Api.Models.Doc d, UnitUser unitUser = null) : this() { if (d != null) { this.DocId = d.DocId; this.DocDirectionId = d.DocDirectionId; this.DocEntryTypeId = d.DocEntryTypeId; this.DocSourceTypeId = d.DocSourceTypeId; this.DocDestinationTypeId = d.DocDestinationTypeId; this.DocSubject = d.DocSubject; this.DocBody = d.DocBody; this.DocStatusId = d.DocStatusId; this.DocTypeId = d.DocTypeId; this.DocFormatTypeId = d.DocFormatTypeId; this.DocCasePartTypeId = d.DocCasePartTypeId; this.DocRegisterId = d.DocRegisterId; this.RegUri = d.RegUri; this.RegIndex = d.RegIndex; this.RegNumber = d.RegNumber; this.RegDate = d.RegDate; this.ExternalRegNumber = d.ExternalRegNumber; this.CorrRegNumber = d.CorrRegNumber; this.CorrRegDate = d.CorrRegDate; this.ReceiptOrder = d.ReceiptOrder; this.AccessCode = d.AccessCode; this.AssignmentTypeId = d.AssignmentTypeId; this.AssignmentDate = d.AssignmentDate; this.AssignmentDeadline = d.AssignmentDeadline; this.IsCase = d.IsCase; this.IsRegistered = d.IsRegistered; this.IsSigned = d.IsSigned; this.HasIncommingDocs = d.DocIncomingDocs != null && d.DocIncomingDocs.Any(); this.IsActive = d.IsActive; this.Version = d.Version; if (d.DocType != null) { this.DocTypeGroupId = d.DocType.DocTypeGroupId; this.DocTypeAlias = d.DocType.Alias; this.DocTypeName = d.DocType.Name; this.DocTypeIsElectronicService = d.DocType.IsElectronicService; } if (d.DocDirection != null) { this.DocDirectionAlias = d.DocDirection.Alias; this.DocDirectionName = d.DocDirection.Name; } if (d.DocEntryType != null) { this.DocEntryTypeAlias = d.DocEntryType.Alias; this.DocEntryTypeName = d.DocEntryType.Name; } if (d.DocStatus != null) { this.DocStatusAlias = d.DocStatus.Alias; this.DocStatusName = d.GetDocStatusName(); } if (d.DocCasePartType != null) { this.DocCasePartTypeAlias = d.DocCasePartType.Alias; this.DocCasePartTypeName = d.DocCasePartType.Name; } this.UnitUser = new UnitUserDO(unitUser); if (d.DocHasReads != null && unitUser != null) { this.IsRead = d.DocHasReads.Any(e => e.UnitId == unitUser.UnitId && e.HasRead); } if (d.DocSourceType != null) { this.IsElectronic = d.DocSourceType.Alias == "Internet"; } } }
public CorrespondentController(Common.Data.IUnitOfWork unitOfWork, Docs.Api.Repositories.CorrespondentRepository.ICorrespondentRepository correspondentRepository) { this.unitOfWork = unitOfWork; this.correspondentRepository = correspondentRepository; }
public MethodInfo(Docs docs) { Docs = docs; Parameters = new List<Parameter>(); RequiredScopes = new List<string>(); }
private static void PullTypesFromFile(Docs docs) { // have to add this manually - is not linked from doc index //docs.Types.Add(new TypeInfo(docs) { Url = "/docs/types/related-site", Type = "related-site", Name = "related_site" }); docs.Types.Add(new TypeInfo(docs) { Url = "/docs/wrapper", Type = "response-wrapper", Name = "response_wrapper" }); var types = docs.Types.ToArray(); foreach (var type in types) { if (string.IsNullOrEmpty(type.Type)) { throw new Exception("typename null"); } if (type.Inferred) { continue; } string filename = "..\\..\\html\\types\\" + type.Type + ".htm"; string source = File.ReadAllText(filename); type.Source = source; } }
private static void PullTypeDocsFromWeb(Docs docs) { // have to add this manually - is not linked from doc index // docs.Types.Add(new TypeInfo(docs) { Url = "/docs/types/related-site", Type = "related-site", Name = "related_site" }); docs.Types.Add(new TypeInfo(docs) { Url = "/docs/wrapper", Type = "response-wrapper", Name = "response_wrapper" }); var types = docs.Types.ToArray(); foreach (var type in types) { if(type.Inferred) { // we made it up - not going to be online continue; } string typeName = type.Type; if (string.IsNullOrEmpty(typeName)) { throw new Exception("typename null"); } var client = new WebClient(); string filename = "..\\..\\html\\types\\" + typeName + ".htm"; string source = client.DownloadString("https://api.stackexchange.com" + type.Url); type.Source = source; File.WriteAllText(filename, source); new AutoResetEvent(false).WaitOne(1000); } }
/// <summary> /// Returns the documents matched by the query, one <see cref="GetMatchingDocs"/> per /// visited segment. /// </summary> public virtual List<MatchingDocs> GetMatchingDocs() { if (docs != null) { matchingDocs.Add(new MatchingDocs(this.context, docs.DocIdSet, totalHits, scores)); docs = null; scores = null; context = null; } return matchingDocs; }