I am building a Function that creates an array of values that will be used as the key in a Dictionary. I am passing a string that is delimited and also splitting that into an array. I then create the Dictionary with the delimited string as the values. Testing it out returns a 500 error with “We apologize, but an unexpected internal problem occurred. Please provide your System Admin or Technical Support this Correlation ID for further details.”
Can anyone see anything that might be wrong? I do not get any errors when checking in the Function.
Dictionary<string, string> pkColl = new Dictionary<string, string>();
string[] arrayCol = {"ASME", "ASMETbl", "BeamSize", "ChnSize", "Class", "Color", "Cond", "Dash", "Degree", "Dia", "Drive", "Duro", "Elast", "Finish", "Fit", "Flange", "Gauge", "Grade", "Head", "HW", "Inlet", "Length", "LengthE", "Manufact",
"Material", "Metal", "NPS", "OD", "Outlet", "Sched", "Seal", "Shape", "Standard", "Style", "Thick", "ThickE", "Thread", "Valve", "Wall", "AFlat", "Height", "Leg1", "Leg2", "Width"};
string[] delPartKey = partKey.Split('~');
foreach (string element in arrayCol)
{
int x = 0;
pkColl.Add(arrayCol[x], delPartKey[x]);
x++;
}
string udPartDesc = "";
if (!string.IsNullOrEmpty(pkColl["Fit"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Fit" && ud.CodeID == pkColl["Fit"]).ToString();
partDesc = udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Flange"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Flange" && ud.CodeID == pkColl["Flange"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["HW"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "HW" && ud.CodeID == pkColl["HW"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Metal"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Metal" && ud.CodeID == pkColl["Metal"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Seal"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Seal" && ud.CodeID == pkColl["Seal"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Valve"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Valve" && ud.CodeID == pkColl["Valve"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Shape"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Shape" && ud.CodeID == pkColl["Shape"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Manufact"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Manufact" && ud.CodeID == pkColl["Manufact"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Style"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Style" && ud.CodeID == pkColl["Style"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Drive"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Drive" && ud.CodeID == pkColl["Drive"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Head"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Head" && ud.CodeID == pkColl["Head"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Thread"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Thread" && ud.CodeID == pkColl["Thread"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Degree"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Degree" && ud.CodeID == pkColl["Degree"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Dia"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Dia" && ud.CodeID == pkColl["Dia"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Gauge"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Gauge" && ud.CodeID == pkColl["Gauge"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Thick"]))
{
if (pkColl["Thick"] == "24")
{
partDesc += ", " + pkColl["ThickE"] + "\" THKNS";
}
else
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Thick" && ud.CodeID == pkColl["Thick"]).ToString();
partDesc += ", " + udPartDesc;
}
}
if (!string.IsNullOrEmpty(pkColl["OD"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "OD" && ud.CodeID == pkColl["OD"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["NPS"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "NPS" && ud.CodeID == pkColl["NPS"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Wall"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Wall" && ud.CodeID == pkColl["Wall"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["BeamSize"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "BeamSize" && ud.CodeID == pkColl["BeamSize"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["ChnSize"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "ChnSize" && ud.CodeID == pkColl["ChnSize"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Length"]))
{
if (pkColl["Length"] == "20")
{
partDesc += ", " + pkColl["LengthE"] + "\" LG";
}
else
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Length" && ud.CodeID == pkColl["Length"]).ToString();
partDesc += ", " + udPartDesc;
}
}
if (!string.IsNullOrEmpty(pkColl["Width"]))
{
partDesc += ", " + pkColl["Width"] + "\" WD";
}
if (!string.IsNullOrEmpty(pkColl["Height"]))
{
partDesc += ", " + pkColl["Height"] + "\" HGT";
}
if (!string.IsNullOrEmpty(pkColl["AFlat"]))
{
partDesc += ", " + pkColl["AFlat"] + "\" ACROSS FLAT";
}
if (!string.IsNullOrEmpty(pkColl["Leg1"]))
{
partDesc += ", " + pkColl["Leg1"] + "\" LEG 1";
}
if (!string.IsNullOrEmpty(pkColl["Leg2"]))
{
partDesc += ", " + pkColl["Leg2"] + "\" LEG 2";
}
if (!string.IsNullOrEmpty(pkColl["Sched"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Sched" && ud.CodeID == pkColl["Sched"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Material"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Material" && ud.CodeID == pkColl["Material"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Grade"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Grade" && ud.CodeID == pkColl["Grade"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Cond"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Cond" && ud.CodeID == pkColl["Cond"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Finish"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Finish" && ud.CodeID == pkColl["Finish"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Dash"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Dash" && ud.CodeID == pkColl["Dash"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Duro"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Duro" && ud.CodeID == pkColl["Duro"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Elast"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Elast" && ud.CodeID == pkColl["Elast"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Color"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Color" && ud.CodeID == pkColl["Color"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Inlet"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Inlet" && ud.CodeID == pkColl["Inlet"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Outlet"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Outlet" && ud.CodeID == pkColl["Outlet"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Class"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Class" && ud.CodeID == pkColl["Class"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["ASME"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "ASME" && ud.CodeID == pkColl["ASME"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["ASMETbl"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "ASMETbl" && ud.CodeID == pkColl["ASMETbl"]).ToString();
partDesc += ", " + udPartDesc;
}
if (!string.IsNullOrEmpty(pkColl["Standard"]))
{
udPartDesc = Db.UDCodes.Select(ud => ud.CodeTypeID == "Standard" && ud.CodeID == pkColl["Standard"]).ToString();
partDesc += ", " + udPartDesc;
}