Member 13085286 Ответов: 0

Переключение поведения различные комбинации


сначала я сформировал разные группы с 4 типами переключателей ,а после создания всех групп мне нужно разделить разные группы на основе комбинации переключателей.

Что я уже пробовал:

var chassisCount=0;
var gensetCount=0;
var chassisId = 0;
var gensetId = 0;


foreach (var equip in item.SelectedEquipmentList)
{
	if(equip.Code=="Chassis")
	{
		chassisId = equip.Id;
		chassisCount++;
	}
	if(equip.Code=="Genset")
	{
		gensetId = equip.Id;
		gensetCount++;
	}
}


if (chassisCount >= 2) dupplicateEquipmentsList.Add(chassisId);
if (gensetCount >= 2) dupplicateEquipmentsList.Add(gensetId);



foreach (var ParentEquipment in parentItem.SelectedEquipmentList)
{
	if (lastitem != ParentEquipment)
	{
		if (parentItem.IsNOR == true || parentItem.IsChassis == true || parentItem.IsGenset == true || parentItem.IsIMDG == true)
		{

			if (dupplicateEquipmentsList.Contains(ParentEquipment.Id))
			{
				if (ParentEquipment.Code == "Chassis" || ParentEquipment.Code == "Genset")
				{
					duplicateEquipments.Append(ParentEquipment.EquipmentSize + ", ");

				}
				else
				{
					duplicateEquipments.Append(ParentEquipment.EquipmentSize + "+, ");
				}

			}
			else
			{
				if (ParentEquipment.Code == "Chassis" || ParentEquipment.Code == "Genset")
				{
					if(chassisCount >=2 || gensetCount >= 2)
					{
						duplicateEquipments.Append(ParentEquipment.EquipmentSize + ", ");
					}
					else
					{
						normalEquipments.Append(ParentEquipment.EquipmentSize + ", ");
					}

				}
				else
				{
					normalEquipments.Append(ParentEquipment.EquipmentSize + "+, ");
				}


			}
		}
		else
		{
			if (dupplicateEquipmentsList.Contains(ParentEquipment.Id))
			{
				duplicateEquipments.Append(ParentEquipment.EquipmentSize + ", ");
			}
			else
			{
				if(chassisCount >=2 || gensetCount >= 2)
				{
					normalEquipments.Append(ParentEquipment.EquipmentSize + ", ");
				}

			}
		}

	}
	else
	{

		if (parentItem.IsNOR == true || parentItem.IsChassis == true || parentItem.IsGenset == true || parentItem.IsIMDG == true)
		{

			if (dupplicateEquipmentsList.Contains(ParentEquipment.Id))
			{
				if (ParentEquipment.Code == "Chassis" || ParentEquipment.Code == "Genset")
				{
					duplicateEquipments.Append(ParentEquipment.EquipmentSize);
				}
				else
				{
					duplicateEquipments.Append(ParentEquipment.EquipmentSize + "+");
				}

			}
			else
			{
				if (ParentEquipment.Code == "Chassis" || ParentEquipment.Code == "Genset")
				{
					normalEquipments.Append(ParentEquipment.EquipmentSize + ", ");

				}
				else
				{
					normalEquipments.Append(ParentEquipment.EquipmentSize + "+");

				}
			}
		}
		else
		{
			if (dupplicateEquipmentsList.Contains(ParentEquipment.Id))
			{
				duplicateEquipments.Append(ParentEquipment.EquipmentSize);
			}
			else
			{
				normalEquipments.Append(ParentEquipment.EquipmentSize);
			}
		}
	}

}

Richard MacCutchan

В чем вопрос?

0 Ответов