using Exferia_Aplicacion.General;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Exferia_Aplicacion.General.Enumerados;

namespace Exferia_EntityFramework.Script_Actualizacion
{
    public class Scripts_Version_1131
    {
        public static Version G_VRS_VERSION = new Version("1.1.3.1");
        public static long G_LNG_VERSION = 1131;
        public static int G_INT_TIPO = 0;
        public static string G_STR_SCRIPT =
                                    
                                    //AÑADIR el campo autorizarPedidoCompraAutomatico a la tabla GEN_EjerciciosActivos_Empresa
                                    "IF not exists " +
                                      "( " +
                                      "    SELECT * " +
                                      "    FROM INFORMATION_SCHEMA.COLUMNS " +
                                      "    WHERE COLUMN_NAME='autorizarPedidoCompraAutomatico' AND TABLE_NAME = 'GEN_EjerciciosActivos_Empresa' " +
                                      ") " +
                                    "BEGIN " +
                                        " ALTER TABLE [GEN_EjerciciosActivos_Empresa]ADD[autorizarPedidoCompraAutomatico] bit NULL " +
                                    "END " +
                                    //BORRAR el campo porcentajeCancelacion a la tabla MAE_Articulos
                                    "IF exists " +
                                      "( " +
                                      "    SELECT * " +
                                      "    FROM INFORMATION_SCHEMA.COLUMNS " +
                                      "    WHERE COLUMN_NAME='porcentajeCancelacion' AND TABLE_NAME = 'MAE_Articulos' " +
                                      ") " +
                                    "BEGIN " +
                                        " ALTER TABLE [MAE_Articulos] DROP COLUMN [porcentajeCancelacion] " +
                                    "END " +
                                    //AÑADIR el campo porcentajeCancelacion_Compras a la tabla MAE_Articulos
                                    "IF not exists " +
                                      "( " +
                                      "    SELECT * " +
                                      "    FROM INFORMATION_SCHEMA.COLUMNS " +
                                      "    WHERE COLUMN_NAME='porcentajeCancelacion_Compras' AND TABLE_NAME = 'MAE_Articulos' " +
                                      ") " +
                                    "BEGIN " +
                                        " ALTER TABLE [MAE_Articulos]ADD[porcentajeCancelacion_Compras] decimal(8,2) NULL " +
                                    "END " +
                                    //AÑADIR el campo porcentajeCancelacion_Ventas a la tabla MAE_Articulos
                                    "IF not exists " +
                                      "( " +
                                      "    SELECT * " +
                                      "    FROM INFORMATION_SCHEMA.COLUMNS " +
                                      "    WHERE COLUMN_NAME='porcentajeCancelacion_Ventas' AND TABLE_NAME = 'MAE_Articulos' " +
                                      ") " +
                                    "BEGIN " +
                                        " ALTER TABLE [MAE_Articulos]ADD[porcentajeCancelacion_Ventas] decimal(8,2) NULL " +
                                    "END ";
                                  

                                    

    }
}
