public static ClassProp getOranlar(ClassProp t1) { t1.ms = (t1.msev.ToInt() > t1.msds.ToInt() ? "1" : (t1.msds.ToInt() > t1.msds.ToInt() ? "2" : "0")); //maç sonucu t1.h = t1.msev.ToInt() > t1.msds.ToInt() + 1 ? "1" : (t1.msds.ToInt() > t1.msev.ToInt() + 1 ? "2" : "0"); //handikap t1.kg = (t1.msev.ToInt() > 0 && t1.msds.ToInt() > 0) ? "1" : ((t1.msev.ToInt() < 1 && t1.msds.ToInt() < 1) ? "0" : ""); //KG var t1.iy = t1.iyev.ToInt() > 0 ? "1" : (t1.iyds.ToInt() > 0 ? "2" : "0"); //maç sonucu iy t1.yr2 = (t1.msev.ToInt() > 0 ? "1" : (t1.msds.ToInt() > 0 ? "2" : "0")); //maç sonucu 2.yarı t1.alt15iy = (t1.iyev.ToInt() + t1.iyds.ToInt()) < 1 ? "1" : ""; //1,5 alt iy t1.ust15iy = (t1.iyev.ToInt() + t1.iyds.ToInt()) > 1 ? "1" : ""; //1,5 üst iy t1.alt15 = (t1.msev.ToInt() + t1.msds.ToInt()) < 1 ? "1" : ""; //1,5 alt t1.ust15 = (t1.msev.ToInt() + t1.msds.ToInt()) > 1 ? "1" : ""; //1,5 üst t1.alt25 = (t1.msev.ToInt() + t1.msds.ToInt()) < 2 ? "1" : ""; //2,5 alt t1.ust25 = (t1.msev.ToInt() + t1.msds.ToInt()) > 2 ? "1" : ""; //2,5 üst t1.alt35 = (t1.msev.ToInt() + t1.msds.ToInt()) < 3 ? "1" : ""; //3,5 alt t1.ust35 = (t1.msev.ToInt() + t1.msds.ToInt()) > 3 ? "1" : ""; //3,5 üst t1.tg = (t1.msev.ToInt() + t1.msds.ToInt()).ToStr(); //Toplam Gol t1.csiy = t1.iyev.ToInt() > 0 || t1.iyds.ToInt() > 0 ? "1" : ""; //çifte şans iy t1.cs = t1.msev.ToInt() > 0 || t1.msds.ToInt() > 0 ? "1" : ""; //çifte şans return(t1); }
public static oranlarClass getRow(List <HtmlAgilityPack.HtmlNode> nodes, oranlarClass row, int takim) { int toplamrekabetSayisi = 0; if (nodes != null) { var noodeRow = nodes.Where(o => o.Name == "div").ToList(); List <ClassProp> listProp = new List <ClassProp>(); noodeRow.ForEach(oranlar => { var node = oranlar.ChildNodes.Where(oo => oo.Name == "div" && oo.InnerText != "").ToList(); if (node.Count > 0) { var t1 = new ClassProp(); if (takim == 1)//takim2 { t1 = new ClassProp() { ev = node[3].InnerText.Trim(), msev = node[2].InnerText.Trim().Substring(0, 1), ds = node[5].InnerText.Trim(), msds = node[2].InnerText.Trim().Substring(2, 1), iyev = node[4].InnerText.Length < 2 ? "" : node[4].InnerText.Trim().Substring(0, 1), iyds = node[4].InnerText.Length < 2 ? "" : node[4].InnerText.Trim().Substring(2, 1), }; t1 = getOranlar(t1); listProp.Add(t1); } else if (takim > 1)//takim2 { t1 = new ClassProp() { ev = node[0].InnerText.Trim(), msev = node[1].InnerText.Trim().Substring(0, 1), ds = node[2].InnerText.Trim(), msds = node[1].InnerText.Trim().Substring(2, 1), iyev = node[5].InnerText.Length < 2 ? "" : node[5].InnerText.Trim().Substring(0, 1), iyds = node[5].InnerText.Length < 2 ? "" : node[5].InnerText.Trim().Substring(2, 1), }; t1 = getOranlar(t1); listProp.Add(t1); } else //takim1 { node.ForEach(oran => { var orans = oran.ChildNodes.Where(oo => oo.Name == "div" && oo.InnerText != "").ToList(); t1 = new ClassProp() { ev = orans[2].InnerText.Trim(), msev = orans[3].InnerText.Trim().Substring(0, 1), ds = orans[4].InnerText.Trim(), msds = orans[3].InnerText.Trim().Substring(2, 1), iyev = orans[5].InnerText.Trim().Length < 2 ? "" : orans[5].InnerText.Trim().Substring(0, 1), iyds = orans[5].InnerText.Trim().Length < 2 ? "" : orans[5].InnerText.Trim().Substring(2, 1), }; t1 = getOranlar(t1); listProp.Add(t1); }); } } }); toplamrekabetSayisi = listProp.Count(); if (listProp.Count < 1) { return(row); } var ev = listProp.Where(o => o.ev.toCustomTr() == row.ev.toCustomTr()).ToList(); var ds = listProp.Where(o => o.ev.toCustomTr() != row.ev.toCustomTr()).ToList(); if (takim > 0) { ev = listProp.Where(o => o.ev.toCustomTr() == row.ev.toCustomTr()).ToList(); ds = listProp.Where(o => o.ev.toCustomTr() != row.ev.toCustomTr()).ToList(); } row.X = (listProp.Where(o => o.ms == "0").Count()).ToStr(); row.evGalip = (ev.Where(o => o.ms == "1").Count()).ToStr(); row.dsGalip = (ds.Where(o => o.ms == "1").Count()).ToStr(); row.h1 = (ev.Where(o => o.ms == "1").Count()).ToStr(); row.hX = (listProp.Where(o => o.ms == "0").Count()).ToStr(); row.h2 = (ds.Where(o => o.ms == "1").Count()).ToStr(); row.KgVar = (listProp.Where(o => o.kg == "1").Count()).ToStr(); row.KgYok = (listProp.Where(o => o.kg == "0").Count()).ToStr(); row.iy1 = (ev.Where(o => o.iyev == "1").Count()).ToStr(); row.iy2 = (ds.Where(o => o.iyds == "1").Count()).ToStr(); row.yr2_1 = (ev.Where(o => o.yr2 == "1").Count()).ToStr(); row.yr2_2 = (ds.Where(o => o.yr2 == "1").Count()).ToStr(); row.yr2_X = (listProp.Where(o => o.yr2 == "0").Count()).ToStr(); row.alt15iy = (listProp.Where(o => o.alt15iy == "1").Count()).ToStr(); row.ust15iy = (listProp.Where(o => o.ust15iy == "1").Count()).ToStr(); row.alt25 = (listProp.Where(o => o.alt25 == "1").Count()).ToStr(); row.ust25 = (listProp.Where(o => o.ust25 == "1").Count()).ToStr(); row.alt35 = (listProp.Where(o => o.alt35 == "1").Count()).ToStr(); row.ust35 = (listProp.Where(o => o.ust35 == "1").Count()).ToStr(); row.csiy = (listProp.Where(o => o.csiy == "1").Count()).ToStr(); row.cs = (listProp.Where(o => o.cs == "1").Count()).ToStr(); row.tg = (listProp.Sum(o => o.tg.ToDecimal()) / toplamrekabetSayisi).ToString("0.##"); row.noSetValueCustom <oranlarClass>("X,ev,ds,Sayi,MacKodu,evRekabet,dsRekabet,tg", 100, toplamrekabetSayisi); if (takim < 1) { row.evRekabet = toplamrekabetSayisi.ToStr() + "/" + ((row.evGalip.ToInt() * toplamrekabetSayisi) / 100).ToStr(); row.dsRekabet = toplamrekabetSayisi.ToStr() + "/" + ((row.dsGalip.ToInt() * toplamrekabetSayisi) / 100).ToStr(); } } else { row.evRekabet = "-"; row.dsRekabet = "-"; } return(row); }
/// <summary> /// 获取SelectedClass /// </summary> /// <param name="applicationStr"></param> /// <param name="name"></param> /// <param name="codeClass"></param> /// <returns></returns> private SelectedClass GetSelectedClass(string applicationStr, string name, string cnName, string description, CodeClass codeClass) { Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread(); var selectEdClass = new SelectedClass(applicationStr, name); List <ClassProp> classProps = new List <ClassProp>(); var codeMembers = codeClass.Members; foreach (CodeElement codeMember in codeMembers) { List <ClassPropAttribute> classAttributes = new List <ClassPropAttribute>(); // 如果是属性 if (codeMember.Kind == vsCMElement.vsCMElementProperty) { CodeProperty property = codeMember as CodeProperty; ClassProp classProp = new ClassProp(property.Name); //获取属性类型 var propertyType = property.Type; switch (propertyType.AsFullName) { case "System.Int64": classProp.PropertyType = "long"; break; case "System.Nullable<System.Int64>": classProp.PropertyType = "long?"; break; case "System.Int32": classProp.PropertyType = "int"; break; case "System.Nullable<System.Int32>": classProp.PropertyType = "int?"; break; case "System.DateTime": classProp.PropertyType = "DateTime"; break; case "System.Nullable<System.DateTime>": classProp.PropertyType = "DateTime?"; break; case "System.Guid": classProp.PropertyType = "Guid"; break; case "System.Nullable<System.Guid>": classProp.PropertyType = "Guid?"; break; case "System.String": classProp.PropertyType = "string"; break; case "System.Nullable<System.String>": classProp.PropertyType = "string?"; break; //枚举 default: classProp.PropertyType = propertyType.AsFullName.Split('.').LastOrDefault(); break; } //获取属性特性 foreach (CodeAttribute codeAttribute in property.Attributes) { ClassPropAttribute classAttribute = new ClassPropAttribute(); if (codeAttribute.Name == "Required") { classAttribute.NameValue = "[Required]"; classAttribute.Name = "Required"; classAttribute.Value = "true"; } else { classAttribute.NameValue = "[" + codeAttribute.Name + "(" + codeAttribute.Value + ")]"; classAttribute.Name = codeAttribute.Name; classAttribute.Value = codeAttribute.Value; } classAttributes.Add(classAttribute); } classProps.Add(classProp); } } selectEdClass.CodeProps = classProps; return(selectEdClass); }