Пример #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 bool RepeatedPatent(String patent)
 {
     try
     {
         if (Wagon.FindByPatent(patent) != null)
         {
             return(true);
         }
         foreach (Wagon wagon in this.list_wagon)
         {
             if (wagon.patent == patent)
             {
                 return(true);
             }
         }
         return(false);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         return(false);
     }
 }