public bool checkLogin(string login, string password)
        {
            Database.Database_DAO.Database db = new Database.Database_DAO.Database();
            db.Connect();

            SqlCommand command = db.CreateCommand(SQL_SELECT_LOGIN);

            command.Parameters.AddWithValue("@login", login);

            SqlDataReader reader = db.Select(command);

            Collection <Database.Client> Clients = Database.Database_DAO.ClientTable.Read(reader);

            Database.Client Client = null;
            if (Clients.Count == 1)
            {
                Client = Clients[0];
            }
            else
            {
                return(false);
            }
            reader.Close();
            db.Close();

            if (Client.password == password)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static int new_order(Orders order)
        {
            Database db = new Database();

            db.Connect();

            SqlCommand command = db.CreateCommand("new_order");

            command.CommandType = CommandType.StoredProcedure;

            SqlParameter client = new SqlParameter();

            client.ParameterName = "@client_id";
            client.DbType        = DbType.Int32;
            client.Value         = order.client_id;
            client.Direction     = ParameterDirection.Input;
            command.Parameters.Add(client);

            /*
             * The analisys contains a mistake - there should not be a date of performing an action but
             * start date of the order
             * SELECT * FROM orders
             * WHERE truck_plate=$available_truck.plate
             * AND start_date-$current_date < 3
             * AND start_date-$current_date >(-3)
             */


            SqlParameter start_date = new SqlParameter();

            start_date.ParameterName = "@start_date";
            start_date.DbType        = DbType.Date;
            start_date.Value         = order.start_date;
            start_date.Direction     = ParameterDirection.Input;
            command.Parameters.Add(start_date);

            SqlParameter route_id = new SqlParameter();

            route_id.ParameterName = "@route_id";
            route_id.DbType        = DbType.Int32;
            route_id.Value         = order.route_id;
            route_id.Direction     = ParameterDirection.Input;
            command.Parameters.Add(route_id);

            SqlParameter width = new SqlParameter();

            width.ParameterName = "@width";
            width.DbType        = DbType.Int32;
            width.Value         = order.width;
            width.Direction     = ParameterDirection.Input;
            command.Parameters.Add(width);

            SqlParameter height = new SqlParameter();

            height.ParameterName = "@height";
            height.DbType        = DbType.Int32;
            height.Value         = order.height;
            height.Direction     = ParameterDirection.Input;
            command.Parameters.Add(height);

            SqlParameter description = new SqlParameter();

            description.ParameterName = "@description";
            description.DbType        = DbType.String;
            description.Value         = order.load_description;
            description.Direction     = ParameterDirection.Input;
            command.Parameters.Add(description);



            // 4. execute procedure

            int ret = db.ExecuteNonQuery(command);

            //db.ExecuteNonQuery(command);
            Console.WriteLine("Executed");
            // 5. get values of the output parameters
            //string result = command.Parameters["@result"].Value.ToString();


            db.Close();
            //Console.WriteLine("Executed");

            return(ret);
        }
        public static void Specific_places(int id)
        {
            Database db = new Database();

            db.Connect();

            SqlCommand command = db.CreateCommand(SQL_THE_ORDERS);

            command.Parameters.AddWithValue("@driver_id", id);
            command.Parameters.AddWithValue("@current_date", Convert.ToDateTime("2016-05-20"));
            //Current date is fixed because of the testing
            SqlDataReader reader = db.Select(command);

            Collection <Orders> orders = OrdersTable.Read(reader);

            reader.Close();

            Console.WriteLine("List of drivers places:");
            foreach (Orders o in orders)
            {
                SqlCommand command2 = db.CreateCommand("place_details");
                command2.CommandType = CommandType.StoredProcedure;
                SqlParameter route = new SqlParameter();
                route.ParameterName = "@route_id";
                route.DbType        = DbType.Int32;
                route.Value         = o.route_id;
                route.Direction     = ParameterDirection.Input;
                command2.Parameters.Add(route);


                SqlParameter p1city = new SqlParameter();
                p1city.ParameterName = "@p1_city";
                //p1city.SqlDbType = SqlDbType.VarChar;

                p1city.DbType    = DbType.String;
                p1city.Size      = 50;
                p1city.Direction = ParameterDirection.Output;
                command2.Parameters.Add(p1city);

                SqlParameter p1street = new SqlParameter();
                p1street.ParameterName = "@p1_street";
                p1street.DbType        = DbType.String;
                p1street.Size          = 50;
                p1street.Direction     = ParameterDirection.Output;
                command2.Parameters.Add(p1street);

                SqlParameter p1numer = new SqlParameter();
                p1numer.ParameterName = "@p1_numer";
                p1numer.DbType        = DbType.String;
                p1numer.Size          = 50;
                p1numer.Direction     = ParameterDirection.Output;
                command2.Parameters.Add(p1numer);

                SqlParameter p2city = new SqlParameter();
                p2city.ParameterName = "@p2_city";
                p2city.DbType        = DbType.String;
                p2city.Size          = 50;
                p2city.Direction     = ParameterDirection.Output;
                command2.Parameters.Add(p2city);

                SqlParameter p2street = new SqlParameter();
                p2street.ParameterName = "@p2_street";
                p2street.DbType        = DbType.String;
                p2street.Size          = 50;
                p2street.Direction     = ParameterDirection.Output;
                command2.Parameters.Add(p2street);

                SqlParameter p2numer = new SqlParameter();
                p2numer.ParameterName = "@p2_numer";
                p2numer.DbType        = DbType.String;
                p2numer.Size          = 50;
                p2numer.Direction     = ParameterDirection.Output;
                command2.Parameters.Add(p2numer);


                db.ExecuteNonQuery(command2);
                string result1 = command2.Parameters["@p1_city"].Value.ToString();
                string result2 = command2.Parameters["@p1_street"].Value.ToString();
                string result3 = command2.Parameters["@p1_numer"].Value.ToString();
                string result4 = command2.Parameters["@p2_city"].Value.ToString();
                string result5 = command2.Parameters["@p2_street"].Value.ToString();
                string result6 = command2.Parameters["@p2_numer"].Value.ToString();

                Console.WriteLine(result1 + " " + result2 + " " + result3 + " - " + result4 + " " + result5 + " " + result6);
            }
            db.Close();
        }