예제 #1
0
        public IEnumerable<Schedule> GetAll()
        {
            DAL dal = new DAL();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetSchedules";

            DataTable dt = dal.Execute(cmd);

            List<Schedule> schedules = new List<Schedule>();

            foreach (DataRow dr in dt.Rows)
            {
                Schedule schedule = new Schedule
                {
                    schedule_id = Int64.Parse(dr["schedule_id"].ToString()),
                    bus_id = Int64.Parse(dr["bus_id"].ToString()),
                    vehicle_id = Int64.Parse(dr["vehicle_id"].ToString()),
                    route_id = Int64.Parse(dr["route_id"].ToString()),
                    route_name = dr["route_name"].ToString(),
                    departure_date = DateTime.Parse(dr["departure_date"].ToString()),
                    departure_time = dr["departure_time"].ToString(),
                    arrival_date = DateTime.Parse(dr["arrival_date"].ToString()),
                    arrival_time = dr["arrival_time"].ToString(),
                    active = bool.Parse(dr["active"].ToString()),
                    date_created = DateTime.Parse(dr["date_created"].ToString()),
                    created_by = dr["created_by"].ToString(),
                    date_updated = DateTime.Parse(dr["date_updated"].ToString()),
                    updated_by = dr["updated_by"].ToString(),

                };

                schedules.Add(schedule);
            }

            return schedules;
        }
예제 #2
0
        public IEnumerable<Schedule> GetScheduleWithAmount(Int64 fromlocation, Int64 toLocation)
        {
            DAL dal = new DAL();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetScheduleWithAmount";

            cmd.Parameters.AddWithValue("@location_leaving_from", fromlocation);
            cmd.Parameters.AddWithValue("@location_going_to", toLocation);

            DataTable dt = dal.Execute(cmd);

            List<Schedule> schedules = new List<Schedule>();

            foreach (DataRow dr in dt.Rows)
            {
                Schedule schedule = new Schedule
                {
                    schedule_id = Int64.Parse(dr["schedule_id"].ToString()),
                    route_id = Int64.Parse(dr["route_id"].ToString()),
                    route_name = dr["route_name"].ToString(),
                    departure_date = DateTime.Parse(dr["departure_date"].ToString()),
                    departure_time = dr["departure_time"].ToString(),
                    arrival_date = DateTime.Parse(dr["arrival_date"].ToString()),
                    arrival_time = dr["arrival_time"].ToString(),
                    deparature_city = dr["deparature_city"].ToString(),
                    arrival_city = dr["arrival_city"].ToString(),
                    fare = double.Parse(dr["fare"].ToString()),
                    active = bool.Parse(dr["active"].ToString()),
                    date_created = DateTime.Parse(dr["date_created"].ToString()),
                    created_by = dr["created_by"].ToString(),
                    date_updated = DateTime.Parse(dr["date_updated"].ToString()),
                    updated_by = dr["updated_by"].ToString(),

                };

                schedules.Add(schedule);
            }

            return schedules;
        }
예제 #3
0
 public Schedule Add(Schedule item)
 {
     throw new NotImplementedException();
 }
예제 #4
0
 public bool Update(Schedule item)
 {
     throw new NotImplementedException();
 }