예제 #1
0
        public bool AddNewActionToSection(int action_id, int station_id, string patent, string type)
        {
            int locomotive_id = 0, wagon_id = 0;

            if (type == "locomotive")
            {
                locomotive_id = Locomotive.FindByPatent(patent).locomotive_id;
            }
            else
            {
                wagon_id = Wagon.FindByPatent(patent).wagon_id;
            }

            try
            {
                this.ApplyAction(action_id, locomotive_id, wagon_id, station_id);
                SectionAction action = new SectionAction(action_id, section_index, locomotive_id, wagon_id);
                actions_list.Add(action);
                return(true);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return(false);
            }
        }
예제 #2
0
        public void FeedCapacityLabel(Label capacity_label, string patente)
        {
            Locomotive locomotive = Locomotive.FindByPatent(patente);

            if (locomotive != null)
            {
                capacity_label.Text = locomotive.tons_drag.ToString();
            }
            else
            {
                capacity_label.Text = "Seleccione locomotora de arrastre";
            }
        }
예제 #3
0
 public bool RepeatedPatent(String patent)
 {
     try
     {
         if (Locomotive.FindByPatent(patent) != null)
         {
             return(true);
         }
         foreach (Locomotive locomotive in this.list_locomotive)
         {
             if (locomotive.patent == patent)
             {
                 return(true);
             }
         }
         return(false);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         return(false);
     }
 }