void LoadCycleNameLink(DataTable dt) { string query = "Address = '" + prefix + "CycleNameLink'"; var rows = dt.Select(query); if (rows != null) { foreach (var row in rows) { string val = DataTable_Functions.GetRowValue("Value", row); SelectedCycleNameLink = val; } } }
public static HourRowInfo GetHourInfo(SQLiteConnection connection, DataRow row) { // Get Unique Id string uniqueId = DataTable_Functions.GetRowValue("unique_id", row); if (!string.IsNullOrEmpty(uniqueId)) { var result = new HourRowInfo(); result.UniqueId = uniqueId; var hourInfo = new Data.HourInfo(); hourInfo.Date = DataTable_Functions.GetRowValue("date", row); hourInfo.Hour = DataTable_Functions.GetIntegerFromRow("hour", row); hourInfo.PlannedProductionTime = DataTable_Functions.GetDoubleFromRow("planned_production_time", row); hourInfo.OperatingTime = DataTable_Functions.GetDoubleFromRow("operating_time", row); hourInfo.IdealOperatingTime = DataTable_Functions.GetDoubleFromRow("ideal_operating_time", row); hourInfo.TotalPieces = DataTable_Functions.GetIntegerFromRow("total_pieces", row); hourInfo.GoodPieces = DataTable_Functions.GetIntegerFromRow("good_pieces", row); hourInfo.Active = DataTable_Functions.GetDoubleFromRow("active", row); hourInfo.Idle = DataTable_Functions.GetDoubleFromRow("idle", row); hourInfo.Alert = DataTable_Functions.GetDoubleFromRow("alert", row); hourInfo.Production = DataTable_Functions.GetDoubleFromRow("production", row); hourInfo.Setup = DataTable_Functions.GetDoubleFromRow("setup", row); hourInfo.Teardown = DataTable_Functions.GetDoubleFromRow("teardown", row); hourInfo.Maintenance = DataTable_Functions.GetDoubleFromRow("maintenance", row); hourInfo.ProcessDevelopment = DataTable_Functions.GetDoubleFromRow("process_development", row); result.HourInfo = hourInfo; return(result); } return(null); }
private void LoadPartCountEventItems(DataTable dt) { PartCountItems.Clear(); string address = "/Parts/"; string filter = "address LIKE '" + address + "*'"; var rows = DataTable_Functions.GetRows(dt, filter); foreach (DataRow row in rows) { string lastNode = DataTable_Functions.TrakHound.GetLastNode(row); if (lastNode == "Event") { var item = new Controls.PartCountEventItem(); item.ParentPage = this; item.RemoveClicked += Item_RemoveClicked; item.SettingChanged += Item_SettingChanged; filter = "address LIKE '" + row["address"].ToString() + "/*'"; var eventRows = DataTable_Functions.GetRows(dt, filter); foreach (DataRow eventRow in eventRows) { lastNode = DataTable_Functions.TrakHound.GetLastNode(eventRow); switch (lastNode) { case "EventName": item.EventName = DataTable_Functions.GetRowValue("value", eventRow); break; case "EventValue": item.EventValue = DataTable_Functions.GetRowValue("value", eventRow); break; case "PreviousEventValue": item.PreviousEventValue = DataTable_Functions.GetRowValue("value", eventRow); break; case "ValueType": item.ValueType = GetFormattedValue(DataTable_Functions.GetRowValue("value", eventRow)); break; case "CaptureItemLink": item.CaptureItemLink = DataTable_Functions.GetRowValue("value", eventRow); break; case "CalculationType": item.CalculationType = DataTable_Functions.GetRowValue("value", eventRow); break; case "StaticIncrementValue": item.StaticIncrementValue = DataTable_Functions.GetIntegerFromRow("value", eventRow); break; } } if (!string.IsNullOrEmpty(item.EventName)) { PartCountItems.Add(item); } } } // Try loading deprecated configuration if (PartCountItems.Count == 0 && rows.Length > 0) { var item = new Controls.PartCountEventItem(); item.ParentPage = this; item.RemoveClicked += Item_RemoveClicked; item.SettingChanged += Item_SettingChanged; foreach (DataRow row in rows) { string lastNode = DataTable_Functions.TrakHound.GetLastNode(row); if (lastNode == "PartsEventValue") { item.EventValue = GetFormattedValue(DataTable_Functions.GetRowValue("value", row)); } if (lastNode == "PartsEventName") { item.EventName = DataTable_Functions.GetRowValue("value", row); } else if (lastNode == "PartsCaptureItemLink") { item.CaptureItemLink = DataTable_Functions.GetRowValue("value", row); } else if (lastNode == "CalculationType") { item.CalculationType = DataTable_Functions.GetRowValue("value", row); } } if (!string.IsNullOrEmpty(item.EventName)) { PartCountItems.Add(item); } } }