public static void GetFraems() { int widthForWhere = 0; fr.notWall1 = 0; fr.notWall2 = 0; fr.notWall3 = 0; fr.notWall4 = 0; //fr.upPanel = 0; switch (_notWallGOOD) { case 1: fr.notWall1 = 1; break; case 2: fr.notWall2 = 1; break; case 3: fr.notWall3 = 1; break; case 4: fr.notWall4 = 1; break; case 24: fr.notWall2 = 1; fr.notWall4 = 1; break; } fr.countWall = Convert.ToInt32(dc.SelectQuery($"select countWall from _countWallFrame where nameFrame = '{_nameBlokc.Trim()}'").AsEnumerable().ToList()[0][0].ToString()); int lenghtForWhere = _currentCompositeBmz.InformationForBuild.Dg; if (_currentCompositeBmz.InformationForBuild.Dg2 == 0) { switch (_numberBlock) { case 1: widthForWhere = _currentCompositeBmz.InformationForBuild.Shg1; break; case 2: widthForWhere = _currentCompositeBmz.InformationForBuild.Shg2; break; case 3: widthForWhere = _currentCompositeBmz.InformationForBuild.Shg3; break; case 4: widthForWhere = _currentCompositeBmz.InformationForBuild.Shg4; break; } } if (_currentCompositeBmz.InformationForBuild.Dg3 != 0) { switch (_numberBlock) { case 1: { lenghtForWhere = _currentCompositeBmz.InformationForBuild.Dg; if ((ContentBlock.IndexOf("1A") > -1) || (ContentBlock.IndexOf("1В") > -1)) { widthForWhere = _currentCompositeBmz.InformationForBuild.Shg1; } if (ContentBlock.IndexOf("1Б") > -1) { widthForWhere = _currentCompositeBmz.InformationForBuild.Shg2; } } break; case 2: lenghtForWhere = _currentCompositeBmz.InformationForBuild.Dg2; widthForWhere = _currentCompositeBmz.InformationForBuild.Shg3; break; case 3: lenghtForWhere = _currentCompositeBmz.InformationForBuild.Dg3; if ((ContentBlock.IndexOf("1A") > -1) || (ContentBlock.IndexOf("1В") > -1)) { widthForWhere = _currentCompositeBmz.InformationForBuild.Shg1; } if (ContentBlock.IndexOf("1Б") > -1) { widthForWhere = _currentCompositeBmz.InformationForBuild.Shg2; } break; } } if (_currentCompositeBmz.InformationForBuild.Dg2 != 0) { switch (_numberBlock) { case 1: { lenghtForWhere = _currentCompositeBmz.InformationForBuild.Dg; widthForWhere = _currentCompositeBmz.InformationForBuild.Shg1; } break; case 2: lenghtForWhere = _currentCompositeBmz.InformationForBuild.Dg; widthForWhere = _currentCompositeBmz.InformationForBuild.Shg2; break; case 3: lenghtForWhere = _currentCompositeBmz.InformationForBuild.Dg2; if ((ContentBlock.IndexOf("1A") > -1) || (ContentBlock.IndexOf("1В") > -1)) { widthForWhere = _currentCompositeBmz.InformationForBuild.Shg3; } if (ContentBlock.IndexOf("1Б") > -1) { widthForWhere = _currentCompositeBmz.InformationForBuild.Shg4; } break; } } string nname_block = ""; fr.dataForOneS.nameComercial = _nameBlokc; fr.antivandalProtec = 1; // УУУУУУУУУУУУУУУУУУУУУУУУУУУУУУУБББББББББББББББББРААААААААААААААААААААААААААААААТЬЬЬЬЬЬЬЬЬЬЬЬЬЬЬЬ switch (_nameBlokc.Trim()) { case "Блок-модуль РУВН-Т-РУНН": fr.countTrans = 1; nname_block = _nameBlokc.Trim(); DataTable dta2 = dc.SelectQuery($"select * from _block_RU_T_RU where notWall = {_notWallGOOD} AND antiVandalProtection = {fr.antivandalProtec}"); var ssa2 = dta2.AsEnumerable().ToList(); fr.dataForOneS.nameBlocks = ssa2[0]["nameBlock"].ToString(); break; case "Блок-модуль Т1-Т2": fr.countTrans = 2; nname_block = _nameBlokc.Trim(); //DataTable dta1 = dc.SelectQuery($"select * from _block_T1_T2 where idBlock = {_idBlock}"); //var ssa1 = dta1.AsEnumerable().ToList(); //fr.dataForOneS.nameBlocks = ssa1[0]["nameBlock"].ToString(); //switch (Convert.ToInt32(ssa1[0]["notWall"])) //{ // case 2: // fr.notWall2 = 1; // break; // case 4: // fr.notWall2 = 1; // fr.notWall4 = 1; // break; //} break; case "Блок-модуль РУВН": case "Блок-модуль1 РУВН": case "Блок-модуль РУНН": fr.countTrans = 0; nname_block = "Блок-модуль РУ"; //if (_currentCompositeBmz.InformationForBuild.H == 3040) // fr.upPanel = 1; if (_currentCompositeBmz.InformationForBuild.Dg > 7000) { fr.countDoors = 2; if (_nameBlokc.Trim().IndexOf("Блок-модуль1 РУВН") > -1) { fr.countDoors = 1; } var vv = (_currentCompositeBmz.CollectFrame.ToList() .FindAll(x => x.dataForOneS.nameComercial.IndexOf("Блок-модуль1") > -1)); if ((vv.Count > 0) && (_nameBlokc.IndexOf("Блок-модуль РУВН") > -1)) { fr.countDoors = 1; } } else { fr.countDoors = 1; if ((_currentCompositeBmz.CollectFrame.ToList() .FindAll(x => x.dataForOneS.nameComercial == "Блок-модуль1 РУВН").Count > 0) && (_nameBlokc == "Блок - модуль РУВН")) { fr.countDoors = 0; } } var pack = _currentCompositeBmz.dOneSQuestParametr.Pack.IndexOf("Нет") > -1 ? 1 : 0; /*AND upPanel = {fr.upPanel}*/ DataTable dta = dc.SelectQuery($"select * from _block_RU where door = {fr.countDoors} AND antiVandalProtection = {fr.antivandalProtec}" + $" AND notWall = {_notWallGOOD} AND busbarWall = 0 AND pack ={pack}"); var ssa = dta.AsEnumerable().ToList(); fr.dataForOneS.nameBlocks = ssa[0]["nameBlock"].ToString(); break; case "Блок-модуль Т1-РУВН-Т2": case "Блок-модуль Т1-РУНН-Т2": fr.countTrans = 2; nname_block = "Блок-модуль Т1-РУ-Т2"; DataTable dta3 = dc.SelectQuery($"select * from _block_T1_RU_T2 where antiVandalProtection = {fr.antivandalProtec}"); var ssa3 = dta3.AsEnumerable().ToList(); fr.dataForOneS.nameBlocks = ssa3[0]["nameBlock"].ToString(); break; default: fr.notWall2 = 1; widthForWhere = _currentCompositeBmz.InformationForBuild.Shg2; lenghtForWhere = _currentCompositeBmz.InformationForBuild.Dg; fr.notWall4 = 1; fr.countTrans = 0; DataTable dta4 = dc.SelectQuery($"select * from _commonRoom where antiVandalProtection = {fr.antivandalProtec}"); var ssa4 = dta4.AsEnumerable().ToList(); fr.dataForOneS.nameBlocks = ssa4[0]["nameBlock"].ToString(); nname_block = _nameBlokc.Trim(); break; } string locDoor = ""; if ((_nameBlokc.IndexOf("Т1") > -1) && (_nameBlokc.IndexOf("РУ") > -1)) { locDoor = $" AND doorLocation ='{_compositeT1RUT2}'"; } //AND upPanel = { fr.upPanel } DataTable dt = dc.SelectQuery($"select * from _frameBlock where typeBlock = '{nname_block}' AND width = {widthForWhere} " + $"AND height = {_currentCompositeBmz.InformationForBuild.H} AND length = {lenghtForWhere} " + $"AND notWall1 = {fr.notWall1} AND notWall2 = {fr.notWall2} AND notWall3 = {fr.notWall3} AND notWall4 = {fr.notWall4} " + $"{locDoor} AND locationCell = '{_numbOfRow}' AND compFrame = {_compositeBlock}"); var ss = dt.AsEnumerable().ToList(); if (ss.Count != 0) { _idRam = Convert.ToInt32(ss[0][0].ToString()); DataTable dt2 = dc.SelectQuery($"select * from _frameBlock where idFrame = {_idRam}"); var ss2 = dt2.AsEnumerable().ToList(); string locCell = ss2[0]["locationCell"].ToString();/*.Substring(ss[0]["locationCell"].ToString().IndexOf(" "));*/ string door = ss2[0]["doorLocation"].ToString() /*.Substring(ss[0]["doorLocation"].ToString().IndexOf(" "))*/; fr.name = ss[0]["nameFrame"].ToString(); fr.height = Convert.ToInt32(ss[0]["height"].ToString()); fr.length = Convert.ToInt32(ss[0]["length"]); fr.width = Convert.ToInt32(ss[0]["width"]); fr.localCell = locCell.Replace(locCell[0], char.ToUpper(locCell[0])); fr.localDoor = door.Replace(door[0], char.ToUpper(door[0])); //fr.upPanel = Convert.ToInt32(ss[0]["upPanel"].ToString()); fr.position = ContentBlock; _currentCompositeBmz.CollectFrame.Add(fr); } }