Example #1
0
        /// <summary>
        /// Получить id станции по коду станции
        /// </summary>
        /// <param name="code_cs"></param>
        /// <returns></returns>
        public int DefinitionIDStation(int code_cs)
        {
            ReferenceStation station = g_ref.GetReferenceStationOfCode(code_cs);

            if (station != null)
            {
                return(station.IDStation);
            }
            Code_Station code_station = rw_ref.GetStationsOfCodeCS(code_cs);

            if (code_station == null)
            {
                return(0);
            }
            Code_InternalRailroad code_ir = rw_ref.GetInternalRailroads(code_station.IDInternalRailroad != null? (int)code_station.IDInternalRailroad:0);
            Code_State            code_st = rw_ref.GetState(code_ir != null ?  code_ir.IDState: 0);
            int res = g_ref.SaveReferenceStation(new ReferenceStation()
            {
                IDStation        = 0,
                Name             = code_station.Station + (code_ir != null ?  " " + code_ir.Abbr + " ж/д" : "") + (code_st != null ? " " + code_st.ABB_RUS : ""),
                Station          = code_station.Station,
                InternalRailroad = code_ir != null ? code_ir.InternalRailroad : "-",
                IR_Abbr          = code_ir != null ? code_ir.Abbr : "-",
                NameNetwork      = code_st != null ? code_st.NameNetwork : "-",
                NN_Abbr          = code_st != null ? code_st.ABB_RUS : "-",
                CodeCS           = code_cs
            });

            if (res > 0)
            {
                return(res);
            }
            return(0);
        }
Example #2
0
        public string GetStateToState(int code)
        {
            Code_State state = GetState(code);

            return(state != null ? state.State : null);
        }