private void addLSText(string number, TRAVEL travel, string ffFullName) { string l; string s; List <string> ll = new List <string>(); List <string> ls = new List <string>(); string stage = ""; string content = FILEWORK.ReadFileContent(ffFullName); String[] lines = content.Split(new string[] { "\n" }, StringSplitOptions.None); foreach (string line in lines) { if (String.IsNullOrEmpty(line)) { continue; } if (line.ToUpper() == "LENA") { stage = "lena"; continue; } if (line.ToUpper() == "SERGEY") { stage = "sergey"; continue; } if (stage == "lena") { ll.Add(line); } if (stage == "sergey") { ls.Add(line); } } l = string.Join("\n", ll.ToArray()); s = string.Join("\n", ls.ToArray()); TRAVEL.LSTEXT tt = new TRAVEL.LSTEXT(); tt.l = l; tt.s = s; tt.day = number; travel.destrictions.Add(number, tt); }
private string reseatTextInfo(TRAVEL travel, string result) { string licontext = ""; //тут будем сортированно выводить List <TRAVEL.LSTEXT> lstexts = new List <TRAVEL.LSTEXT>(); foreach (string s in travel.order) { TRAVEL.LSTEXT item = travel.destrictions[s]; lstexts.Add(item); } foreach (TRAVEL.LSTEXT item in lstexts) { string templ = liItem; string iday = item.day; templ = templ.Replace("$Id", iday.ToString()); string rr = iday == travel.order.First() ? "active" : ""; templ = templ.Replace("$active", rr); licontext = licontext + templ; } //foreach (KeyValuePair<string, TRAVEL.LSTEXT> keyValue in travel.destrictions) //{ // string templ = liItem; // string iday = keyValue.Key; // templ = templ.Replace("$Id", iday.ToString()); // string rr = iday == "1" ? "active" : ""; // templ = templ.Replace("$active", rr); // licontext = licontext + templ; //} result = result.Replace("$liitems", licontext); string dicontext = ""; foreach (TRAVEL.LSTEXT item in lstexts) { TRAVEL.LSTEXT val = item; string lena = val.l; lena = lena.Replace("\n", "<br>"); string templ = diItem; string iday = item.day; templ = templ.Replace("$Id", iday.ToString()); string rr = iday == travel.order.First() ? "active" : ""; templ = templ.Replace("$active", rr); string s1 = "<div class='nametravelwho'>Лена</div><div class='first_div_capital_blue'><p >" + lena + "</p></div>"; string sergey = val.s; sergey = sergey.Replace("\n", "<br>"); string s2 = "<div class='nametravelwho'>Сергей</div><div class='first_div_capital_green'><p >" + sergey + "</p></div>";; templ = templ.Replace("$text", s1 + s2); dicontext = dicontext + templ; } //foreach (KeyValuePair<string, TRAVEL.LSTEXT> keyValue in travel.destrictions) //{ // TRAVEL.LSTEXT val = keyValue.Value; // string lena = val.l; // lena = lena.Replace("\n", "<br>"); // string templ = diItem; // string iday = keyValue.Key; // templ = templ.Replace("$Id", iday.ToString()); // string rr = iday == "1" ? "active" : ""; // templ = templ.Replace("$active", rr); // string s1 = "<div class='nametravelwho'>Лена</div><div class='first_div_capital_blue'><p >" + lena + "</p></div>"; // string sergey = val.s; // sergey = sergey.Replace("\n", "<br>"); // string s2 = "<div class='nametravelwho'>Сергей</div><div class='first_div_capital_green'><p >" + sergey + "</p></div>"; ; // templ = templ.Replace("$text", s1 + s2); // dicontext = dicontext + templ; //} result = result.Replace("$diitems", dicontext); return(result); }