Esempio n. 1
0
 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();
                     }
                 }
             }
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
 public IActionResult Put(int id, [FromBody] RundownItem value)
 {
     Repository.Update(id, value);
     return(Ok(value));
 }
Esempio n. 5
0
 public void Post([FromBody] RundownItem value)
 {
 }
Esempio n. 6
0
 public void UpdateRundownItem(int id, RundownItem item)
 {
     itemRepository.Update(id, item);
 }
 public void Put(int id, [FromBody] RundownItem value)
 {
     Repository.Update(id, value);
 }
Esempio n. 8
0
        public IActionResult Put(int id, [FromBody] RundownItem value)
        {
            rundownService.UpdateRundownItem(id, value);

            return(Ok(value));
        }
Esempio n. 9
0
		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;
		}