Пример #1
0
 private void CheckOptimisticConcurrencyOtisli()
 {
     if (this.Gx_mode != StatementType.Insert)
     {
         ReadWriteCommand command = this.connDefault.GetCommand("SELECT [DATUMODLASKA], [IDRADNIK] FROM [OTISLI] WITH (UPDLOCK) WHERE [IDRADNIK] = @IDRADNIK AND [DATUMODLASKA] = @DATUMODLASKA ", false);
         if (command.IDbCommand.Parameters.Count == 0)
         {
             command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@IDRADNIK", DbType.Int32));
             command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@DATUMODLASKA", DbType.Date));
         }
         command.SetParameter(0, RuntimeHelpers.GetObjectValue(this.rowOTISLI["IDRADNIK"]));
         command.SetParameterDateObject(1, RuntimeHelpers.GetObjectValue(this.rowOTISLI["DATUMODLASKA"]));
         IDataReader reader = command.FetchData();
         if (command.Locked)
         {
             reader.Close();
             throw new OTISLIDataLockedException(string.Format(CultureInfo.InvariantCulture, this.resourceManager.GetString("lock"), new object[] { this.resourceManagerTables.GetString("OTISLI") }));
         }
         if (!command.HasMoreRows)
         {
             reader.Close();
             throw new OTISLIDataChangedException(string.Format(CultureInfo.InvariantCulture, this.resourceManager.GetString("waschg"), new object[] { this.resourceManagerTables.GetString("OTISLI") }));
         }
         reader.Close();
     }
 }
Пример #2
0
        private void GetByPrimaryKey()
        {
            ReadWriteCommand command = this.connDefault.GetCommand("SELECT [DATUMODLASKA], [IDRADNIK] FROM [OTISLI] WITH (NOLOCK) WHERE [IDRADNIK] = @IDRADNIK AND [DATUMODLASKA] = @DATUMODLASKA ", false);

            if (command.IDbCommand.Parameters.Count == 0)
            {
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@IDRADNIK", DbType.Int32));
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@DATUMODLASKA", DbType.Date));
            }
            command.SetParameter(0, RuntimeHelpers.GetObjectValue(this.rowOTISLI["IDRADNIK"]));
            command.SetParameterDateObject(1, RuntimeHelpers.GetObjectValue(this.rowOTISLI["DATUMODLASKA"]));
            IDataReader reader = command.FetchData();

            if (command.HasMoreRows)
            {
                this.RcdFound294 = 1;
                this.rowOTISLI["DATUMODLASKA"] = RuntimeHelpers.GetObjectValue(this.dsDefault.Db.GetDateTime(reader, 0));
                this.rowOTISLI["IDRADNIK"]     = RuntimeHelpers.GetObjectValue(this.dsDefault.Db.GetInt32(reader, 1));
                this.sMode294 = this.Gx_mode;
                this.Gx_mode  = StatementType.Select;
                this.Gx_mode  = this.sMode294;
            }
            else
            {
                this.RcdFound294 = 0;
            }
            reader.Close();
        }
Пример #3
0
        private void InsertOtisli()
        {
            this.CheckOptimisticConcurrencyOtisli();
            this.AfterConfirmOtisli();
            ReadWriteCommand command = this.connDefault.GetCommand("INSERT INTO [OTISLI] ([DATUMODLASKA], [IDRADNIK]) VALUES (@DATUMODLASKA, @IDRADNIK)", false);

            if (command.IDbCommand.Parameters.Count == 0)
            {
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@DATUMODLASKA", DbType.Date));
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@IDRADNIK", DbType.Int32));
            }
            command.ErrorMask |= ErrorMask.ForeignKeyError;
            command.ErrorMask |= ErrorMask.DuplicateKeyError;
            command.SetParameterDateObject(0, RuntimeHelpers.GetObjectValue(this.rowOTISLI["DATUMODLASKA"]));
            command.SetParameter(1, RuntimeHelpers.GetObjectValue(this.rowOTISLI["IDRADNIK"]));
            command.ExecuteStmt();
            if (command.DupKey)
            {
                throw new OTISLIDuplicateKeyException(this.resourceManager.GetString("noupdate"));
            }
            if (command.ForeignKeyError)
            {
                this.CheckIntegrityErrorsOtisli();
            }
            this.OnOTISLIUpdated(new OTISLIEventArgs(this.rowOTISLI, StatementType.Insert));
        }
Пример #4
0
        private void Delete()
        {
            this.Gx_mode = StatementType.Delete;
            this.CheckOptimisticConcurrencyOtisli();
            this.AfterConfirmOtisli();
            ReadWriteCommand command = this.connDefault.GetCommand("DELETE FROM [OTISLI]  WHERE [IDRADNIK] = @IDRADNIK AND [DATUMODLASKA] = @DATUMODLASKA", false);

            if (command.IDbCommand.Parameters.Count == 0)
            {
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@IDRADNIK", DbType.Int32));
                command.IDbCommand.Parameters.Add(this.dsDefault.GetDbParameter("@DATUMODLASKA", DbType.Date));
            }
            command.ErrorMask |= ErrorMask.ForeignKeyError;
            command.SetParameter(0, RuntimeHelpers.GetObjectValue(this.rowOTISLI["IDRADNIK"]));
            command.SetParameterDateObject(1, RuntimeHelpers.GetObjectValue(this.rowOTISLI["DATUMODLASKA"]));
            command.ExecuteStmt();
            this.OnOTISLIUpdated(new OTISLIEventArgs(this.rowOTISLI, StatementType.Delete));
            this.rowOTISLI.Delete();
            this.sMode294 = this.Gx_mode;
            this.Gx_mode  = StatementType.Delete;
            this.Gx_mode  = this.sMode294;
        }