public static void GetSelectBMZ(ClassCompositeBMZ selBmz) { _currentCompositeBmz = selBmz; _currentCompositeBmz.CollectFrame.Clear(); GetFrame(); _currentCompositeBmz.dOneSQuestParametr = selBmz.dOneSQuestParametr; _currentCompositeBmz.elementFloor = selBmz.elementFloor; foreach (var vari in selBmz.elementFloor) { for (int i = 0; i < _currentCompositeBmz.CollectFrame.Count; i++) { if (_currentCompositeBmz.CollectFrame.ToArray()[i].position == vari.Key) { DataTable dta = dc.SelectQuery( $"select nameCarc from _carcas where countElementFloor = {vari.Value.Count} AND countTrans = {_currentCompositeBmz.CollectFrame[i].countTrans}"); var ssa2 = dta.AsEnumerable().ToList(); if (ssa2.Count > 0) { var ListFraem = _currentCompositeBmz.CollectFrame.ToArray(); ListFraem[i].nameCarcas = ssa2[0][0].ToString(); _currentCompositeBmz.CollectFrame = new ObservableCollection <ClassCompositeBMZ.Frame>(ListFraem.ToList()); } } } } }
public static void GetAllBMZComposite() { DataClass dc = new DataClass("KontinentDBEntity.db"); DataTable dt = dc.SelectQuery( "select _typeBMZ.idTypeBMZ,_typeBMZ.nameBMZ, _typeBMZ.indexBMZ, _typeBMZ.maxPowerTransform, " + "_typeBMZ.maxWidthVNSecFirst, _typeBMZ.maxWidthVNSecSecond, _typeBMZ.maxWidthNNSecFirst, " + "_typeBMZ.maxWidthNNSecSecond,_typeBMZ.seismicResistance,_typeBMZ.climatExecution, _typeBMZ.pathPNG, " + "_typeBMZ.maxWidth, _typeBMZ.maxLength, " + "_compositeBMZValue.Dg, _compositeBMZValue.Dg2, _compositeBMZValue.Dg3, _compositeBMZValue.H," + "_compositeBMZValue.Shg1, _compositeBMZValue.Shg2, _compositeBMZValue.Shg3, _compositeBMZValue.Shg4, " + "_compositeBMZValue.Dv1, _compositeBMZValue.Dv2," + "_compositeBMZValue.Gv1, _compositeBMZValue.Gv2, " + "_compositeBMZValue.Dn1, _compositeBMZValue.Dn2, " + "_compositeBMZValue.Gn1, _compositeBMZValue.Gn2," + "_compositeBMZValue.Dt, _compositeBMZValue.Shkn , _compositeBMZValue.Shkn2, _compositeBMZValue.Shkv, _compositeBMZValue.Shkv2, " + "_compositeBMZValue.Shmn from _compositeBMZValue " + $"INNER JOIN _typeBMZ on _compositeBMZValue.nameComposite = _typeBMZ.idTypeBMZ ORDER BY _compositeBMZValue.nameComposite," + " _compositeBMZValue.Dg, _compositeBMZValue.Shg1"); var ss = dt.AsEnumerable().ToList(); foreach (var vari in ss) { ClassCompositeBMZ.InformationSet infSet = new ClassCompositeBMZ.InformationSet { maxLength = Convert.ToInt32(vari["maxLength"]), maxWidth = Convert.ToInt32(vari["maxWidth"]), nameBMZ = vari["nameBMZ"].ToString(), indexBMZ = vari["indexBMZ"].ToString(), maxPowerTransform = Convert.ToInt32(vari["maxPowerTransform"]), maxWidthNNSecFirst = Convert.ToInt32(vari["maxWidthNNSecFirst"]), maxWidthNNSecSecond = Convert.ToInt32(vari["maxWidthNNSecSecond"]), maxWidthVNSecFirst = Convert.ToInt32(vari["maxWidthVNSecFirst"]), maxWidthVNSecSecond = Convert.ToInt32(vari["maxWidthVNSecSecond"]), climatExecution = vari["climatExecution"].ToString(), seismicResistance = Convert.ToInt32(vari["seismicResistance"]) }; ClassCompositeBMZ.InformationBuild inf = new ClassCompositeBMZ.InformationBuild(); int.TryParse(vari["Dg"].ToString(), out inf.Dg); int.TryParse(vari["Dg2"].ToString(), out inf.Dg2); int.TryParse(vari["Dg3"].ToString(), out inf.Dg3); inf.Dn1 = Convert.ToInt32(vari["Dn1"]); inf.Dn2 = Convert.ToInt32(vari["Dn2"]); inf.Dt = Convert.ToInt32(vari["Dt"]); inf.Dv1 = Convert.ToInt32(vari["Dv1"]); inf.Dv2 = Convert.ToInt32(vari["Dv2"]); inf.Gn1 = Convert.ToInt32(vari["Gn1"]); inf.Gn2 = Convert.ToInt32(vari["Gn2"]); inf.Gv1 = Convert.ToInt32(vari["Gv1"]); inf.Gv2 = Convert.ToInt32(vari["Gv2"]); inf.H = Convert.ToInt32(vari["H"]); inf.Shg1 = Convert.ToInt32(vari["Shg1"]); inf.Shg2 = Convert.ToInt32(vari["Shg2"]); inf.Shg3 = Convert.ToInt32(vari["Shg3"]); inf.Shg4 = Convert.ToInt32(vari["Shg4"]); inf.Shkn = Convert.ToInt32(vari["Shkn"]); inf.Shkn2 = Convert.ToInt32(vari["Shkn2"]); inf.Shkv = Convert.ToInt32(vari["Shkv"]); inf.Shkv2 = Convert.ToInt32(vari["Shkv"]); inf.Shmn = Convert.ToInt32(vari["Shmn"]); int width = Convert.ToInt32(vari["Shg1"]) + Convert.ToInt32(vari["Shg2"]) + Convert.ToInt32(vari["Shg3"]) + Convert.ToInt32(vari["Shg4"]); int length = Convert.ToInt32(vari["Dg"]); if (inf.Dg2 != 0) { width = inf.Shg1 + inf.Shg2 + inf.Dg2; } if (inf.Dg3 != 0) { length = inf.Shg1 * 2 + inf.Shg2; width = inf.Dg + inf.Shg3 + inf.Dg3; } ClassCompositeBMZ clsBMZ = new ClassCompositeBMZ() { idBMZ = Convert.ToInt32(vari["idTypeBMZ"].ToString()), allWidth = width, allLength = length, NameBMZ = $"{vari["nameBMZ"]} ({vari["indexBMZ"]})", Image = new BitmapImage( new Uri(AppDomain.CurrentDomain.BaseDirectory + @"PNG/" + vari["pathPNG"])), InformationForBuild = inf, InformationForSet = infSet }; _forBuildListBmzComposite.Add(clsBMZ); } }