Example #1
0
        private void CheckDeleteErrorsOsnovaosiguranja()
        {
            ReadWriteCommand command2 = this.connDefault.GetCommand("SELECT TOP 1 [IDOSNOVAOSIGURANJA] AS ZAMOOIDOSNOVAOSIGURANJA FROM [OSNOVAOSIGURANJA] WITH (NOLOCK) WHERE [ZAMOOIDOSNOVAOSIGURANJA] = @IDOSNOVAOSIGURANJA ", false);

            if (command2.IDbCommand.Parameters.Count == 0)
            {
                command2.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@IDOSNOVAOSIGURANJA", DbType.String, 2));
            }
            command2.SetParameterString(0, RuntimeHelpers.GetObjectValue(this.rowOSNOVAOSIGURANJA["IDOSNOVAOSIGURANJA"]));
            IDataReader reader2 = command2.FetchData();

            if (command2.HasMoreRows)
            {
                reader2.Close();
                throw new OSNOVAOSIGURANJAInvalidDeleteException(string.Format(this.resourceManager.GetString("del"), new object[] { "OSNOVAOSIGURANJA" }));
            }
            reader2.Close();
            ReadWriteCommand command = this.connDefault.GetCommand("SELECT TOP 1 [IDELEMENT] FROM [ELEMENT] WITH (NOLOCK) WHERE [IDOSNOVAOSIGURANJA] = @IDOSNOVAOSIGURANJA ", false);

            if (command.IDbCommand.Parameters.Count == 0)
            {
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@IDOSNOVAOSIGURANJA", DbType.String, 2));
            }
            command.SetParameterString(0, RuntimeHelpers.GetObjectValue(this.rowOSNOVAOSIGURANJA["IDOSNOVAOSIGURANJA"]));
            IDataReader reader = command.FetchData();

            if (command.HasMoreRows)
            {
                reader.Close();
                throw new ELEMENTInvalidDeleteException(string.Format(this.resourceManager.GetString("del"), new object[] { "ELEMENT" }));
            }
            reader.Close();
        }
Example #2
0
        private void InsertOsnovaosiguranja()
        {
            this.CheckOptimisticConcurrencyOsnovaosiguranja();
            this.CheckExtendedTableOsnovaosiguranja();
            this.AfterConfirmOsnovaosiguranja();
            ReadWriteCommand command = this.connDefault.GetCommand("INSERT INTO [OSNOVAOSIGURANJA] ([IDOSNOVAOSIGURANJA], [RAZDOBLJESESMIJEPREKLAPATI], [NAZIVOSNOVAOSIGURANJA], [ZAMOOIDOSNOVAOSIGURANJA]) VALUES (@IDOSNOVAOSIGURANJA, @RAZDOBLJESESMIJEPREKLAPATI, @NAZIVOSNOVAOSIGURANJA, @ZAMOOIDOSNOVAOSIGURANJA)", false);

            if (command.IDbCommand.Parameters.Count == 0)
            {
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@IDOSNOVAOSIGURANJA", DbType.String, 2));
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@RAZDOBLJESESMIJEPREKLAPATI", DbType.Boolean));
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@NAZIVOSNOVAOSIGURANJA", DbType.String, 100));
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@ZAMOOIDOSNOVAOSIGURANJA", DbType.String, 2));
            }
            command.ErrorMask |= ErrorMask.DuplicateKeyError;
            command.SetParameterString(0, RuntimeHelpers.GetObjectValue(this.rowOSNOVAOSIGURANJA["IDOSNOVAOSIGURANJA"]));
            command.SetParameter(1, RuntimeHelpers.GetObjectValue(this.rowOSNOVAOSIGURANJA["RAZDOBLJESESMIJEPREKLAPATI"]));
            command.SetParameter(2, RuntimeHelpers.GetObjectValue(this.rowOSNOVAOSIGURANJA["NAZIVOSNOVAOSIGURANJA"]));
            command.SetParameter(3, RuntimeHelpers.GetObjectValue(this.rowOSNOVAOSIGURANJA["ZAMOOIDOSNOVAOSIGURANJA"]));
            command.ExecuteStmt();
            if (command.DupKey)
            {
                throw new OSNOVAOSIGURANJADuplicateKeyException(this.resourceManager.GetString("noupdate"));
            }
            this.OnOSNOVAOSIGURANJAUpdated(new OSNOVAOSIGURANJAEventArgs(this.rowOSNOVAOSIGURANJA, StatementType.Insert));
        }
Example #3
0
        private void GetByPrimaryKey()
        {
            ReadWriteCommand command = this.connDefault.GetCommand("SELECT [IDOSNOVAOSIGURANJA], [RAZDOBLJESESMIJEPREKLAPATI], [NAZIVOSNOVAOSIGURANJA], [ZAMOOIDOSNOVAOSIGURANJA] AS ZAMOOIDOSNOVAOSIGURANJA FROM [OSNOVAOSIGURANJA] WITH (NOLOCK) WHERE [IDOSNOVAOSIGURANJA] = @IDOSNOVAOSIGURANJA ", false);

            if (command.IDbCommand.Parameters.Count == 0)
            {
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@IDOSNOVAOSIGURANJA", DbType.String, 2));
            }
            command.SetParameterString(0, RuntimeHelpers.GetObjectValue(this.rowOSNOVAOSIGURANJA["IDOSNOVAOSIGURANJA"]));
            IDataReader reader = command.FetchData();

            if (command.HasMoreRows)
            {
                this.RcdFound18 = 1;
                this.rowOSNOVAOSIGURANJA["IDOSNOVAOSIGURANJA"]         = RuntimeHelpers.GetObjectValue(this.dsDefault.Db.GetStringNE(reader, 0));
                this.rowOSNOVAOSIGURANJA["RAZDOBLJESESMIJEPREKLAPATI"] = RuntimeHelpers.GetObjectValue(this.dsDefault.Db.GetBoolean(reader, 1));
                this.rowOSNOVAOSIGURANJA["NAZIVOSNOVAOSIGURANJA"]      = RuntimeHelpers.GetObjectValue(this.dsDefault.Db.GetString(reader, 2));
                this.rowOSNOVAOSIGURANJA["ZAMOOIDOSNOVAOSIGURANJA"]    = RuntimeHelpers.GetObjectValue(this.dsDefault.Db.GetString(reader, 3));
                this.sMode18 = this.Gx_mode;
                this.Gx_mode = StatementType.Select;
                this.LoadOsnovaosiguranja();
                this.Gx_mode = this.sMode18;
            }
            else
            {
                this.RcdFound18 = 0;
            }
            reader.Close();
        }
Example #4
0
        private void Delete()
        {
            this.Gx_mode = StatementType.Delete;
            this.CheckOptimisticConcurrencyOsnovaosiguranja();
            this.OnDeleteControlsOsnovaosiguranja();
            this.AfterConfirmOsnovaosiguranja();
            ReadWriteCommand command = this.connDefault.GetCommand("DELETE FROM [OSNOVAOSIGURANJA]  WHERE [IDOSNOVAOSIGURANJA] = @IDOSNOVAOSIGURANJA", false);

            if (command.IDbCommand.Parameters.Count == 0)
            {
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@IDOSNOVAOSIGURANJA", DbType.String, 2));
            }
            command.ErrorMask |= ErrorMask.ForeignKeyError;
            command.SetParameterString(0, RuntimeHelpers.GetObjectValue(this.rowOSNOVAOSIGURANJA["IDOSNOVAOSIGURANJA"]));
            command.ExecuteStmt();
            if (command.ForeignKeyError)
            {
                this.CheckDeleteErrorsOsnovaosiguranja();
            }
            this.OnOSNOVAOSIGURANJAUpdated(new OSNOVAOSIGURANJAEventArgs(this.rowOSNOVAOSIGURANJA, StatementType.Delete));
            this.rowOSNOVAOSIGURANJA.Delete();
            this.sMode18 = this.Gx_mode;
            this.Gx_mode = StatementType.Delete;
            this.Gx_mode = this.sMode18;
        }
Example #5
0
        private void UpdateOsobniodbitak()
        {
            this.CheckOptimisticConcurrencyOsobniodbitak();
            this.CheckExtendedTableOsobniodbitak();
            this.AfterConfirmOsobniodbitak();
            ReadWriteCommand command = this.connDefault.GetCommand("UPDATE [OSOBNIODBITAK] SET [NAZIVOSOBNIODBITAK]=@NAZIVOSOBNIODBITAK, [FAKTOROSOBNOGODBITKA]=@FAKTOROSOBNOGODBITKA  WHERE [IDOSOBNIODBITAK] = @IDOSOBNIODBITAK", false);

            if (command.IDbCommand.Parameters.Count == 0)
            {
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@NAZIVOSOBNIODBITAK", DbType.String, 100));
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@FAKTOROSOBNOGODBITKA", DbType.Currency));
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@IDOSOBNIODBITAK", DbType.Int32));
            }
            command.SetParameterString(0, RuntimeHelpers.GetObjectValue(this.rowOSOBNIODBITAK["NAZIVOSOBNIODBITAK"]));
            command.SetParameter(1, RuntimeHelpers.GetObjectValue(this.rowOSOBNIODBITAK["FAKTOROSOBNOGODBITKA"]));
            command.SetParameter(2, RuntimeHelpers.GetObjectValue(this.rowOSOBNIODBITAK["IDOSOBNIODBITAK"]));
            command.ExecuteStmt();
            this.OnOSOBNIODBITAKUpdated(new OSOBNIODBITAKEventArgs(this.rowOSOBNIODBITAK, StatementType.Update));
        }
Example #6
0
        private void UpdateOsnovaosiguranja()
        {
            this.CheckOptimisticConcurrencyOsnovaosiguranja();
            this.CheckExtendedTableOsnovaosiguranja();
            this.AfterConfirmOsnovaosiguranja();
            ReadWriteCommand command = this.connDefault.GetCommand("UPDATE [OSNOVAOSIGURANJA] SET [RAZDOBLJESESMIJEPREKLAPATI]=@RAZDOBLJESESMIJEPREKLAPATI, [NAZIVOSNOVAOSIGURANJA]=@NAZIVOSNOVAOSIGURANJA, [ZAMOOIDOSNOVAOSIGURANJA]=@ZAMOOIDOSNOVAOSIGURANJA  WHERE [IDOSNOVAOSIGURANJA] = @IDOSNOVAOSIGURANJA", false);

            if (command.IDbCommand.Parameters.Count == 0)
            {
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@RAZDOBLJESESMIJEPREKLAPATI", DbType.Boolean));
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@NAZIVOSNOVAOSIGURANJA", DbType.String, 100));
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@ZAMOOIDOSNOVAOSIGURANJA", DbType.String, 2));
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@IDOSNOVAOSIGURANJA", DbType.String, 2));
            }
            command.SetParameter(0, RuntimeHelpers.GetObjectValue(this.rowOSNOVAOSIGURANJA["RAZDOBLJESESMIJEPREKLAPATI"]));
            command.SetParameter(1, RuntimeHelpers.GetObjectValue(this.rowOSNOVAOSIGURANJA["NAZIVOSNOVAOSIGURANJA"]));
            command.SetParameter(2, RuntimeHelpers.GetObjectValue(this.rowOSNOVAOSIGURANJA["ZAMOOIDOSNOVAOSIGURANJA"]));
            command.SetParameterString(3, RuntimeHelpers.GetObjectValue(this.rowOSNOVAOSIGURANJA["IDOSNOVAOSIGURANJA"]));
            command.ExecuteStmt();
            this.OnOSNOVAOSIGURANJAUpdated(new OSNOVAOSIGURANJAEventArgs(this.rowOSNOVAOSIGURANJA, StatementType.Update));
        }
Example #7
0
        private void InsertOsobniodbitak()
        {
            this.CheckOptimisticConcurrencyOsobniodbitak();
            this.CheckExtendedTableOsobniodbitak();
            this.AfterConfirmOsobniodbitak();
            ReadWriteCommand command = this.connDefault.GetCommand("INSERT INTO [OSOBNIODBITAK] ([IDOSOBNIODBITAK], [NAZIVOSOBNIODBITAK], [FAKTOROSOBNOGODBITKA]) VALUES (@IDOSOBNIODBITAK, @NAZIVOSOBNIODBITAK, @FAKTOROSOBNOGODBITKA)", false);

            if (command.IDbCommand.Parameters.Count == 0)
            {
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@IDOSOBNIODBITAK", DbType.Int32));
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@NAZIVOSOBNIODBITAK", DbType.String, 100));
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@FAKTOROSOBNOGODBITKA", DbType.Currency));
            }
            command.ErrorMask |= ErrorMask.DuplicateKeyError;
            command.SetParameter(0, RuntimeHelpers.GetObjectValue(this.rowOSOBNIODBITAK["IDOSOBNIODBITAK"]));
            command.SetParameterString(1, RuntimeHelpers.GetObjectValue(this.rowOSOBNIODBITAK["NAZIVOSOBNIODBITAK"]));
            command.SetParameter(2, RuntimeHelpers.GetObjectValue(this.rowOSOBNIODBITAK["FAKTOROSOBNOGODBITKA"]));
            command.ExecuteStmt();
            if (command.DupKey)
            {
                throw new OSOBNIODBITAKDuplicateKeyException(this.resourceManager.GetString("noupdate"));
            }
            this.OnOSOBNIODBITAKUpdated(new OSOBNIODBITAKEventArgs(this.rowOSOBNIODBITAK, StatementType.Insert));
        }
Example #8
0
 private void CheckOptimisticConcurrencyOsnovaosiguranja()
 {
     if (this.Gx_mode != StatementType.Insert)
     {
         ReadWriteCommand command = this.connDefault.GetCommand("SELECT [IDOSNOVAOSIGURANJA], [RAZDOBLJESESMIJEPREKLAPATI], [NAZIVOSNOVAOSIGURANJA], [ZAMOOIDOSNOVAOSIGURANJA] AS ZAMOOIDOSNOVAOSIGURANJA FROM [OSNOVAOSIGURANJA] WITH (UPDLOCK) WHERE [IDOSNOVAOSIGURANJA] = @IDOSNOVAOSIGURANJA ", false);
         if (command.IDbCommand.Parameters.Count == 0)
         {
             command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@IDOSNOVAOSIGURANJA", DbType.String, 2));
         }
         command.SetParameterString(0, RuntimeHelpers.GetObjectValue(this.rowOSNOVAOSIGURANJA["IDOSNOVAOSIGURANJA"]));
         IDataReader reader = command.FetchData();
         if (command.Locked)
         {
             reader.Close();
             throw new OSNOVAOSIGURANJADataLockedException(string.Format(CultureInfo.InvariantCulture, this.resourceManager.GetString("lock"), new object[] { this.resourceManagerTables.GetString("OSNOVAOSIGURANJA") }));
         }
         if ((!command.HasMoreRows || !this.m__RAZDOBLJESESMIJEPREKLAPATIOriginal.Equals(RuntimeHelpers.GetObjectValue(this.dsDefault.Db.GetBoolean(reader, 1)))) || (!StringUtil.ObjectStringEquals(RuntimeHelpers.GetObjectValue(this.m__NAZIVOSNOVAOSIGURANJAOriginal), RuntimeHelpers.GetObjectValue(this.dsDefault.Db.GetString(reader, 2))) || !StringUtil.ObjectStringEquals(RuntimeHelpers.GetObjectValue(this.m__ZAMOOIDOSNOVAOSIGURANJAOriginal), RuntimeHelpers.GetObjectValue(this.dsDefault.Db.GetString(reader, 3)))))
         {
             reader.Close();
             throw new OSNOVAOSIGURANJADataChangedException(string.Format(CultureInfo.InvariantCulture, this.resourceManager.GetString("waschg"), new object[] { this.resourceManagerTables.GetString("OSNOVAOSIGURANJA") }));
         }
         reader.Close();
     }
 }