EXAMPLE :if i add a range {1,10}
and another range{15,20}
i should get a message saying the ranges from 11 to 14 are missing.
for (int i = 0; i < weightdata.Count; i++)
{
if ((i == 0 && i<weightdata.Count-1) && ((MaximumValue < weightdata[i].MinRange && BaseAmount < weightdata[i].BaseAmount)||
(MaximumValue>weightdata[i].MinRange && MaximumValue<weightdata[i+1].MinRange && BaseAmount>weightdata[i].BaseAmount &&BaseAmount>weightdata[i].BaseAmount)))
{
hdnflag.Value = "";
flag = false;
if (weightdata[i].MinRange - MaximumValue > 1)
{
AlertMsg = string.Format(MinSpeedReqMsg.ErrorMessage, MaximumValue,weightdata[i].MinRange);
flag = true;
}
break;
}
else if ((i == weightdata.Count - 1 && weightdata[i].MaxRange != null) && ((MinimumValue > weightdata[i].MaxRange && BaseAmount > weightdata[i].BaseAmount)))
{
hdnflag.Value = "";
flag = false;
if (MinimumValue - weightdata[i].MaxRange > 1)
{
AlertMsg = string.Format(MinSpeedReqMsg.ErrorMessage, MaximumValue, weightdata[i].MinRange);
flag = true;
}
break;
}
else if ((i > 0 && i < weightdata.Count - 1) && (MinimumValue > weightdata[i].MaxRange && MaximumValue < weightdata[i + 1].MinRange && MaximumValue > weightdata[i].MaxRange
&& BaseAmount > weightdata[i].BaseAmount && BaseAmount < weightdata[i + 1].BaseAmount))
{
hdnflag.Value = "";
flag = false;
if (MinimumValue - weightdata[i].MaxRange > 1)
{
AlertMsg =string.Format(MinSpeedReqMsg.ErrorMessage ,weightdata[i].MaxRange, MinimumValue);
flag = true;
}
break;
}