Ejemplo n.º 1
0
        public void CreateTanqueroEsclusas( )
        {
            String cmdBuffer;

            /* Indices for table TanqueroEsclusas */
            try
            {
                cmdBuffer = " CREATE TABLE [TanqueroEsclusas] ([TanqueroEsclusasID] smallint NOT NULL , [TanqueroEsclusasDesc] varchar(40) NOT NULL , PRIMARY KEY([TanqueroEsclusasID]))  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                DropTableConstraints("[TanqueroEsclusas]");
                cmdBuffer = " DROP TABLE [TanqueroEsclusas] "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
                cmdBuffer = " CREATE TABLE [TanqueroEsclusas] ([TanqueroEsclusasID] smallint NOT NULL , [TanqueroEsclusasDesc] varchar(40) NOT NULL , PRIMARY KEY([TanqueroEsclusasID]))  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
        }
Ejemplo n.º 2
0
        public void CreateQuimiqueros( )
        {
            String cmdBuffer;

            /* Indices for table Quimiqueros */
            try
            {
                cmdBuffer = " CREATE TABLE [Quimiqueros] ([QuimiquerosID] smallint NOT NULL  IDENTITY(1,1), [QuimiquerosBandaCPSUAB] decimal( 10) NOT NULL , [QuimiquerosTarifaCargados] smallmoney NOT NULL , [QuimiquerosTarifaLastre] smallmoney NOT NULL , PRIMARY KEY([QuimiquerosID]))  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                DropTableConstraints("[Quimiqueros]");
                cmdBuffer = " DROP TABLE [Quimiqueros] "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
                cmdBuffer = " CREATE TABLE [Quimiqueros] ([QuimiquerosID] smallint NOT NULL  IDENTITY(1,1), [QuimiquerosBandaCPSUAB] decimal( 10) NOT NULL , [QuimiquerosTarifaCargados] smallmoney NOT NULL , [QuimiquerosTarifaLastre] smallmoney NOT NULL , PRIMARY KEY([QuimiquerosID]))  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
        }
Ejemplo n.º 3
0
        public void CreateTanqueroEsclusasRango( )
        {
            String cmdBuffer;

            /* Indices for table TanqueroEsclusasRango */
            try
            {
                cmdBuffer = " CREATE TABLE [TanqueroEsclusasRango] ([TanqueroEsclusasID] smallint NOT NULL , [TanqueroRango] smallint NOT NULL , [TanqueroTarifaCPSUAB] smallmoney NOT NULL , [TanqueroBandaTM] decimal( 12) NOT NULL , [TanqueroTarifaTM] smallmoney NOT NULL , [TanqueroTarifaLastre] smallmoney NOT NULL , [TanqueroBandaCPSUAB] decimal( 10) NOT NULL , PRIMARY KEY([TanqueroEsclusasID], [TanqueroRango]))  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                DropTableConstraints("[TanqueroEsclusasRango]");
                cmdBuffer = " DROP TABLE [TanqueroEsclusasRango] "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
                cmdBuffer = " CREATE TABLE [TanqueroEsclusasRango] ([TanqueroEsclusasID] smallint NOT NULL , [TanqueroRango] smallint NOT NULL , [TanqueroTarifaCPSUAB] smallmoney NOT NULL , [TanqueroBandaTM] decimal( 12) NOT NULL , [TanqueroTarifaTM] smallmoney NOT NULL , [TanqueroTarifaLastre] smallmoney NOT NULL , [TanqueroBandaCPSUAB] decimal( 10) NOT NULL , PRIMARY KEY([TanqueroEsclusasID], [TanqueroRango]))  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
        }
Ejemplo n.º 4
0
        public void CreateVEH_RORO( )
        {
            String cmdBuffer;

            /* Indices for table VEH_RORO */
            try
            {
                cmdBuffer = " CREATE TABLE [VEH_RORO] ([VEH_RORO_ID] smallint NOT NULL  IDENTITY(1,1), [VEH_RORO_TON_INI] money NOT NULL , [VEH_RORO_TON_FIN] money NOT NULL , [VEH_RORO_UTIL_INI] money NOT NULL , [VEH_RORO_UTIL_FIN] money NOT NULL , [VEH_RORO_TARIFA] money NOT NULL , PRIMARY KEY([VEH_RORO_ID]))  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                DropTableConstraints("[VEH_RORO]");
                cmdBuffer = " DROP TABLE [VEH_RORO] "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
                cmdBuffer = " CREATE TABLE [VEH_RORO] ([VEH_RORO_ID] smallint NOT NULL  IDENTITY(1,1), [VEH_RORO_TON_INI] money NOT NULL , [VEH_RORO_TON_FIN] money NOT NULL , [VEH_RORO_UTIL_INI] money NOT NULL , [VEH_RORO_UTIL_FIN] money NOT NULL , [VEH_RORO_TARIFA] money NOT NULL , PRIMARY KEY([VEH_RORO_ID]))  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
        }
Ejemplo n.º 5
0
        public void CreateTarifasGranelesSecos( )
        {
            String cmdBuffer;

            /* Indices for table TarifasGranelesSecos */
            try
            {
                cmdBuffer = " CREATE TABLE [TarifasGranelesSecos] ([TarifasGranelesSecosCodPeaje] decimal( 10) NOT NULL  IDENTITY(1,1), [TarifasGranelesSecosDescBandas] varchar(40) NOT NULL , [TarifasGranelesSecosBandas] decimal( 10) NOT NULL , [TarifasGranelesSecosTipoEsclus] varchar(40) NULL , [TarifasGranelesSecosTipoGranos] varchar(30) NOT NULL , [TarifasGranelesSecosTarifaS_DW] smallmoney NOT NULL , [TarifasGranelesSecosTarifaS_Ca] smallmoney NOT NULL , PRIMARY KEY([TarifasGranelesSecosCodPeaje]))  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                DropTableConstraints("[TarifasGranelesSecos]");
                cmdBuffer = " DROP TABLE [TarifasGranelesSecos] "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
                cmdBuffer = " CREATE TABLE [TarifasGranelesSecos] ([TarifasGranelesSecosCodPeaje] decimal( 10) NOT NULL  IDENTITY(1,1), [TarifasGranelesSecosDescBandas] varchar(40) NOT NULL , [TarifasGranelesSecosBandas] decimal( 10) NOT NULL , [TarifasGranelesSecosTipoEsclus] varchar(40) NULL , [TarifasGranelesSecosTipoGranos] varchar(30) NOT NULL , [TarifasGranelesSecosTarifaS_DW] smallmoney NOT NULL , [TarifasGranelesSecosTarifaS_Ca] smallmoney NOT NULL , PRIMARY KEY([TarifasGranelesSecosCodPeaje]))  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
        }
Ejemplo n.º 6
0
        public void CreateREF_CGRAL_DESP( )
        {
            String cmdBuffer;

            /* Indices for table REF_CGRAL_DESP */
            try
            {
                cmdBuffer = " CREATE TABLE [REF_CGRAL_DESP] ([REF_CGRAL_DESP_ID] smallint NOT NULL  IDENTITY(1,1), [REF_CGRAL_DESP_CARGA] varchar(150) NOT NULL , [REF_CGRAL_DESP_TIPO] varchar(50) NULL , [REF_CGRAL_DESP_ID_TON_TARIF] smallint NOT NULL , [REF_CGRAL_DESP_TON_TARIF] decimal( 10) NULL , [REF_CGRAL_DESP_TARIFA] money NOT NULL , [REF_CGRAL_DESP_COMENTARIO] varchar(250) NULL , PRIMARY KEY([REF_CGRAL_DESP_ID]))  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                DropTableConstraints("[REF_CGRAL_DESP]");
                cmdBuffer = " DROP TABLE [REF_CGRAL_DESP] "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
                cmdBuffer = " CREATE TABLE [REF_CGRAL_DESP] ([REF_CGRAL_DESP_ID] smallint NOT NULL  IDENTITY(1,1), [REF_CGRAL_DESP_CARGA] varchar(150) NOT NULL , [REF_CGRAL_DESP_TIPO] varchar(50) NULL , [REF_CGRAL_DESP_ID_TON_TARIF] smallint NOT NULL , [REF_CGRAL_DESP_TON_TARIF] decimal( 10) NULL , [REF_CGRAL_DESP_TARIFA] money NOT NULL , [REF_CGRAL_DESP_COMENTARIO] varchar(250) NULL , PRIMARY KEY([REF_CGRAL_DESP_ID]))  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
        }
Ejemplo n.º 7
0
        public void RIPropiedadBarrio( )
        {
            String cmdBuffer;

            try
            {
                cmdBuffer = " ALTER TABLE [Propiedad] ADD CONSTRAINT [IPROPIEDAD1] FOREIGN KEY ([BarrioId]) REFERENCES [Barrio] ([BarrioId]) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                try
                {
                    cmdBuffer = " ALTER TABLE [Propiedad] DROP CONSTRAINT [IPROPIEDAD1] "
                    ;
                    RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                    RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                    RGZ.ExecuteStmt();
                    RGZ.Drop();
                }
                catch (Exception sqlex1)
                {
                }
                cmdBuffer = " ALTER TABLE [Propiedad] ADD CONSTRAINT [IPROPIEDAD1] FOREIGN KEY ([BarrioId]) REFERENCES [Barrio] ([BarrioId]) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
        }
Ejemplo n.º 8
0
        public void RIPortaContenedoresRangoPortaContenedores( )
        {
            String cmdBuffer;

            try
            {
                cmdBuffer = " ALTER TABLE [PortaContenedoresRango] ADD CONSTRAINT [IPORTACONTENEDORESRANGO1] FOREIGN KEY ([PortaContenedoresEsclusa]) REFERENCES [PortaContenedores] ([PortaContenedoresEsclusa]) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                try
                {
                    cmdBuffer = " ALTER TABLE [PortaContenedoresRango] DROP CONSTRAINT [IPORTACONTENEDORESRANGO1] "
                    ;
                    RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                    RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                    RGZ.ExecuteStmt();
                    RGZ.Drop();
                }
                catch (Exception sqlex1)
                {
                }
                cmdBuffer = " ALTER TABLE [PortaContenedoresRango] ADD CONSTRAINT [IPORTACONTENEDORESRANGO1] FOREIGN KEY ([PortaContenedoresEsclusa]) REFERENCES [PortaContenedores] ([PortaContenedoresEsclusa]) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
        }
Ejemplo n.º 9
0
        public void RIFacturaCliente( )
        {
            String cmdBuffer;

            try
            {
                cmdBuffer = " ALTER TABLE [Factura] ADD CONSTRAINT [IFACTURA1] FOREIGN KEY ([ClienteId]) REFERENCES [Cliente] ([ClienteId]) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                try
                {
                    cmdBuffer = " ALTER TABLE [Factura] DROP CONSTRAINT [IFACTURA1] "
                    ;
                    RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                    RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                    RGZ.ExecuteStmt();
                    RGZ.Drop();
                }
                catch (Exception sqlex1)
                {
                }
                cmdBuffer = " ALTER TABLE [Factura] ADD CONSTRAINT [IFACTURA1] FOREIGN KEY ([ClienteId]) REFERENCES [Cliente] ([ClienteId]) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
        }
Ejemplo n.º 10
0
        public void RIVisitasVisitaProPropiedad( )
        {
            String cmdBuffer;

            try
            {
                cmdBuffer = " ALTER TABLE [VisitasVisitaPro] ADD CONSTRAINT [IVISITASVISITAPRO1] FOREIGN KEY ([PropiedadId]) REFERENCES [Propiedad] ([PropiedadId]) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                try
                {
                    cmdBuffer = " ALTER TABLE [VisitasVisitaPro] DROP CONSTRAINT [IVISITASVISITAPRO1] "
                    ;
                    RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                    RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                    RGZ.ExecuteStmt();
                    RGZ.Drop();
                }
                catch (Exception sqlex1)
                {
                }
                cmdBuffer = " ALTER TABLE [VisitasVisitaPro] ADD CONSTRAINT [IVISITASVISITAPRO1] FOREIGN KEY ([PropiedadId]) REFERENCES [Propiedad] ([PropiedadId]) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
        }
Ejemplo n.º 11
0
        public void RIBR_FamilyhistoryBR_Encounter( )
        {
            String cmdBuffer;

            try
            {
                cmdBuffer = " ALTER TABLE [BR_Familyhistory] ADD CONSTRAINT [IBR_FAMILYHISTORY1] FOREIGN KEY ([BR_EncounterID]) REFERENCES [BR_Encounter] ([BR_EncounterID]) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                try
                {
                    cmdBuffer = " ALTER TABLE [BR_Familyhistory] DROP CONSTRAINT [IBR_FAMILYHISTORY1] "
                    ;
                    RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                    RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                    RGZ.ExecuteStmt();
                    RGZ.Drop();
                }
                catch (Exception sqlex1)
                {
                }
                cmdBuffer = " ALTER TABLE [BR_Familyhistory] ADD CONSTRAINT [IBR_FAMILYHISTORY1] FOREIGN KEY ([BR_EncounterID]) REFERENCES [BR_Encounter] ([BR_EncounterID]) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
        }
Ejemplo n.º 12
0
        public void ReorganizePedido( )
        {
            String cmdBuffer = "";

            /* Indices for table Pedido */
            cmdBuffer = " ALTER TABLE [Pedido] ADD [PedidoDescontoFrete]  money NOT NULL CONSTRAINT PedidoDescontoFretePedido_DEFAULT DEFAULT convert(int, 0), [PedidoTotal]  money NOT NULL CONSTRAINT PedidoTotalPedido_DEFAULT DEFAULT convert(int, 0) "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
            cmdBuffer = " ALTER TABLE [Pedido] DROP CONSTRAINT PedidoDescontoFretePedido_DEFAULT "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
            cmdBuffer = " UPDATE [Pedido] SET [PedidoTotal]=T.[PedidoTotal] FROM (SELECT T1.[PedidoId], COALESCE( T2.[PedidoTotal], 0) AS PedidoTotal FROM ([Pedido] T1 LEFT JOIN (SELECT COALESCE( T4.[GXC1], 0) AS PedidoTotal, T3.[PedidoId] FROM ([Pedido] T3 LEFT JOIN (SELECT SUM(T6.[ProdutoValor] * CAST(T5.[PedidoItemQtd] AS decimal( 22, 10))) AS GXC1, T5.[PedidoId] FROM ([PedidoItem] T5 INNER JOIN [Produto] T6 ON T6.[ProdutoId] = T5.[ProdutoId]) GROUP BY T5.[PedidoId] ) T4 ON T4.[PedidoId] = T3.[PedidoId]) ) T2 ON T2.[PedidoId] = T1.[PedidoId])) T WHERE [Pedido].PedidoId= T.PedidoId "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
            cmdBuffer = " ALTER TABLE [Pedido] DROP CONSTRAINT PedidoTotalPedido_DEFAULT "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
        }
Ejemplo n.º 13
0
        public void RITanqueroEsclusasRangoTanqueroEsclusas( )
        {
            String cmdBuffer;

            try
            {
                cmdBuffer = " ALTER TABLE [TanqueroEsclusasRango] ADD CONSTRAINT [ITANQUEROESCLUSASRANGO1] FOREIGN KEY ([TanqueroEsclusasID]) REFERENCES [TanqueroEsclusas] ([TanqueroEsclusasID]) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                try
                {
                    cmdBuffer = " ALTER TABLE [TanqueroEsclusasRango] DROP CONSTRAINT [ITANQUEROESCLUSASRANGO1] "
                    ;
                    RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                    RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                    RGZ.ExecuteStmt();
                    RGZ.Drop();
                }
                catch (Exception sqlex1)
                {
                }
                cmdBuffer = " ALTER TABLE [TanqueroEsclusasRango] ADD CONSTRAINT [ITANQUEROESCLUSASRANGO1] FOREIGN KEY ([TanqueroEsclusasID]) REFERENCES [TanqueroEsclusas] ([TanqueroEsclusasID]) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
        }
Ejemplo n.º 14
0
        public void CreatePortaContenedoresRango( )
        {
            String cmdBuffer;

            /* Indices for table PortaContenedoresRango */
            try
            {
                cmdBuffer = " CREATE TABLE [PortaContenedoresRango] ([PortaContenedoresEsclusa] smallint NOT NULL , [PortaRango] smallint NOT NULL , [PortaRangoIniTEU] decimal( 12) NOT NULL , [PortaRangoFinTEU] decimal( 12) NOT NULL , [PortaTarifaTTA4] smallmoney NOT NULL , [PortaTarifaTEU4] smallmoney NOT NULL , [PortaTarifaTTA3] smallmoney NOT NULL , [PortaTarifaTEU3] smallmoney NOT NULL , [PortaTarifaTTA2] smallmoney NOT NULL , [PortaTarifaTEU2] smallmoney NOT NULL , [PortaTarifaTTA1] smallmoney NOT NULL , [PortaTarifaTEU1] smallmoney NOT NULL , PRIMARY KEY([PortaContenedoresEsclusa], [PortaRango]))  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                DropTableConstraints("[PortaContenedoresRango]");
                cmdBuffer = " DROP TABLE [PortaContenedoresRango] "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
                cmdBuffer = " CREATE TABLE [PortaContenedoresRango] ([PortaContenedoresEsclusa] smallint NOT NULL , [PortaRango] smallint NOT NULL , [PortaRangoIniTEU] decimal( 12) NOT NULL , [PortaRangoFinTEU] decimal( 12) NOT NULL , [PortaTarifaTTA4] smallmoney NOT NULL , [PortaTarifaTEU4] smallmoney NOT NULL , [PortaTarifaTTA3] smallmoney NOT NULL , [PortaTarifaTEU3] smallmoney NOT NULL , [PortaTarifaTTA2] smallmoney NOT NULL , [PortaTarifaTEU2] smallmoney NOT NULL , [PortaTarifaTTA1] smallmoney NOT NULL , [PortaTarifaTEU1] smallmoney NOT NULL , PRIMARY KEY([PortaContenedoresEsclusa], [PortaRango]))  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
        }
Ejemplo n.º 15
0
        public void ReorganizeBR_Encounter( )
        {
            String cmdBuffer = "";

            /* Indices for table BR_Encounter */
            cmdBuffer = " ALTER TABLE [BR_Encounter] ADD [EncounterIDEncrypt]  nvarchar(500) NULL  "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
        }
Ejemplo n.º 16
0
        public void ExecBeforeReorg()
        {
            ArrayList    stmts     = ParseStmtFile(ReorgScriptType.Before);
            IGxDataStore dsDefault = context.GetDataStore("Default");

            foreach (string stmt in stmts)
            {
                AddMsg(GXResourceManager.GetMessage("GXM_executing", new object[] { stmt }), null);
                GxCommand RGZ = new GxCommand(dsDefault.Db, stmt, dsDefault, 0, true, false, null);
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
        }
Ejemplo n.º 17
0
        public void ReorganizeCliente( )
        {
            String cmdBuffer;

            /* Indices for table Cliente */
            cmdBuffer = " ALTER TABLE [Cliente] ALTER COLUMN [ClienteDireccion] char(20) NOT NULL  "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
            cmdBuffer = " ALTER TABLE [Cliente] ALTER COLUMN [ClienteNombre] char(20) NOT NULL  "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
        }
Ejemplo n.º 18
0
        public void ReorganizeCustomer( )
        {
            String cmdBuffer;

            /* Indices for table Customer */
            cmdBuffer = " DROP INDEX [ICUSTOMER1] ON [Customer] "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
            cmdBuffer = " ALTER TABLE [Customer] ALTER COLUMN [CountryId] int NULL  "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
            try
            {
                cmdBuffer = " CREATE NONCLUSTERED INDEX [ICUSTOMER1] ON [Customer] ([CountryId] ) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                cmdBuffer = " DROP INDEX [ICUSTOMER1] ON [Customer] "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
                cmdBuffer = " CREATE NONCLUSTERED INDEX [ICUSTOMER1] ON [Customer] ([CountryId] ) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
        }
Ejemplo n.º 19
0
 void executePrivate( )
 {
     /* GeneXus formulas */
     /* Output device settings */
     /* Optimized copy (Insert w/Subselect). */
     cmdBuffer = " SET IDENTITY_INSERT [GXA0002] ON "
     ;
     RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
     RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
     RGZ.ExecuteStmt();
     RGZ.Drop();
     /* Using cursor CUSTOMERCO2 */
     pr_default.execute(0);
     pr_default.close(0);
     cmdBuffer = " SET IDENTITY_INSERT [GXA0002] OFF "
     ;
     RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
     RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
     RGZ.ExecuteStmt();
     RGZ.Drop();
     /* End optimized group. */
     this.cleanup();
 }
Ejemplo n.º 20
0
        public void DropTableConstraints(String sTableName)
        {
            String cmdBuffer;

            /* Using cursor P00067 */
            pr_default.execute(5, new Object[] { sTableName });
            while ((pr_default.getStatus(5) != 101))
            {
                constid       = P00067_Aconstid[0];
                nconstid      = P00067_nconstid[0];
                fkeyid        = P00067_Afkeyid[0];
                nfkeyid       = P00067_nfkeyid[0];
                rkeyid        = P00067_Arkeyid[0];
                nrkeyid       = P00067_nrkeyid[0];
                cmdBuffer     = "ALTER TABLE " + "[" + fkeyid + "] DROP CONSTRAINT " + constid;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
                pr_default.readNext(5);
            }
            pr_default.close(5);
        }
Ejemplo n.º 21
0
        public void ReorganizeCliente( )
        {
            String cmdBuffer = "";

            /* Indices for table Cliente */
            try
            {
                cmdBuffer = " CREATE TABLE [GXA0004] ([ClienteId]  smallint NOT NULL  IDENTITY(1,1), [ClienteNombre]  char(20) NOT NULL )  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                try
                {
                    DropTableConstraints("[GXA0004]");
                    cmdBuffer = " DROP TABLE [GXA0004] "
                    ;
                    RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                    RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                    RGZ.ExecuteStmt();
                    RGZ.Drop();
                }
                catch (Exception sqlex1)
                {
                    try
                    {
                        DropTableConstraints("[GXA0004]");
                        cmdBuffer = " DROP VIEW [GXA0004] "
                        ;
                        RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                        RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                        RGZ.ExecuteStmt();
                        RGZ.Drop();
                    }
                    catch (Exception sqlex2)
                    {
                        try
                        {
                            DropTableConstraints("[GXA0004]");
                            cmdBuffer = " DROP FUNCTION [GXA0004] "
                            ;
                            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                            RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                            RGZ.ExecuteStmt();
                            RGZ.Drop();
                        }
                        catch (Exception sqlex3)
                        {
                        }
                    }
                }
                cmdBuffer = " CREATE TABLE [GXA0004] ([ClienteId]  smallint NOT NULL  IDENTITY(1,1), [ClienteNombre]  char(20) NOT NULL )  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            cmdBuffer = " SET IDENTITY_INSERT [GXA0004] ON "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
            cmdBuffer = " INSERT INTO [GXA0004] ([ClienteId], [ClienteNombre]) SELECT [ClienteId], [ClienteNombre] FROM [Cliente] T1 "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
            cmdBuffer = " SET IDENTITY_INSERT [GXA0004] OFF "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
            try
            {
                DropTableConstraints("[Cliente]");
                cmdBuffer = " DROP TABLE [Cliente] "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception sqlex1)
            {
                try
                {
                    DropTableConstraints("[Cliente]");
                    cmdBuffer = " DROP VIEW [Cliente] "
                    ;
                    RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                    RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                    RGZ.ExecuteStmt();
                    RGZ.Drop();
                }
                catch (Exception sqlex2)
                {
                    try
                    {
                        DropTableConstraints("[Cliente]");
                        cmdBuffer = " DROP FUNCTION [Cliente] "
                        ;
                        RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                        RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                        RGZ.ExecuteStmt();
                        RGZ.Drop();
                    }
                    catch (Exception sqlex3)
                    {
                    }
                }
            }
            RGZ             = new GxCommand(dsDefault.Db, "sp_rename", dsDefault, 0, true, false, null);
            RGZ.CommandType = CommandType.StoredProcedure;
            RGZ.AddParameter("@objname", "[GXA0004]");
            RGZ.AddParameter("@newname", "Cliente");
            RGZ.ExecuteStmt();
            cmdBuffer = " ALTER TABLE [Cliente] ADD PRIMARY KEY([ClienteId]) "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
        }
Ejemplo n.º 22
0
        public void ReorganizeBR_Familyhistory( )
        {
            String cmdBuffer = "";

            /* Indices for table BR_Familyhistory */
            cmdBuffer = " ALTER TABLE [BR_Familyhistory] ADD [BR_EncounterID]  decimal( 18) NOT NULL CONSTRAINT BR_EncounterIDBR_Familyhistory_DEFAULT DEFAULT convert(int, 0) "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
            cmdBuffer = " UPDATE [BR_Familyhistory] SET [BR_EncounterID]=T.[BR_EncounterID] FROM (SELECT T1.[BR_FamilyhistoryID], T2.[BR_EncounterID] FROM ([BR_Familyhistory] T1 INNER JOIN [BR_EncounterReason] T2 ON T2.[BR_Encounter_ID] = T1.[BR_Encounter_ID])) T WHERE [BR_Familyhistory].BR_FamilyhistoryID= T.BR_FamilyhistoryID "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
            cmdBuffer = " ALTER TABLE [BR_Familyhistory] DROP CONSTRAINT BR_EncounterIDBR_Familyhistory_DEFAULT "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
            cmdBuffer = " DROP INDEX [IBR_FAMILYHISTORY1] ON [BR_Familyhistory] "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
            try
            {
                cmdBuffer = " CREATE NONCLUSTERED INDEX [IBR_FAMILYHISTORY1] ON [BR_Familyhistory] ([BR_EncounterID] ) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                cmdBuffer = " DROP INDEX [IBR_FAMILYHISTORY1] ON [BR_Familyhistory] "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
                cmdBuffer = " CREATE NONCLUSTERED INDEX [IBR_FAMILYHISTORY1] ON [BR_Familyhistory] ([BR_EncounterID] ) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            cmdBuffer = " ALTER TABLE [BR_Familyhistory] DROP CONSTRAINT [IBR_FAMILYHISTORY1] "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
            cmdBuffer = " ALTER TABLE [BR_Familyhistory] DROP COLUMN [BR_Encounter_ID] "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
        }
Ejemplo n.º 23
0
        void executePrivate( )
        {
            /* GeneXus formulas */
            /* Output device settings */
            cmdBuffer = " SET IDENTITY_INSERT [GXA0004] ON "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
            /* Using cursor INVOICECON2 */
            pr_default.execute(0);
            while ((pr_default.getStatus(0) != 101))
            {
                A1CountryId    = INVOICECON2_A1CountryId[0];
                n1CountryId    = INVOICECON2_n1CountryId[0];
                A3CustomerId   = INVOICECON2_A3CustomerId[0];
                A15InvoiceDate = INVOICECON2_A15InvoiceDate[0];
                A14InvoiceId   = INVOICECON2_A14InvoiceId[0];
                A1CountryId    = INVOICECON2_A1CountryId[0];
                n1CountryId    = INVOICECON2_n1CountryId[0];

                /*
                 * INSERT RECORD ON TABLE GXA0004
                 *
                 */
                AV2InvoiceId   = A14InvoiceId;
                AV3InvoiceDate = A15InvoiceDate;
                AV4CustomerId  = A3CustomerId;
                if (INVOICECON2_n1CountryId[0])
                {
                    AV5InvoiceCountryId = 0;
                }
                else
                {
                    AV5InvoiceCountryId = A1CountryId;
                }
                /* Using cursor INVOICECON3 */
                pr_default.execute(1, new Object[] { AV2InvoiceId, AV3InvoiceDate, AV4CustomerId, AV5InvoiceCountryId });
                pr_default.close(1);
                if ((pr_default.getStatus(1) == 1))
                {
                    context.Gx_err = 1;
                    Gx_emsg        = (String)(GXResourceManager.GetMessage("GXM_noupdate"));
                }
                else
                {
                    context.Gx_err = 0;
                    Gx_emsg        = "";
                }
                /* End Insert */
                pr_default.readNext(0);
            }
            pr_default.close(0);
            cmdBuffer = " SET IDENTITY_INSERT [GXA0004] OFF "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
            this.cleanup();
        }
Ejemplo n.º 24
0
 private void CreateDataBase( )
 {
     DS           = (GxDataStore)(context.GetDataStore("Default"));
     ErrCode      = DS.Connection.FullConnect();
     DataBaseName = DS.Connection.Database;
     if (ErrCode != 0)
     {
         DS.Connection.Database = "";
         ErrCode = DS.Connection.FullConnect();
         if (ErrCode == 0)
         {
             try
             {
                 GeneXus.Reorg.GXReorganization.AddMsg(GXResourceManager.GetMessage("GXM_dbcrea") + " " + DataBaseName, null);
                 cmdBuffer     = "CREATE DATABASE " + "[" + DataBaseName + "]";
                 RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                 RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                 RGZ.ExecuteStmt();
                 RGZ.Drop();
                 Count = 1;
             }
             catch (Exception ex)
             {
                 ErrCode = 1;
                 GeneXus.Reorg.GXReorganization.AddMsg(ex.Message, null);
                 throw ex;
             }
             ErrCode = DS.Connection.Disconnect();
             DS.Connection.Database = DataBaseName;
             ErrCode = DS.Connection.FullConnect();
             while ((ErrCode != 0) && (Count > 0) && (Count < 30))
             {
                 Res     = GXUtil.Sleep(1);
                 ErrCode = DS.Connection.FullConnect();
                 Count   = (short)(Count + 1);
             }
             setupDB = 0;
             if ((setupDB == 1) || GeneXus.Configuration.Preferences.MustSetupDB( ))
             {
                 defaultUsers = GXUtil.DefaultWebUser(context);
                 short gxidx;
                 gxidx = 1;
                 while (gxidx <= defaultUsers.Count)
                 {
                     defaultUser = ((String)defaultUsers.Item(gxidx));
                     try
                     {
                         GeneXus.Reorg.GXReorganization.AddMsg(GXResourceManager.GetMessage("GXM_dbadduser", new   object[]  { defaultUser, DataBaseName }), null);
                         cmdBuffer     = "CREATE LOGIN " + "[" + defaultUser + "]" + " FROM WINDOWS";
                         RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                         RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                         RGZ.ExecuteStmt();
                         RGZ.Drop();
                     }
                     catch (Exception ex)
                     {
                     }
                     try
                     {
                         cmdBuffer     = "CREATE USER " + "[" + defaultUser + "]" + " FOR LOGIN " + "[" + defaultUser + "]";
                         RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                         RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                         RGZ.ExecuteStmt();
                         RGZ.Drop();
                     }
                     catch (Exception ex)
                     {
                     }
                     try
                     {
                         cmdBuffer     = "EXEC sp_addrolemember N'db_datareader', N'" + defaultUser + "'";
                         RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                         RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                         RGZ.ExecuteStmt();
                         RGZ.Drop();
                     }
                     catch (Exception ex)
                     {
                     }
                     try
                     {
                         cmdBuffer     = "EXEC sp_addrolemember N'db_datawriter', N'" + defaultUser + "'";
                         RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                         RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                         RGZ.ExecuteStmt();
                         RGZ.Drop();
                     }
                     catch (Exception ex)
                     {
                     }
                     gxidx = (short)(gxidx + 1);
                 }
             }
         }
         if (ErrCode != 0)
         {
             ErrMsg = DS.ErrDescription;
             GeneXus.Reorg.GXReorganization.AddMsg(ErrMsg, null);
             ErrCode = 1;
             throw new Exception(ErrMsg);
         }
     }
 }
Ejemplo n.º 25
0
        public void ReorganizePropiedad( )
        {
            String cmdBuffer = "";

            /* Indices for table Propiedad */
            try
            {
                cmdBuffer = " CREATE TABLE [GXA0002] ([PropiedadId]  smallint NOT NULL , [PropiedadDescripcion]  char(50) NOT NULL , [PropiedadFoto]  VARBINARY(MAX) NOT NULL , [PropiedadFoto_GXI]  varchar(2048) NOT NULL , [PropiedadDireccion]  char(50) NOT NULL , [BarrioId]  smallint NOT NULL )  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                try
                {
                    DropTableConstraints("[GXA0002]");
                    cmdBuffer = " DROP TABLE [GXA0002] "
                    ;
                    RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                    RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                    RGZ.ExecuteStmt();
                    RGZ.Drop();
                }
                catch (Exception sqlex1)
                {
                    try
                    {
                        DropTableConstraints("[GXA0002]");
                        cmdBuffer = " DROP VIEW [GXA0002] "
                        ;
                        RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                        RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                        RGZ.ExecuteStmt();
                        RGZ.Drop();
                    }
                    catch (Exception sqlex2)
                    {
                        try
                        {
                            DropTableConstraints("[GXA0002]");
                            cmdBuffer = " DROP FUNCTION [GXA0002] "
                            ;
                            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                            RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                            RGZ.ExecuteStmt();
                            RGZ.Drop();
                        }
                        catch (Exception sqlex3)
                        {
                        }
                    }
                }
                cmdBuffer = " CREATE TABLE [GXA0002] ([PropiedadId]  smallint NOT NULL , [PropiedadDescripcion]  char(50) NOT NULL , [PropiedadFoto]  VARBINARY(MAX) NOT NULL , [PropiedadFoto_GXI]  varchar(2048) NOT NULL , [PropiedadDireccion]  char(50) NOT NULL , [BarrioId]  smallint NOT NULL )  "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            new propiedadconversion(context).execute( );
            try
            {
                DropTableConstraints("[Propiedad]");
                cmdBuffer = " DROP TABLE [Propiedad] "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception sqlex1)
            {
                try
                {
                    DropTableConstraints("[Propiedad]");
                    cmdBuffer = " DROP VIEW [Propiedad] "
                    ;
                    RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                    RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                    RGZ.ExecuteStmt();
                    RGZ.Drop();
                }
                catch (Exception sqlex2)
                {
                    try
                    {
                        DropTableConstraints("[Propiedad]");
                        cmdBuffer = " DROP FUNCTION [Propiedad] "
                        ;
                        RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                        RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                        RGZ.ExecuteStmt();
                        RGZ.Drop();
                    }
                    catch (Exception sqlex3)
                    {
                    }
                }
            }
            RGZ             = new GxCommand(dsDefault.Db, "sp_rename", dsDefault, 0, true, false, null);
            RGZ.CommandType = CommandType.StoredProcedure;
            RGZ.AddParameter("@objname", "[GXA0002]");
            RGZ.AddParameter("@newname", "Propiedad");
            RGZ.ExecuteStmt();
            cmdBuffer = " ALTER TABLE [Propiedad] ADD PRIMARY KEY([PropiedadId]) "
            ;
            RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
            RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
            RGZ.ExecuteStmt();
            RGZ.Drop();
            try
            {
                cmdBuffer = " CREATE NONCLUSTERED INDEX [IPROPIEDAD1] ON [Propiedad] ([BarrioId] ) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
            catch (Exception ex)
            {
                cmdBuffer = " DROP INDEX [IPROPIEDAD1] ON [Propiedad] "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_MASKNOTFOUND | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
                cmdBuffer = " CREATE NONCLUSTERED INDEX [IPROPIEDAD1] ON [Propiedad] ([BarrioId] ) "
                ;
                RGZ           = new GxCommand(dsDefault.Db, cmdBuffer, dsDefault, 0, true, false, null);
                RGZ.ErrorMask = GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK;
                RGZ.ExecuteStmt();
                RGZ.Drop();
            }
        }