public EditScheduleForm(Schedule schedule) { InitializeComponent(); try { DS_Schedule.DataSource = this.schedule; this.schedule = schedule; buildingQuery = new BuildingQuery(_SERVER.ServerName.Database); sequenceQuery = new SequenceQuery(_SERVER.ServerName.Database); ScheduleQuery = new ScheduleQuery(_SERVER.ServerName.Database); ScheduleLine = PoLine = buildingQuery.GetProductionLines(); DS_Schedule.DataSource = this.schedule; DS_Line.DataSource = ScheduleLine; DS_OriginalPoLine.DataSource = PoLine; var temp1 = buildingQuery.GetProductionLine(schedule.ProductionLine_Id); if (temp1 != null) { comboBox1.SelectedItem = ScheduleLine.Where(i => i.id == temp1.id).First(); } var pos = sequenceQuery.GetOriginalPos(schedule); if (pos != null) { DS_OriginalPo.DataSource = pos; } } catch { } }
private void EKanbanHistories_Load(object sender, EventArgs e) { try { var buildings = BuildingQuery.GetBuildings(); int i = 0, k = 0; foreach (var b in buildings) { treeView1.Nodes.Add(b.Name, $"Building: {b.Name}"); var lines = BuildingQuery.GetProductionLines(b.id); foreach (var l in lines) { treeView1.Nodes[b.Name].Nodes.Add(l.LineName, $"Line: {l.LineName}"); var ekanbans = EKanbanTaskQuery.GetEKanbanDevicesByProductionLine(l.id); foreach (var ekb in ekanbans) { treeView1.Nodes[b.Name].Nodes[l.LineName].Nodes.Add(ekb.Name, ekb.Name); } k++; } i++; } } catch { } }
string[] GetScheduleModelName(Building buildind, ScheduleClass cls) { var productionLines = BuildingQuery.GetProductionLines(buildind.id); List <Schedule> schedules = new List <Schedule>(); foreach (var line in productionLines) { using (ScheduleContext db = new ScheduleContext(_SERVER.ServerName.Database)) { var schs = db.Schedules.Where(i => i.ScheduleClass_Id == cls.id && i.ProductionLine_Id == line.id); if (schs.Count() > 0) { schedules.AddRange(schs.ToList()); } } } IEnumerable <IGrouping <string, Schedule> > group = schedules.GroupBy(i => i.ModelName).ToList(); List <string> modelName = new List <string>(); foreach (var item in group) { modelName.Add(item.Key); } return(modelName.ToArray()); }