Exemplo n.º 1
0
        public void Test_SUD_RC_Ways()
        {
            RC_Ways ws = new RC_Ways();
            WAYS    w1 = new WAYS()
            {
                id_way       = 0,
                id_stat      = 4,
                id_park      = null,
                num          = "0",
                name         = "Тест",
                vag_capacity = 7,
                order        = null,
                bind_id_cond = null,
                for_rospusk  = null,
            };
            int id_new = ws.SaveWays(w1);

            Test_RC_Ways(id_new);
            WAYS w2 = new WAYS()
            {
                id_way       = id_new,
                id_stat      = 4,
                id_park      = null,
                num          = "0",
                name         = "Тест11111",
                vag_capacity = 9,
                order        = null,
                bind_id_cond = null,
                for_rospusk  = null,
            };
            int id_ch = ws.SaveWays(w2);

            Test_RC_Ways(id_ch);
            WAYS del = ws.DeleteWays(id_ch);

            WL(del);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Определить ID пути системы Railcars (если ID нет в системе создать путь)
 /// </summary>
 /// <param name="id_station_kis"></param>
 /// <param name="num_way"></param>
 /// <returns></returns>
 public int?DefinitionIDWays(int id_station, int?num_way)
 {
     if (num_way != null)
     {
         int?way = rs_ways.GetIDWaysToStations(id_station, ((int)num_way).ToString());
         if (way == null)
         {
             int res = rs_ways.SaveWays(new WAYS()
             {
                 id_way       = 0,
                 id_stat      = id_station,
                 id_park      = null,
                 num          = ((int)num_way).ToString(),
                 name         = "?",
                 vag_capacity = null,
                 order        = null,
                 bind_id_cond = null,
                 for_rospusk  = null,
             });
             if (res > 0)
             {
                 return(res);
             }
         }
         return(way);
     }
     else
     {
         WAYS ws = rs_ways.GetWaysOfStations(id_station).OrderBy(w => w.num).FirstOrDefault();
         if (ws != null)
         {
             return(ws.id_way);
         }
     }
     return(null);
 }