internal void LoadTemplate() { // read template using (var reader = new StreamReader(templateFile)) using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) while (csv.Read()) { RundownItem item = new RundownItem { HospitalFullName = csv.GetField(0).Trim(), Tour = csv.GetField(1).Trim(), UnitName = csv.GetField(2).Trim(), StartTime = csv.GetField(3).Trim(), DateSymbolic = csv.GetField(4).Trim() }; RundownItems.Add(item); } // read vehicles and fill in the rest of the RundownItem // also to be called when we need to reload vehicles after an update using (var reader = new StreamReader(vehiclesFile)) using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) while (csv.Read()) { foreach (RundownItem item in RundownItems) { if (item.UnitName == csv.GetField(0).Trim()) { item.VehicleNumber = csv.GetField(1).Trim(); item.Radio1 = csv.GetField(2).Trim(); item.Radio2 = csv.GetField(3).Trim(); } } } }
public RundownItem AddNewRundownItem() { var largestItemId = itemRepository.Get().Max(i => i.ID); var newItem = new RundownItem() { ID = largestItemId + 10, Text = "New Item" }; itemRepository.Add(newItem); return(newItem); }
public static void Send(RundownItem item) { if (string.IsNullOrEmpty(item.StaticItem.Clipname)) return; UdpClient client = new UdpClient(); client.Connect(IPAddress.Parse(Settings.Default.SpyderIp), Settings.Default.SpyderPort); string command = Settings.Default.SpyderSettings .Cast<string>() .First(x => Regex.IsMatch(x, String.Format("{0}.*", item.StaticItem.Clipname))) .Split('#')[1]; byte[] packet = Encoding.ASCII.GetBytes(string.Format("spyder\0\0\0\0RSC {0} 1", item.ControlValue)); client.Send(packet, packet.Length); client.Close(); }
public IActionResult Put(int id, [FromBody] RundownItem value) { Repository.Update(id, value); return(Ok(value)); }
public void Post([FromBody] RundownItem value) { }
public void UpdateRundownItem(int id, RundownItem item) { itemRepository.Update(id, item); }
public void Put(int id, [FromBody] RundownItem value) { Repository.Update(id, value); }
public IActionResult Put(int id, [FromBody] RundownItem value) { rundownService.UpdateRundownItem(id, value); return(Ok(value)); }
private bool SetSelectedChannel(RundownItem item) { if (item.IsControl) return false; if (string.IsNullOrEmpty(item.Channel)) { if (cbChannels_.Items.Count > 0) { cbChannels_.SelectedIndex = 0; return true; } } else { if (cbChannels_.Items.Contains(item.Channel)) cbChannels_.SelectedIndex = cbChannels_.Items.IndexOf(item.Channel); else { cbChannels_.Items.Add(item.Channel); cbChannels_.SelectedIndex = cbChannels_.Items.Count - 1; } } return false; }