Hi,
How do i sort the result of LINQ when my collection of data is combination of numbers and letters.
Below is the design of my tables and my method to populate the line.
Lines
--------------------------------
|LineID | LineName | LineType |
--------------------------------
| 167 | 1 | 3 |
| 172 | 2 | 3 |
| 13 | 3 | 3 |
| 231 | 4 | 3 |
| 18 | 5 | 3 |
| 23 | 6 | 3 |
| 44 | 7 | 3 |
| 49 | 8 | 3 |
| 116 | 9 | 3 |
| 120 | 10 | 3 |
| 266 | 13 | 3 |
| 195 | 11 | 7 |
| 265 | 12 | 7 |
| 2 | B | 1 |
| 3 | C | 1 |
--------------------------------
Line Type
-------------------------
|LineType | LineDesc |
-------------------------
| 3 | FP |
| 7 | BF |
| 1 | Process |
-------------------------
Process
---------------------------------------
|ProcessID | ProcessName| ProcessType |
---------------------------------------
| 10 | Filling | 3 |
| 25 | BulkFilling| 7 |
| 4 | Process | 1 |
---------------------------------------
Below is the method that i use when populating the Line. It has a parameter "processid".
private void LoadLinePerProcess(int processid)
{
List<Classes.Lines> line = Classes.Lines.GetLineCollection();
List<Classes.Process> process = Classes.Process.GetProcessCollection();
List<Classes.ProcessLineType> processtype = Classes.ProcessLineType.GetProcessLineTypeCollection();
var qLine = from p in process
join t in processtype on p.ProcessType equals t.LineTypeCode
join l in line on t.LineTypeDescription equals l.LineType into LineColl
orderby p.ProcessType
select new
{
ProcessID = p.ProcessID,
ProcessName = p.ProcessName,
ProcessType = p.ProcessType,
LineName = from ln in LineColl
orderby ln.LineName
select new { ln.LineID, ln.LineName }
};
foreach (var result in qLine)
{
if (result.ProcessID == processid)
{
c_cboLine.Items.Clear();
foreach (var lines in result.LineName)
{
c_cboLine.Items.Add(lines.LineName);
}
break;
}
}
if (c_cboLine.Items.Count > 0) { c_cboLine.SelectedIndex = 0; }
}
My problem now is, when my "processid" is equal to 10, it generate the line as "1,13,2,3,4,5..." it looks like it converted to string not int.
Thanks