using System.Data;
using System.Data.SqlClient;

namespace Baza_Reklam.Classes.Helpers
{
    public class ZamowienieHelper
    {
        public static void MakeZamowienieZafakturowane(int zamowienieId)
        {
            SqlConnection conn = null;
            SqlCommand cmd = null;

            try
            {
                conn = new SqlConnection(ConnString.getConnString().Value);
                conn.Open();
                cmd = new SqlCommand("sp_MakeZamowienieZafakturowane", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@zamowienieId", zamowienieId);
                cmd.ExecuteNonQuery();
            }
            finally
            {
                if (cmd != null)
                    cmd.Dispose();

                if (conn != null && conn.State == ConnectionState.Open)
                {
                    conn.Close();
                    conn.Dispose();
                }
            }

        }
    }
}