public void Replace_Comment_Text_Test() { IDataRepository <Journal> dataRepository = new JournalData(); IPerson <Person> userdb = new PersonData(); var user = new Person(); var journal = dataRepository.GetById(1); //if (journal.CommentString.Contains("@")) //{ // Console.WriteLine("True"); // string name = "HARRY"; // int index = journal.CommentString.IndexOf("@"); // journal.CommentString = journal.CommentString.Remove(index, name.Length); // journal.CommentString = journal.CommentString.Insert(index, name); // Console.WriteLine(journal.CommentString); //} string[] words = journal.Journey.ContentString.Split(' '); for (int i = 0; i < words.Count(); i++) { if (words[i].Contains("@")) { words[i] = words[i].Trim('@'); string pattern = "\\b" + $"{words[i]}" + "\\b"; user = userdb.GetUnitByName(words[i]); string replace = $"{user}"; journal.Journey.ContentString = Regex.Replace(journal.Journey.ContentString.Replace("@", ""), pattern, replace, RegexOptions.IgnoreCase); } } Object t = new object(); t = "gfgf" + user + "xcv"; Console.WriteLine(journal.Journey); }
public virtual void OnMouseDown() { int currentCost = LevelData.getCurrentMana(); // show formula if mana is enough or potion has been studied before if ((currentCost - (costOfInspectionPerFormula * inputs.Count) >= 0) || LevelData.isPotionInspected(this.gameObject.name)) { HideAndShowInputsOutputs(true); if (!LevelData.isPotionInspected(this.gameObject.name)) { LevelData.addCost(costOfInspectionPerFormula * inputs.Count * -1); LevelData.addInspectedPotion(this.gameObject.name); } if (!JournalData.isPotionInspected(this.gameObject.name)) { JournalData.addInspectedPotion(this.gameObject.name); } // display formula in dialogue //UpdateDialogue (); // -- do not display formula in dialogue anymore - 7/09/2018 UpdateFormula(); } else if (currentCost - (costOfInspectionPerFormula * inputs.Count) < 0) { Debug.Log("show diag"); dialogue.SetActive(true); // disable buttons behind the dialogue DisableButtons(); } }
public void updateSystemView() { bool[] inspectedPotions = JournalData.getListOfInspectedPotionsThusFar(); for (int i = 0; i < systemViewPotionIOObjs.Count; i++) { GameObject potionObj = systemViewPotionIOObjs[i]; int potionNumberOfObj = Int32.Parse(Regex.Match(potionObj.gameObject.name, @"\d+").Value); Debug.Log("potionNumOfObj = " + potionNumberOfObj); if (inspectedPotions[potionNumberOfObj - 1] == true) { potionObj.SetActive(true); } else { potionObj.SetActive(false); } } /* * for (int i = 0; i < inspectedPotions.Length; i++) * { * //Debug.Log("inspectedPotion[" + i + "] = " + inspectedPotions[i]); * if (inspectedPotions[i] == true) * { * systemViewPotionIOObjs[i].SetActive(true); * } else * { * systemViewPotionIOObjs[i].SetActive(false); * } * }*/ }
public void updatePathsView() { bool[] inspectedPotions = JournalData.getListOfInspectedPotionsThusFar(); Transform[] pathsViewChildren = pathsViewsGameObj.GetComponentsInChildren <Transform>(true); //disable all potions IO foreach (Transform child in pathsViewChildren) { if (child.gameObject.name.Contains("PathsViewJournalp")) { Debug.Log("deactivating " + child.gameObject.name); child.gameObject.SetActive(false); } } //enable only the potions IO that have been inspected for (int i = 0; i < inspectedPotions.Length; i++) { Debug.Log("inspectedPotion[" + i + "] = " + inspectedPotions[i]); if (inspectedPotions[i] == true) { foreach (Transform child in pathsViewChildren) { Debug.Log("child name = " + child.gameObject.name); if (child.gameObject.name.Equals("PathsViewJournalp" + (i + 1).ToString() + "IO")) { Debug.Log("activating " + child.gameObject.name); child.gameObject.SetActive(true); } } } } }
public void Save() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + "/journalData.nut"); JournalData data = new JournalData(); //<<<-------------SAVING DATA--------------->>> Dictionary <string, string> bigdick = new Dictionary <string, string>(); foreach (GameObject obj in j.rumours) { string rum; string texture; if (obj.activeSelf) { rum = obj.GetComponentInChildren <Text>().text; texture = obj.GetComponentsInChildren <RawImage>()[1].texture.name; bigdick.Add(rum, texture); } } data.rumours = bigdick; //<<<-------------END OF SAVING DATA--------------->>> //need a different file for each data bf.Serialize(file, data); file.Close(); }
public async Task <Guid> CreateAsync(JournalData journal) { await _context.AddAsync(journal); await _context.SaveChangesAsync(); return(journal.Id); }
public void GetCreatorOfJournal() { IDataRepository <Journal> journalDb = new JournalData(); var journal = journalDb.GetById(1); var user = journal.Creator; Console.WriteLine(user.FullName); }
void generateJournalFeed(SiteWriter writer, JournalData journal) { var siteDomain = writer.Site.DomainName; var rssWriter = new RSSFeedWriter(journal, siteDomain); var res = _rssTemplate.generateXML(rssWriter); writer.writeFeed(rssWriter, res); }
public static async Task CreateJournal(JournalData journal) { using (var client = new HttpClient()) { var endpointPath = $"{API_PATH}/journal?code={API_KEY}"; await client.PostJsonAsync(endpointPath, journal); } }
void generateJournalPages(SiteWriter writer, JournalData journal) { var indexPage = journal.createIndexPage(); generatePage(writer, indexPage); journal.createPages() .forEach(p => generatePage(writer, p)); }
//TODO: WIP, add JournalPooemManager private static void SaveJournal(JournalAlbumManager albumMgr, BinaryFormatter fmt) { string path = Path.Combine(Application.persistentDataPath, "journal.dat"); FileStream stream = new FileStream(path, FileMode.Create); JournalData jData = new JournalData(albumMgr); fmt.Serialize(stream, jData); stream.Close(); }
public void GetAllJournals_Test() { IDataRepository <Journal> retrieveJournals = new JournalData(); var journals = retrieveJournals.GetAll(); foreach (var journal in journals) { Console.WriteLine(journal.Title); } }
public void GetByCategory_Test() { IDataRepository <Journal> db = new JournalData(); var category = Category.Content; var result = db.GetByCatergory(category, "promise"); foreach (var item in result) { Console.WriteLine(item.Journey); } }
public void GetByCategory_Test_Tag() { IDataRepository <Journal> db = new JournalData(); var category = Category.User; var result = db.GetByCatergory(category, "Sally"); foreach (var item in result) { Console.WriteLine(item.Title); } }
public void GetByTAGZ_Test() { ITags <Journal> tagDB = new JournalData(); IDataRepository <Person> peron = new PersonData(); var person = peron.GetById(3); var result = tagDB.GetByTag(person); foreach (var item in result) { Console.WriteLine(item.Title); } }
public void Tag_Test_2() { IDataRepository <Journal> retrieveJournalDb = new JournalData(); var journal = retrieveJournalDb.GetById(1); // Change Journals to Posts var tags = journal.Tagz; foreach (var item in tags) { if (item is Person) { Console.WriteLine(item.ToString());; } } }
public static async Task <IActionResult> CreateJournal( [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "journal")] HttpRequest req, ILogger log) { var requestBodyTask = new StreamReader(req.Body).ReadToEndAsync(); var str = Environment.GetEnvironmentVariable("GumbySQL-Connection"); var journalRepository = new AzureSQLJournalRepository(str); JournalData journalBody = JsonConvert.DeserializeObject <JournalData>(await requestBodyTask); journalRepository.CreateAsync(journalBody); return(new AcceptedResult()); }
public override JournalState Reduce(JournalState state, AddJournalAction action) { var newJournalData = new JournalData() { Id = Guid.NewGuid(), Name = action.Name, OccurredAt = action.OccurredAt ?? DateTime.UtcNow, ProtectionType = action.ProtectionType ?? ProtectionType.NONE }; state.Journals.Insert(0, newJournalData); return(state); }
private void activateComponentView() { if (JournalData.checkIfHasNotInspectedAnyComponents() == true) { noComponentsRecordedText.SetActive(true); componentViewJournal.SetActive(false); } else { noComponentsRecordedText.SetActive(false); componentViewJournal.SetActive(true); } componentViewTab.GetComponent <Image>().color = new Color32(255, 255, 255, 255); componentViewTab.GetComponentInChildren <Text>().color = new Color32(255, 255, 255, 255); }
public void GetByTag_Text_Test() { // Get Tag by tag text ITag <Journal> uu = new JournalData(); IDataRepository <Content> ui = new CommentData(); Tag tag = new Tag(); tag.TagText = "progress"; var journals = uu.GetByTag(tag); foreach (var journal in journals) { Console.WriteLine($"{journal.Title}"); } }
protected void JournalIDTextChanged(object sender, EventArgs e) { JournalValueObj.JournalID = txtJid.Text; // JournalValueObj.year = txtBoxYear.Text; JournalData j = new JournalData(); j = B.JournalEntryCheckExistance(JournalValueObj); if (j.jid != null) { } else { ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Invalid ID')</script>"); } }
public void AddTagToJournal_Test() { Tag tag = new Tag(); IDataRepository <Journal> retrieveData = new JournalData(); ITag <Journal> itag = new JournalData(); var journal = retrieveData.GetById(1); tag.TagText = "#Play"; journal.Tags.Add(tag); // Adds a tag without # or @ checks itag.AddTag("#Test", journal); foreach (var item in journal.Tags) { Console.WriteLine(item.TagText); } }
private void LoadData() { JournalData jData = SaveSystem.LoadJournal(); //populate unlocks front to back int pageCount = 0; foreach (JournalPage page in pages) { //top is first bool, then mid, then bot, multiply by 3 to move to corresponding chunk of array page.top.unlocked = jData.unlockedData[pageCount * 3]; page.mid.unlocked = jData.unlockedData[(pageCount * 3) + 1]; page.bottom.unlocked = jData.unlockedData[(pageCount * 3) + 2]; pageCount++; } }
public void GetByTag_User_Test() { // Get tag by user IDataRepository <Person> getUser = new PersonData(); var user = getUser.GetById(2); Tag tag = new Tag() { UserTag = user }; ITag <Journal> getbytag = new JournalData(); var journals = getbytag.GetByTag(tag); foreach (var journal in journals) { Console.WriteLine($"{journal.Title}"); } }
public ActionResult JournalContent(string businessPartner, string keywords, string debit, string credit, DateTime startDate, DateTime endDate) { JournalData data = new JournalData(); var results = data.GetSpecificWordGroup(businessPartner, keywords, debit, credit, startDate, endDate); if (Request.IsAjaxRequest()) { if (results.Count() == 0) { return(PartialView("_NoResult")); } else { return(PartialView("_JournalContent", results)); } } return(Content("Ajax通信以外のアクセスはできません")); }
//TODO: WIP, needs testing public static JournalData LoadJournal() { string path = Path.Combine(Application.persistentDataPath, "journal.dat"); if (File.Exists(path)) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); JournalData data = (JournalData)formatter.Deserialize(stream); stream.Close(); return(data); } else { Debug.LogError("Save File Not found in " + path); return(null); } }
public void AddUserToJournal_Test() { IDataRepository <Journal> retrieveJournal = new JournalData(); ITag <Journal> itag = new JournalData(); var journal = retrieveJournal.GetById(1); itag.AddTag("@john", journal); foreach (var user in journal.Tags) { if (user.UserTag.FirstName != null) { Console.WriteLine(user.UserTag.FirstName); } } Console.WriteLine("*****"); foreach (var tag in journal.Tags) { Console.WriteLine(tag.TagText); } }
protected async override Task HandleAsync(AddJournalAction action, IDispatcher dispatcher) { try { var newJournalData = new JournalData() { Id = Guid.NewGuid(), Name = action.Name, OccurredAt = action.OccurredAt ?? DateTime.UtcNow, ProtectionType = action.ProtectionType ?? ProtectionType.NONE }; await HttpClient.PostJsonAsync <List <JournalData> >($"{API_ROOT}/{API_ENDPOINT}", newJournalData); } catch { // Should really dispatch an error action } var completeAction = new FetchJournalAction(); dispatcher.Dispatch(completeAction); }
private void SetExistingimpactFactorDetails(JournalData JournalValueObj) { Business b = new Business(); DataTable dyPO = b.SelectImpactFactorDetails(JournalValueObj); if (dyPO.Rows.Count != 0) { ViewState["ImpactFactorDetails"] = dyPO; GridViewProjectsOutcome.DataSource = dyPO; GridViewProjectsOutcome.DataBind(); GridViewProjectsOutcome.Visible = true; int rowIndex2 = 0; DataTable table = (DataTable)ViewState["ImpactFactorDetails"]; DataRow drCurrentRow2 = null; if (table.Rows.Count > 0) { for (int i = 1; i <= table.Rows.Count; i++) { TextBox impactYear = (TextBox)GridViewProjectsOutcome.Rows[rowIndex2].Cells[1].FindControl("txtYear"); TextBox OneImpactFactor = (TextBox)GridViewProjectsOutcome.Rows[rowIndex2].Cells[2].FindControl("txtImpactFactor"); TextBox FiveYearImpactFactor = (TextBox)GridViewProjectsOutcome.Rows[rowIndex2].Cells[3].FindControl("txtFiveYearImpactFactor"); drCurrentRow2 = table.NewRow(); impactYear.Text = table.Rows[i - 1]["Year"].ToString(); OneImpactFactor.Text = table.Rows[i - 1]["ImpactFactor"].ToString(); FiveYearImpactFactor.Text = table.Rows[i - 1]["FiveImpFact"].ToString(); rowIndex2++; } ViewState["ImpactFactorDetails"] = table; } } else { SetRowDataProjectOutcome(); } }
internal static Mock <DbSet <Journal> > MockDbSetJournal() { var mockDbSetJournal = new Mock <DbSet <Journal> >(); //Create a fluent class if needed, ALWAYS USE THE FUNC<> OVER LOAD TO REFLECT THE CHANGES IN UNDERLYING DATA mockDbSetJournal.As <IQueryable <Journal> >().Setup(m => m.Provider).Returns(() => { return(JournalData.AsQueryable().Provider); }); mockDbSetJournal.As <IQueryable <Journal> >().Setup(m => m.Expression).Returns(() => { return(JournalData.AsQueryable().Expression); }); mockDbSetJournal.As <IQueryable <Journal> >().Setup(m => m.ElementType).Returns(() => { return(JournalData.AsQueryable().ElementType); }); mockDbSetJournal.As <IQueryable <Journal> >().Setup(m => m.GetEnumerator()).Returns(() => { return(JournalData.AsQueryable().GetEnumerator()); }); mockDbSetJournal.Setup(m => m.Include(It.IsAny <string>())).Returns(() => { return(mockDbSetJournal.Object); }); var captured = mockDbSetJournal; mockDbSetJournal.Setup(m => m.Add(It.IsAny <Journal>())).Returns <Journal>(j => { JournalData.Add(j); return(new Journal { Id = captured.Object.Count() + 1 }); }); return(mockDbSetJournal); }
protected void btnGet_Click(object sender, EventArgs e) { // //string postdata = "edition=science&science_year=2011&view=category&RQ=SELECT_ALL&change_limits=&Submit.x=1&SID=V2gNFOjAf5oiD1g75HK&query_new=true"; // string url = "http://admin-apps.webofknowledge.com/JCR/JCR"; // HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); // string s = "edition=science&science_year=2011&view=category&RQ=SELECT_ALL&change_limits=&Submit.x=1&SID=P1imB6kl5KLe8L1h2iI&query_new=true"; // //CookieContainer cookieContainer = new CookieContainer(); // byte[] requestBytes = System.Text.Encoding.UTF8.GetBytes(s); // req.Method = "POST"; // req.Accept = "text/html, application/xhtml+xml, */*"; // req.UserAgent = " Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"; // req.ContentType = "application/x-www-form-urlencoded"; // req.ContentLength = requestBytes.Length; // req.Referer = "http://admin-apps.webofknowledge.com/JCR/JCR?SID=P1imB6kl5KLe8L1h2iI"; //// req.CookieContainer = cookieContainer; // Stream requestStream = req.GetRequestStream(); // requestStream.Write(requestBytes, 0, requestBytes.Length); // requestStream.Close(); // HttpWebResponse res = (HttpWebResponse)req.GetResponse(); // StreamReader sr = new StreamReader(res.GetResponseStream(), System.Text.Encoding.UTF8); // string backstr = sr.ReadToEnd(); HtmlWeb web = new HtmlWeb(); // List<JournalData> journaldatas = new List<JournalData>(); for (int i = 6001; i <= 8321; i += 20)//8321 //for (int i = 1; i <= 20; i += 20) { string url = "http://admin-apps.webofknowledge.com/JCR/JCR?RQ=SELECT_ALL&cursor="+i; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); CookieContainer cookieContainer = new CookieContainer(); cookieContainer.Add(new Cookie("jcrsid", "P2LF2BOHJ@G8H4khk2n", "/", "admin-apps.webofknowledge.com")); request.CookieContainer = cookieContainer; request.Accept = "text/html, application/xhtml+xml, */*"; request.UserAgent = " Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"; request.ContentType = "application/x-www-form-urlencoded"; request.Host = "admin-apps.webofknowledge.com"; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); string text = new StreamReader(response.GetResponseStream()).ReadToEnd(); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(text); HtmlNode rootNode = doc.DocumentNode; //HtmlNodeCollection trs = rootNode.SelectNodes("//table");取出所有的table元素 HtmlNode a = rootNode.SelectSingleNode("//table[@bordercolor='#CCCCCC']");//选出包含索要数据的table HtmlNodeCollection trs = a.SelectNodes(".//tr[position()>2]"); foreach(HtmlNode tr in trs) { JournalData journaldata = new JournalData(); journaldata.JournalTitle = CheckValue(tr.SelectSingleNode(".//td[3]").InnerText); journaldata.Issn = CheckValue(tr.SelectSingleNode(".//td[4]").InnerText); journaldata.TotalCites = Convert.ToInt32(CheckValue(tr.SelectSingleNode(".//td[5]").InnerText)); journaldata.ImpactFactor = Convert.ToDouble(CheckValue(tr.SelectSingleNode(".//td[6]").InnerText)); journaldata.FiveYearIm = Convert.ToDouble(CheckValue(tr.SelectSingleNode(".//td[7]").InnerText)); journaldata.ImmediacyIndex = Convert.ToDouble(CheckValue(tr.SelectSingleNode(".//td[8]").InnerText)); journaldata.Articles = Convert.ToInt32(CheckValue(tr.SelectSingleNode(".//td[9]").InnerText)); journaldata.CitedHalfLife = CheckValue(tr.SelectSingleNode(".//td[10]").InnerText); journaldata.EigenfactorScore = Convert.ToDouble(CheckValue(tr.SelectSingleNode(".//td[11]").InnerText)); journaldata.ArticleInfluenceScore = Convert.ToDouble(CheckValue(tr.SelectSingleNode(".//td[12]").InnerText)); journaldatas.Add(journaldata); } } // rtp.DataSource = journaldatas; // rtp.DataBind(); //SendToTxt(journaldatas,"test"); DataSet dsss = CreateDataset(journaldatas); doExport(dsss.Tables[0],"data"); }