Пример #1
0
        public List <string> GetAllBusPlusOnRoat(int id)
        {
            List <string> busList = new WaybillDAO().GetAllBus();
            Waybil        waybil  = new WaybillDAO().GetById(id);

            Connect();
            try
            {
                string     query       = "SELECT*FROM Bus where NumberPlate='@BusId'";
                SqlCommand commandRead = new SqlCommand(query, Connection);
                commandRead.Parameters.AddWithValue("@BusId", waybil.BusId);
                SqlDataReader reader = commandRead.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        busList.Add(Convert.ToString(reader["NumberPlate"]));
                    }
                }
            }
            catch (Exception e)
            {
                log.Error("ERROR: " + e.Message);
            }
            finally
            {
                Disconnect();
            }
            return(busList);
        }
Пример #2
0
        public List <Conductor> GetAllConductorPlusOnRoat(int id)
        {
            List <Conductor> conductors = new WaybillDAO().GetAllConductor();
            Waybil           waybil     = new WaybillDAO().GetById(id);

            Connect();
            try
            {
                string     query       = "SELECT*FROM Conductor INNER JOIN Employees ON Conductor.id=Employees.personnelNumber where Id=@ConductorId";
                SqlCommand commandRead = new SqlCommand(query, Connection);
                commandRead.Parameters.AddWithValue("@ConductorId", waybil.ConductorId);
                SqlDataReader reader = commandRead.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Conductor conductor = new Conductor();
                        conductor.PersonnelNumber = Convert.ToInt32(reader["personnelNumber"]);
                        conductor.LastName        = Convert.ToString(reader["LastName"]) + Convert.ToString(reader["FirstName"]);
                        conductors.Add(conductor);
                    }
                }
            }
            catch (Exception e)
            {
                log.Error("ERROR: " + e.Message);
            }
            finally
            {
                Disconnect();
            }
            return(conductors);
        }