public static void FindSequencing_SPT() { for (int a = 0; a < 5; a++) { for (int b = 0; b < 4; b++) { Logics.calc_spt[a, b] = 0; } } DataAccessTier.managementToolsDataContext db = new DataAccessTier.managementToolsDataContext(); var SPT = from s in db.Sequences orderby s.ProceessingTime select s.TaskName; var calc = from s in db.Sequences orderby s.ProceessingTime select new { s.ProceessingTime, s.DueDate }; int i = 0; foreach (var a in calc) { calc_spt[i, 0] = a.ProceessingTime; calc_spt[i, 1] = a.DueDate; if (i == 0) calc_spt[i, 2] = calc_spt[i, 2] + calc_spt[i, 0]; else calc_spt[i, 2] = calc_spt[i - 1, 2] + calc_spt[i, 0]; calc_spt[i, 3] = ((calc_spt[i, 2] - calc_spt[i, 1]) < 0) ? 0 : (calc_spt[i, 2] - calc_spt[i, 1]); i++; } foreach (var a in SPT) { stk_SPT.Push(a.ToString()); } }
public static void FindSequencing_SPO() { for (int a = 0; a < 5; a++) { for (int b = 0; b < 4; b++) { Logics.calc_spo[a, b] = 0; } } DataAccessTier.managementToolsDataContext db = new DataAccessTier.managementToolsDataContext(); var SPO = from s in db.Sequences orderby ((Convert.ToDouble(s.DueDate) - Convert.ToDouble(s.ProceessingTime)) / Convert.ToDouble(s.NoOfOperation)) select s.TaskName; var calc = from s in db.Sequences orderby ((Convert.ToDouble(s.DueDate) - Convert.ToDouble(s.ProceessingTime)) / Convert.ToDouble(s.NoOfOperation)) select new { s.ProceessingTime, s.DueDate }; int i = 0; foreach (var a in calc) { calc_spo[i, 0] = a.ProceessingTime; calc_spo[i, 1] = a.DueDate; if (i == 0) calc_spo[i, 2] = calc_spo[i, 2] + calc_spo[i, 0]; else calc_spo[i, 2] = calc_spo[i - 1, 2] + calc_spo[i, 0]; calc_spo[i, 3] = ((calc_spo[i, 2] - calc_spo[i, 1]) < 0) ? 0 : (calc_spo[i, 2] - calc_spo[i, 1]); i++; } foreach (var a in SPO) { stk_SPO.Push(a.ToString()); } stk_SPO.Reverse(); }