public static async Task <(GenerationReturn generationReturn, LineContent lineContent)> SaveAndGenerateHtml( LineContent toSave, DateTime?generationVersion, IProgress <string> progress) { var validationReturn = await Validate(toSave); if (validationReturn.HasError) { return(validationReturn, null); } Db.DefaultPropertyCleanup(toSave); toSave.Tags = Db.TagListCleanup(toSave.Tags); await Db.SaveLineContent(toSave); await GenerateHtml(toSave, generationVersion, progress); await Export.WriteLocalDbJson(toSave); DataNotifications.PublishDataNotification("Line Generator", DataNotificationContentType.Line, DataNotificationUpdateType.LocalContent, new List <Guid> { toSave.ContentId }); return(await GenerationReturn.Success($"Saved and Generated Content And Html for {toSave.Title}"), toSave); }
public TwoTickets GetEntity(string id) { try { JsonSerializerSettings setting = new JsonSerializerSettings(); setting.NullValueHandling = NullValueHandling.Ignore; TwoTickets ticket = db.OperationTicketSHs.Find(i => i.Abutment_Id.ToString() == id).ToTModel(); string results = ticket.detail; Details details = JsonConvert.DeserializeObject <Details>(results, setting); ticket.detail = ""; DetailsSet detalsSet = new DetailsSet(); detalsSet.optTicket = details.optTicket; List <LinesSet> lineSet = new List <LinesSet>(); List <LinesGet> lineList = details.lines; //循环,给LineSet赋值 if (lineList != null) { foreach (LinesGet line in lineList) { LinesSet setline = new LinesSet(); setline.name = line.name; List <Dictionary <string, string> > dicList = line.lineContentList; List <LineContent> contentList = new List <LineContent>(); if (dicList != null) { foreach (Dictionary <string, string> dic in dicList) { LineContent linecontent = new LineContent(); List <KeyValue> keyList = new List <KeyValue>(); if (dic != null) { foreach (KeyValuePair <string, string> kv in dic) { KeyValue keyValue = new KeyValue(); keyValue.key = kv.Key; keyValue.value = kv.Value; keyList.Add(keyValue); } linecontent.Content = keyList; contentList.Add(linecontent); } } setline.lineContentList = contentList; lineSet.Add(setline); } } detalsSet.lines = lineSet; ticket.detailsSet = detalsSet; } return(ticket); } catch (Exception ex) { Log.Error("TicketsService.GetEntity:" + ex.ToString()); return(null); } }
public PriceItem(TradeItem result) { Item = result; if (Item.Requirements != null) { var requires = new LineContent() { DisplayMode = -1, Name = PriceResources.Requires, Values = new List <LineContentValue> { new LineContentValue() { Type = LineContentType.Simple, Value = string.Join(", ", Item.Requirements.Select(x => { if (x.DisplayMode == 0) { x.DisplayMode = -1; } return(x.Parsed); })), } } }; Item.Requirements.Clear(); Item.Requirements.Add(requires); } if (Item.ItemLevel > 0) { if (Item.Requirements == null) { Item.Requirements = new List <LineContent>(); } Item.Requirements.Add(new LineContent() { DisplayMode = 0, Name = PriceResources.ItemLevel, Values = new List <LineContentValue> { new LineContentValue() { Type = LineContentType.Simple, Value = Item.ItemLevel.ToString(), } }, Order = -1, }); } if (Item.Requirements != null) { Item.Requirements = Item.Requirements.OrderBy(x => x.Order).ToList(); } }
public SingleLineDiv(LineContent dbEntry) { DbEntry = dbEntry; var settings = UserSettingsSingleton.CurrentSettings(); SiteUrl = settings.SiteUrl; SiteName = settings.SiteName; PageUrl = settings.LinePageUrl(DbEntry); }
public static List <Geometry> LineContentToGeometries(LineContent content) { var serializer = GeoJsonSerializer.Create(SpatialHelpers.Wgs84GeometryFactory(), 3); using var stringReader = new StringReader(content.Line); using var jsonReader = new JsonTextReader(stringReader); var featureCollection = serializer.Deserialize <FeatureCollection>(jsonReader); return(featureCollection.Select(x => SpatialHelpers.Wgs84GeometryFactory().CreateGeometry(x.Geometry)) .ToList()); }
public static string LineDivAndScript(LineContent content) { var divScriptGuidConnector = Guid.NewGuid(); var tag = $"<div id=\"Line-{divScriptGuidConnector}\" class=\"leaflet-container leaflet-retina leaflet-fade-anim leaflet-grab leaflet-touch-drag point-content-map\"></div>"; var script = $"<script>lazyInit(document.querySelector(\"#Line-{divScriptGuidConnector}\"), () => singleLineMapInit(document.querySelector(\"#Line-{divScriptGuidConnector}\"), \"{content.ContentId}\"))</script>"; return(tag + script); }
public static async Task GenerateHtml(LineContent toGenerate, DateTime?generationVersion, IProgress <string> progress) { progress?.Report($"Line Content - Generate HTML for {toGenerate.Title}"); var htmlContext = new SingleLinePage(toGenerate) { GenerationVersion = generationVersion }; await htmlContext.WriteLocalHtml(); }
/// <summary> /// Reads all lines in a file, and returns a ILineContent object /// to get content as array or list of string. /// </summary> /// <returns>ILineContent object</returns> public ILineContent ReadAllLines() { LineContent lc; try { lc = new LineContent(File.ReadAllLines(this.filePath)); } catch (SystemException e) { Debug.LogError(e.Message); lc = new LineContent(); } return(lc); }
protected void Page_Load(object sender, EventArgs e) { ZWL.Common.PublicMethod.CheckSession(); if (!Page.IsPostBack) { LineContent = ""; ContentLable = ""; FlowNumber.Text = Request.QueryString["WorkFlowID"].ToString(); string SQL_GetList = "select * from ERPNWorkFlowNode where WorkFlowID=" + Request.QueryString["WorkFlowID"] + " order by NodeSerils asc,ID desc"; DataSet MYDT = ZWL.DBUtility.DbHelperSQL.GetDataSet(SQL_GetList); int i1 = 20; for (int jkl = 0; jkl < MYDT.Tables[0].Rows.Count; jkl++) { //生成的方块偏左 int xleft = 250; //生成的方块高度+60 int xtop = i1; //生成工作流节点块 if (MYDT.Tables[0].Rows[jkl]["NodeAddr"].ToString() == "开始") { ContentLable += "<vml:roundrect id=" + MYDT.Tables[0].Rows[jkl]["NodeSerils"].ToString() + " ondblclick=Edit_Process(" + MYDT.Tables[0].Rows[jkl]["ID"].ToString() + "); style=\"Z-INDEX: 1; LEFT: " + ReturnDefault("10", MYDT.Tables[0].Rows[jkl]["NodeLeft"].ToString()) + "px; VERTICAL-ALIGN: middle; WIDTH: 100px; CURSOR: hand; POSITION: absolute; TOP: " + ReturnDefault("100", MYDT.Tables[0].Rows[jkl]["NodeTop"].ToString()) + "px; HEIGHT: 50px; TEXT-ALIGN: center\" title=\"下一步骤:" + MYDT.Tables[0].Rows[jkl]["NextNode"].ToString() + " -- 默认审批:" + MYDT.Tables[0].Rows[jkl]["SPDefaultList"].ToString() + " -- 审批选择模式:" + MYDT.Tables[0].Rows[jkl]["SPType"].ToString() + " -- 评审模式:" + MYDT.Tables[0].Rows[jkl]["PSType"].ToString() + " -- 当前节点," + MYDT.Tables[0].Rows[jkl]["JieShuHours"].ToString() + "小时未审批自动催办\"; coordsize=\"21600,21600\" arcsize=\"4321f\" fillcolor=\"#00EE00\" receiverName=\"\" receiverID=\"\" readOnly=\"0\" flowFlag=\"0\" flowTitle=\"<b>" + MYDT.Tables[0].Rows[jkl]["NodeSerils"].ToString() + "</b><br>" + MYDT.Tables[0].Rows[jkl]["NodeName"].ToString() + "\" passCount=\"0\" flowType=\"start\" table_id=\"" + MYDT.Tables[0].Rows[jkl]["ID"].ToString() + "\" inset=\"2pt,2pt,2pt,2pt\"><vml:shadowoffset=\"3px,3px\" color=\"#b3b3b3\" type=\"single\" on=\"T\"></vml:shadow><vml:textbox onselectstart=\"return false;\" inset=\"1pt,2pt,1pt,1pt\"><B>" + MYDT.Tables[0].Rows[jkl]["NodeSerils"].ToString() + "</B><BR>" + MYDT.Tables[0].Rows[jkl]["NodeName"].ToString() + "</vml:textbox></vml:roundrect>"; } else if (MYDT.Tables[0].Rows[jkl]["NodeAddr"].ToString() == "结束") { ContentLable += "<vml:roundrect id=" + MYDT.Tables[0].Rows[jkl]["NodeSerils"].ToString() + " ondblclick=Edit_Process(" + MYDT.Tables[0].Rows[jkl]["ID"].ToString() + "); style=\"Z-INDEX: 1; LEFT: " + ReturnDefault("500", MYDT.Tables[0].Rows[jkl]["NodeLeft"].ToString()) + "px; VERTICAL-ALIGN: middle; WIDTH: 100px; CURSOR: hand; POSITION: absolute; TOP: " + ReturnDefault("100", MYDT.Tables[0].Rows[jkl]["NodeTop"].ToString()) + "px; HEIGHT: 50px; TEXT-ALIGN: center\" title=\"下一步骤:结束 -- 默认审批:" + MYDT.Tables[0].Rows[jkl]["SPDefaultList"].ToString() + " -- 审批选择模式:" + MYDT.Tables[0].Rows[jkl]["SPType"].ToString() + " -- 评审模式:" + MYDT.Tables[0].Rows[jkl]["PSType"].ToString() + " -- 当前节点," + MYDT.Tables[0].Rows[jkl]["JieShuHours"].ToString() + "小时未审批自动催办\"; coordsize=\"21600,21600\" arcsize=\"4321f\" fillcolor=\"#F4A8BD\" receiverName=\"\" receiverID=\"\" readOnly=\"0\" flowFlag=\"0\" flowTitle=\"<b>" + MYDT.Tables[0].Rows[jkl]["NodeSerils"].ToString() + "</b><br>" + MYDT.Tables[0].Rows[jkl]["NodeName"].ToString() + "\" passCount=\"0\" flowType=\"end\" table_id=\"" + MYDT.Tables[0].Rows[jkl]["ID"].ToString() + "\" inset=\"2pt,2pt,2pt,2pt\"><vml:shadowoffset=\"3px,3px\" color=\"#b3b3b3\" type=\"single\" on=\"T\"></vml:shadow><vml:textbox onselectstart=\"return false;\" inset=\"1pt,2pt,1pt,1pt\"><B>" + MYDT.Tables[0].Rows[jkl]["NodeSerils"].ToString() + "</B><BR>" + MYDT.Tables[0].Rows[jkl]["NodeName"].ToString() + "</vml:textbox></vml:roundrect>"; } else { //生成的方块高度+60 i1 = i1 + 80; ContentLable += "<vml:roundrect id=" + MYDT.Tables[0].Rows[jkl]["NodeSerils"].ToString() + " ondblclick=Edit_Process(" + MYDT.Tables[0].Rows[jkl]["ID"].ToString() + "); style=\"Z-INDEX: 1; LEFT: " + ReturnDefault(xleft.ToString(), MYDT.Tables[0].Rows[jkl]["NodeLeft"].ToString()) + "px; VERTICAL-ALIGN: middle; WIDTH: 100px; CURSOR: hand; POSITION: absolute; TOP: " + ReturnDefault(xtop.ToString(), MYDT.Tables[0].Rows[jkl]["NodeTop"].ToString()) + "px; HEIGHT: 50px; TEXT-ALIGN: center\" title=\"下一步骤:" + MYDT.Tables[0].Rows[jkl]["NextNode"].ToString() + " -- 默认审批:" + MYDT.Tables[0].Rows[jkl]["SPDefaultList"].ToString() + " -- 审批选择模式:" + MYDT.Tables[0].Rows[jkl]["SPType"].ToString() + " -- 评审模式:" + MYDT.Tables[0].Rows[jkl]["PSType"].ToString() + " -- 当前节点," + MYDT.Tables[0].Rows[jkl]["JieShuHours"].ToString() + "小时未审批自动催办\"; coordsize=\"21600,21600\" arcsize=\"4321f\" fillcolor=\"#EEEEEE\" receiverName=\"\" receiverID=\"\" readOnly=\"0\" flowFlag=\"0\" flowTitle=\"<b>" + MYDT.Tables[0].Rows[jkl]["NodeSerils"].ToString() + "</b><br>" + MYDT.Tables[0].Rows[jkl]["NodeName"].ToString() + "\" passCount=\"0\" flowType=\"\" table_id=\"" + MYDT.Tables[0].Rows[jkl]["ID"].ToString() + "\" inset=\"2pt,2pt,2pt,2pt\"><vml:shadowoffset=\"3px,3px\" color=\"#b3b3b3\" type=\"single\" on=\"T\"></vml:shadow><vml:textbox onselectstart=\"return false;\" inset=\"1pt,2pt,1pt,1pt\"><B>" + MYDT.Tables[0].Rows[jkl]["NodeSerils"].ToString() + "</B><BR>" + MYDT.Tables[0].Rows[jkl]["NodeName"].ToString() + "</vml:textbox></vml:roundrect>"; } //生成工作流箭头线条 if (MYDT.Tables[0].Rows[jkl]["NodeAddr"].ToString() != "结束") { string[] MyNextNode = MYDT.Tables[0].Rows[jkl]["NextNode"].ToString().Split(','); for (int i = 0; i < MyNextNode.Length; i++) { LineContent = LineContent + "<vml:line title=\"\" style=\"DISPLAY: none; Z-INDEX: 2; POSITION: absolute\" to=\"0,0\" from=\"0,0\" coordsize=\"21600,21600\" arcsize=\"4321f\" object=\"" + MyNextNode[i].ToString() + "\" source=\"" + MYDT.Tables[0].Rows[jkl]["NodeSerils"].ToString() + "\" mfrID=\"" + MYDT.Tables[0].Rows[jkl]["NodeSerils"].ToString() + "\"><vml:stroke endarrow=\"block\"></vml:stroke><vml:shadow offset=\"1px,1px\" color=\"#b3b3b3\" type=\"single\" on=\"T\"></vml:shadow></vml:line>"; } } } if (LineContent.Trim().Length == 0) { LineContent = "<br><br><br> <strong style=\"color: #990033;font-size:12px;\">当前流程未定义任何审批节点!请先鼠标右键单击,添加新节点!</strong>"; } } }
public SingleLinePage(LineContent dbEntry) { DbEntry = dbEntry; var settings = UserSettingsSingleton.CurrentSettings(); SiteUrl = settings.SiteUrl; SiteName = settings.SiteName; PageUrl = settings.LinePageUrl(DbEntry); if (DbEntry.MainPicture != null) { MainImage = new PictureSiteInformation(DbEntry.MainPicture.Value); } }
public static async Task WriteLocalJsonData(LineContent geoJsonContent) { var dataFileInfo = new FileInfo(Path.Combine( UserSettingsSingleton.CurrentSettings().LocalSiteLineDataDirectory().FullName, $"Line-{geoJsonContent.ContentId}.json")); if (dataFileInfo.Exists) { dataFileInfo.Delete(); dataFileInfo.Refresh(); } await FileManagement.WriteAllTextToFileAndLogAsync(dataFileInfo.FullName, await GenerateLineJson(geoJsonContent.Line, UserSettingsSingleton.CurrentSettings().LinePageUrl(geoJsonContent))); }
public LineContentEditorWindow(LineContent toLoad) { InitializeComponent(); StatusContext = new StatusControlContext(); StatusContext.RunFireAndForgetBlockingTaskWithUiMessageReturn(async() => { LineContent = await LineContentEditorContext.CreateInstance(StatusContext, toLoad); LineContent.RequestContentEditorWindowClose += (_, _) => { Dispatcher?.Invoke(Close); }; AccidentalCloserHelper = new WindowAccidentalClosureHelper(this, StatusContext, LineContent); await ThreadSwitcher.ResumeForegroundAsync(); DataContext = this; }); }
public async Task L01_HorseshoeMesaLineContent() { var testFile = new FileInfo(Path.Combine(Directory.GetCurrentDirectory(), "TestMedia", "GrandCanyonHorseShoeMesaEastSideLoop.gpx")); Assert.True(testFile.Exists, "GPX Test File Found"); var lineTest = new LineContent { ContentId = Guid.NewGuid(), BodyContent = "Horseshoe Mesa East Side Loop", BodyContentFormat = ContentFormatDefaults.Content.ToString(), CreatedOn = DateTime.Now, CreatedBy = "GPX Import Test", Folder = "GrandCanyon", Title = "Horseshoe Mesa East Side Loop", Slug = "horseshoe-mesa-east-side-loop", ShowInMainSiteFeed = true, Summary = "Horseshoe Mesa East Side Loop", Tags = "grand-canyon, horse-shoe-mesa", UpdateNotesFormat = ContentFormatDefaults.Content.ToString() }; var track = (await SpatialHelpers.TracksFromGpxFile(testFile, DebugTrackers.DebugProgressTracker())) .First(); var stats = SpatialHelpers.LineStatsInMetricFromCoordinateList(track.track); lineTest.ClimbElevation = stats.ElevationClimb; lineTest.DescentElevation = stats.ElevationDescent; lineTest.MinimumElevation = stats.MinimumElevation; lineTest.MaximumElevation = stats.MaximumElevation; lineTest.LineDistance = stats.Length; lineTest.Line = await SpatialHelpers.GeoJsonWithLineStringFromCoordinateList(track.track, false, DebugTrackers.DebugProgressTracker()); var validationResult = await LineGenerator.Validate(lineTest); Assert.IsFalse(validationResult.HasError); var saveResult = await LineGenerator.SaveAndGenerateHtml(lineTest, null, DebugTrackers.DebugProgressTracker()); Assert.IsFalse(saveResult.generationReturn.HasError); }
public PriceItem(TradeItem result) { Item = result; if (Item.RequirementContents != null) { var requirementValues = string.Join(", ", Item.RequirementContents.Select(x => x.Text.Replace(":", ""))); var requires = new LineContent() { Text = $"{PriceResources.Requires} {requirementValues}", Values = new List <LineContentValue> { new LineContentValue() { Type = LineContentType.Simple, Value = requirementValues, } } }; Item.RequirementContents.Clear(); Item.RequirementContents.Add(requires); } if (Item.ItemLevel > 0) { if (Item.RequirementContents == null) { Item.RequirementContents = new List <LineContent>(); } Item.RequirementContents = Item.RequirementContents.Prepend(new LineContent() { Text = $"{PriceResources.ItemLevel}: {Item.ItemLevel}", Values = new List <LineContentValue> { new LineContentValue() { Type = LineContentType.Simple, Value = Item.ItemLevel.ToString(), } }, }) .ToList(); } }
private static List <LineContent> Csv(StreamReader reader) { List <LineContent> fileContents = new List <LineContent>(); reader.ReadLine(); // read until file is ended while (!reader.EndOfStream) { var lineContent = new LineContent(); string pattern = "yyyyMMdd"; // read in CSV file and create objects var line = reader.ReadLine(); var values = line.Split(','); lineContent.DrugID = values[0]; DateTime dt = DateTime.Now; if (DateTime.TryParseExact(values[1], pattern, null, System.Globalization.DateTimeStyles.None, out dt)) { lineContent.BeginDate = dt; } else { lineContent.BeginDate = DateTime.Now; } if (DateTime.TryParseExact(values[2], pattern, null, System.Globalization.DateTimeStyles.None, out dt)) { lineContent.EndDate = dt; } else { lineContent.EndDate = DateTime.Now; } fileContents.Add(lineContent); } return(fileContents); }
public static async Task WriteLocalDbJson(LineContent dbEntry) { var settings = UserSettingsSingleton.CurrentSettings(); var db = await Db.Context(); var jsonDbEntry = JsonSerializer.Serialize(dbEntry); var jsonFile = new FileInfo(Path.Combine(settings.LocalSiteLineContentDirectory(dbEntry).FullName, $"{Names.LineContentPrefix}{dbEntry.ContentId}.json")); if (jsonFile.Exists) { jsonFile.Delete(); } jsonFile.Refresh(); await FileManagement.WriteAllTextToFileAndLogAsync(jsonFile.FullName, jsonDbEntry); var latestHistoricEntries = db.HistoricLineContents.Where(x => x.ContentId == dbEntry.ContentId) .OrderByDescending(x => x.LastUpdatedOn).Take(10); if (!latestHistoricEntries.Any()) { return; } var jsonHistoricDbEntry = JsonSerializer.Serialize(latestHistoricEntries); var jsonHistoricFile = new FileInfo(Path.Combine(settings.LocalSiteLineContentDirectory(dbEntry).FullName, $"{Names.HistoricLineContentPrefix}{dbEntry.ContentId}.json")); if (jsonHistoricFile.Exists) { jsonHistoricFile.Delete(); } jsonHistoricFile.Refresh(); await FileManagement.WriteAllTextToFileAndLogAsync(jsonHistoricFile.FullName, jsonHistoricDbEntry); }
public static async Task <GenerationReturn> Validate(LineContent lineContent) { var rootDirectoryCheck = UserSettingsUtilities.ValidateLocalSiteRootDirectory(); if (!rootDirectoryCheck.Item1) { return(await GenerationReturn.Error($"Problem with Root Directory: {rootDirectoryCheck.Item2}", lineContent.ContentId)); } var commonContentCheck = await CommonContentValidation.ValidateContentCommon(lineContent); if (!commonContentCheck.valid) { return(await GenerationReturn.Error(commonContentCheck.explanation, lineContent.ContentId)); } var updateFormatCheck = CommonContentValidation.ValidateUpdateContentFormat(lineContent.UpdateNotesFormat); if (!updateFormatCheck.isValid) { return(await GenerationReturn.Error(updateFormatCheck.explanation, lineContent.ContentId)); } try { var serializer = GeoJsonSerializer.Create(SpatialHelpers.Wgs84GeometryFactory(), 3); using var stringReader = new StringReader(lineContent.Line); using var jsonReader = new JsonTextReader(stringReader); var featureCollection = serializer.Deserialize <FeatureCollection>(jsonReader); if (featureCollection.Count < 1) { return(await GenerationReturn.Error( "The GeoJson for the line appears to have an empty Feature Collection?", lineContent.ContentId)); } if (featureCollection.Count > 1) { return(await GenerationReturn.Error( "The GeoJson for the line appears to contain multiple elements? It should only contain 1 line...", lineContent.ContentId)); } if (featureCollection[0].Geometry is not LineString) { return(await GenerationReturn.Error( "The GeoJson for the line has one element but it isn't a LineString?", lineContent.ContentId)); } var lineString = featureCollection[0].Geometry as LineString; if (lineString == null || lineString.Count < 1 || lineString.Length == 0) { return(await GenerationReturn.Error("The LineString doesn't have any points or is zero length?", lineContent.ContentId)); } } catch (Exception e) { return(await GenerationReturn.Error( $"Error parsing the FeatureCollection and/or problems checking the LineString {e.Message}", lineContent.ContentId)); } return(await GenerationReturn.Success("Line Content Validation Successful")); }
/// <summary> /// 第三方接口获取 /// </summary> /// <returns></returns> public List <TwoTickets> ListAll() { try { string result = WebApiHelper.GetString("http://120.25.195.214:18000/api/tickets?type=1"); JsonSerializerSettings setting = new JsonSerializerSettings(); setting.NullValueHandling = NullValueHandling.Ignore; Message <TwoTickets> message = JsonConvert.DeserializeObject <Message <TwoTickets> >(result, setting); int total = message.total; string msg = message.msg; List <TwoTickets> list = message.data; //循环获取DetailsSet if (list != null) { foreach (TwoTickets ticket in list) { string results = ticket.detail; Details details = JsonConvert.DeserializeObject <Details>(results, setting); // ticket.detail = ""; DetailsSet detalsSet = new DetailsSet(); detalsSet.optTicket = details.optTicket; List <LinesSet> lineSet = new List <LinesSet>(); List <LinesGet> lineList = details.lines; //循环,给LineSet赋值 if (lineList != null) { foreach (LinesGet line in lineList) { LinesSet setline = new LinesSet(); setline.name = line.name; List <Dictionary <string, string> > dicList = line.lineContentList; List <LineContent> contentList = new List <LineContent>(); if (dicList != null) { foreach (Dictionary <string, string> dic in dicList) { LineContent linecontent = new LineContent(); List <KeyValue> keyList = new List <KeyValue>(); if (dic != null) { foreach (KeyValuePair <string, string> kv in dic) { KeyValue keyValue = new KeyValue(); keyValue.key = kv.Key; keyValue.value = kv.Value; keyList.Add(keyValue); } linecontent.Content = keyList; contentList.Add(linecontent); } } setline.lineContentList = contentList; lineSet.Add(setline); } } detalsSet.lines = lineSet; ticket.detailsSet = detalsSet; } } } Message <TwoTickets> datas = message; return(message.data); } catch (Exception ex) { return(null); } }
public static Envelope GeometryBoundingBox(LineContent content, Envelope envelope = null) { var geometryList = LineContentToGeometries(content); return(GeometryBoundingBox(geometryList, envelope)); }
private void MenuZhongShan_Click(object sender, RoutedEventArgs e) { try { //string result = WebApiHelper.GetString("http://127.0.0.1:8080/zhongshan/login"); // Log.Info(result); //List<sis> list=WebApiHelper.GetEntity<List<sis>>("http://127.0.0.1:8080/zhongshan/login/Sis"); //sis ss = list[0]; //检查项列表 // List<results> resultList = WebApiHelper.GetEntity<List<results>>("http://127.0.0.1:8080/zhongshan/Results/list"); //results result = resultList[0]; //两票列表 //List<tickets> ticketsList = WebApiHelper.GetEntity<List<tickets>>("http://127.0.0.1:8080/zhongshan/Tickets/list"); //int count = ticketsList.Count; //if (count > 0) //{ // tickets ticket = ticketsList[0]; //} //Sis列表 //string kks = "kks001"; // List<sis> sisList= WebApiHelper.GetEntity<List<sis>>("http://127.0.0.1:8080/zhongshan/Sis/list/kks/"+kks); //if (sisList.Count > 0) //{ // sis sis = sisList[0]; //} //两票数据 string result = WebApiHelper.GetString("http://120.25.195.214:18000/api/tickets?type=1"); JsonSerializerSettings setting = new JsonSerializerSettings(); setting.NullValueHandling = NullValueHandling.Ignore; Message <TwoTickets> message = JsonConvert.DeserializeObject <Message <TwoTickets> >(result, setting); int total = message.total; string msg = message.msg; List <TwoTickets> list = message.data; //循环获取DetailsSet if (list != null) { foreach (TwoTickets ticket in list) { string results = ticket.detail; Details details = JsonConvert.DeserializeObject <Details>(results, setting); ticket.detail = ""; DetailsSet detalsSet = new DetailsSet(); detalsSet.optTicket = details.optTicket; List <LinesSet> lineSet = new List <LinesSet>(); List <LinesGet> lineList = details.lines; //循环,给LineSet赋值 if (lineList != null) { foreach (LinesGet line in lineList) { LinesSet setline = new LinesSet(); setline.name = line.name; List <Dictionary <string, string> > dicList = line.lineContentList; List <LineContent> contentList = new List <LineContent>(); if (dicList != null) { foreach (Dictionary <string, string> dic in dicList) { LineContent linecontent = new LineContent(); List <KeyValue> keyList = new List <KeyValue>(); if (dic != null) { foreach (KeyValuePair <string, string> kv in dic) { KeyValue keyValue = new KeyValue(); keyValue.key = kv.Key; keyValue.value = kv.Value; keyList.Add(keyValue); } linecontent.Content = keyList; contentList.Add(linecontent); } } setline.lineContentList = contentList; lineSet.Add(setline); } } detalsSet.lines = lineSet; ticket.detailsSet = detalsSet; } } Message <TwoTickets> aa = message; var xml = XmlSerializeHelper.GetXmlText(aa); } } catch (Exception ex) { //错误 Log.Error(ex.ToString()); } }
public static string Create(LineContent content) { return($@"{{{{{BracketCodeToken} {content.ContentId}; {content.Title}}}}}"); }