private NoteDataContract ReadJSONFile(string strFile) { //var obj = JsonConvert.DeserializeObject(strFile); _notedc = new NoteDataContract(); string strJSON = File.ReadAllText(strFile); _notedc = JsonConvert.DeserializeObject <NoteDataContract>(strJSON); return(_notedc); }
public static string FundingSchedule(NoteDataContract noteDC, DateTime?EffDate = null) { string fundschedule = string.Empty; foreach (FutureFundingScheduleTab fundDC in noteDC.ListFutureFundingScheduleTab) { if (fundDC.EffectiveDate == EffDate) { fundschedule += "\r\n" + fundDC.Date.ToString() + ": " + fundDC.Value.ToString(); } } return(fundschedule); }
public static string LiborSchedule(NoteDataContract noteDC, DateTime Start, DateTime End) { string libschedule = string.Empty; foreach (LiborScheduleTab lib in noteDC.ListLiborScheduleTab) { if (lib.Date >= Start && lib.Date <= End) { libschedule += "\r\n" + lib.Date.ToString() + "\t" + lib.Value.ToString(); } } return(libschedule); }
public GenericResult RunNoteCalcCtlrCalcAndSave() { string Url = "http://*****:*****@"C:\Temp\9946.json"); if (_notedc == null) { _notedc = ReadJSONFile(lblFile.Text); } WriteText(_notedc.SaveWithoutCalc); _notedc.SaveWithoutCalc = "N"; if (_notedc != null) { string apiPath = "api/note/CalculateNoteAndSaveByNoteID"; //string serializeJSON = JsonConvert.SerializeObject(json); using (var client = new HttpClient()) { //var res = client.PostAsync(Url + apiPath, new StringContent(serializeJSON, Encoding.UTF8, "application/json")); var res = client.PostAsJsonAsync(Url + apiPath, _notedc); try { HttpResponseMessage response1 = res.Result.EnsureSuccessStatusCode(); if (response1.IsSuccessStatusCode) { // Add code WriteText("Completed Successfully!"); } } catch (System.Exception e) { _Result = new GenericResult() { Succeeded = false, Message = e.StackTrace }; System.Console.WriteLine(e.ToString()); } } } return(_Result); }