Example #1
0
 public virtual int FillPage(PREGLEDZADUZENJADataSet dataSet, int startRow, int maxRows)
 {
     this.Initialize();
     this.connDefault         = this.dsDefault.GetReadWriteConnection(this.daCurrentTransaction);
     this.PREGLEDZADUZENJASet = dataSet;
     this.rowPARTNERZADUZENJE = this.PREGLEDZADUZENJASet.PARTNERZADUZENJE.NewPARTNERZADUZENJERow();
     this.orderString         = GetOrderString(this.Order, true);
     this.reverseOrderString  = GetOrderString(this.Order, false);
     try
     {
         this.executePrivate(startRow, maxRows);
     }
     finally
     {
         this.Cleanup();
     }
     return(0);
 }
Example #2
0
        public void executePrivate(int startRow, int maxRows)
        {
            this.m_WhereString = " WHERE " + this.filterString + "  T1.[AKTIVNO] = 1";
            if (maxRows >= 0)
            {
                if (startRow == 0)
                {
                    this.scmdbuf = "SELECT TOP " + maxRows.ToString() + "  T1.[IDPARTNER], T4.[NAZIVPARTNER], T4.[PARTNEROIB], T2.[NAZIVPROIZVOD], T1.[IDPROIZVOD], T1.[IDZADUZENJE], T1.[KOLICINAZADUZENJA], T1.[CIJENAZADUZENJA], T3.[FINPOREZSTOPA], T1.[RABATZADUZENJA], T1.[UGOVORBROJ], T1.[DATUMUGOVORA], T1.[AKTIVNO], T2.[FINPOREZIDPOREZ] FROM ((([PARTNERZADUZENJE] T1 INNER JOIN [PROIZVOD] T2 ON T2.[IDPROIZVOD] = T1.[IDPROIZVOD]) INNER JOIN [FINPOREZ] T3 ON T3.[FINPOREZIDPOREZ] = T2.[FINPOREZIDPOREZ]) INNER JOIN [PARTNER] T4 ON T4.[IDPARTNER] = T1.[IDPARTNER])" + this.m_WhereString + "" + this.orderString + "";
                }
                else
                {
                    string[] strArray = new string[] { "SELECT TOP ", (startRow + maxRows).ToString(), "  T1.[IDPARTNER], T4.[NAZIVPARTNER], T4.[PARTNEROIB], T2.[NAZIVPROIZVOD], T1.[IDPROIZVOD], T1.[IDZADUZENJE], T1.[KOLICINAZADUZENJA], T1.[CIJENAZADUZENJA], T3.[FINPOREZSTOPA], T1.[RABATZADUZENJA], T1.[UGOVORBROJ], T1.[DATUMUGOVORA], T1.[AKTIVNO], T2.[FINPOREZIDPOREZ] FROM ((([PARTNERZADUZENJE] T1 INNER JOIN [PROIZVOD] T2 ON T2.[IDPROIZVOD] = T1.[IDPROIZVOD]) INNER JOIN [FINPOREZ] T3 ON T3.[FINPOREZIDPOREZ] = T2.[FINPOREZIDPOREZ]) INNER JOIN [PARTNER] T4 ON T4.[IDPARTNER] = T1.[IDPARTNER])", this.m_WhereString, "", this.orderString, "" };
                    this.scmdbuf = string.Concat(strArray);
                }
            }
            else
            {
                this.scmdbuf = "SELECT T1.[IDPARTNER], T4.[NAZIVPARTNER], T4.[PARTNEROIB], T2.[NAZIVPROIZVOD], T1.[IDPROIZVOD], T1.[IDZADUZENJE], T1.[KOLICINAZADUZENJA], T1.[CIJENAZADUZENJA], T3.[FINPOREZSTOPA], T1.[RABATZADUZENJA], T1.[UGOVORBROJ], T1.[DATUMUGOVORA], T1.[AKTIVNO], T2.[FINPOREZIDPOREZ] FROM ((([PARTNERZADUZENJE] T1 INNER JOIN [PROIZVOD] T2 ON T2.[IDPROIZVOD] = T1.[IDPROIZVOD]) INNER JOIN [FINPOREZ] T3 ON T3.[FINPOREZIDPOREZ] = T2.[FINPOREZIDPOREZ]) INNER JOIN [PARTNER] T4 ON T4.[IDPARTNER] = T1.[IDPARTNER])" + this.m_WhereString + "" + this.orderString + " ";
            }
            this.cmPARTNERZADUZENJESelect2            = this.connDefault.GetCommand(this.scmdbuf, false);
            this.cmPARTNERZADUZENJESelect2.ErrorMask |= ErrorMask.Lock;
            this.PARTNERZADUZENJESelect2              = this.cmPARTNERZADUZENJESelect2.FetchData();
            while (this.cmPARTNERZADUZENJESelect2.HasMoreRows && (startRow > 0))
            {
                startRow--;
                this.cmPARTNERZADUZENJESelect2.HasMoreRows = this.PARTNERZADUZENJESelect2.Read();
            }
            int num = 0;

            while (this.cmPARTNERZADUZENJESelect2.HasMoreRows && (num != maxRows))
            {
                this.m_IDPARTNER         = this.dsDefault.Db.GetInt32(this.PARTNERZADUZENJESelect2, 0, ref this.m__IDPARTNERIsNull);
                this.m_NAZIVPARTNER      = this.dsDefault.Db.GetString(this.PARTNERZADUZENJESelect2, 1, ref this.m__NAZIVPARTNERIsNull).TrimEnd(new char[] { ' ' });
                this.m_PARTNEROIB        = this.dsDefault.Db.GetString(this.PARTNERZADUZENJESelect2, 2, ref this.m__PARTNEROIBIsNull);
                this.m_NAZIVPROIZVOD     = this.dsDefault.Db.GetString(this.PARTNERZADUZENJESelect2, 3, ref this.m__NAZIVPROIZVODIsNull);
                this.m_IDPROIZVOD        = this.dsDefault.Db.GetInt32(this.PARTNERZADUZENJESelect2, 4, ref this.m__IDPROIZVODIsNull);
                this.m_IDZADUZENJE       = this.dsDefault.Db.GetInt32(this.PARTNERZADUZENJESelect2, 5, ref this.m__IDZADUZENJEIsNull);
                this.m_KOLICINAZADUZENJA = this.dsDefault.Db.GetDecimal(this.PARTNERZADUZENJESelect2, 6, ref this.m__KOLICINAZADUZENJAIsNull);
                this.m_CIJENAZADUZENJA   = this.dsDefault.Db.GetDecimal(this.PARTNERZADUZENJESelect2, 7, ref this.m__CIJENAZADUZENJAIsNull);
                this.m_FINPOREZSTOPA     = this.dsDefault.Db.GetDecimal(this.PARTNERZADUZENJESelect2, 8, ref this.m__FINPOREZSTOPAIsNull);
                this.m_RABATZADUZENJA    = this.dsDefault.Db.GetDecimal(this.PARTNERZADUZENJESelect2, 9, ref this.m__RABATZADUZENJAIsNull);
                this.m_UGOVORBROJ        = this.dsDefault.Db.GetString(this.PARTNERZADUZENJESelect2, 10, ref this.m__UGOVORBROJIsNull);
                this.m_DATUMUGOVORA      = this.dsDefault.Db.GetDateTime(this.PARTNERZADUZENJESelect2, 11, ref this.m__DATUMUGOVORAIsNull);
                this.m_AKTIVNO           = this.dsDefault.Db.GetBoolean(this.PARTNERZADUZENJESelect2, 12, ref this.m__AKTIVNOIsNull);
                this.m_FINPOREZIDPOREZ   = this.dsDefault.Db.GetInt32(this.PARTNERZADUZENJESelect2, 13, ref this.m__FINPOREZIDPOREZIsNull);
                this.m_NAZIVPROIZVOD     = this.dsDefault.Db.GetString(this.PARTNERZADUZENJESelect2, 3, ref this.m__NAZIVPROIZVODIsNull);
                this.m_FINPOREZIDPOREZ   = this.dsDefault.Db.GetInt32(this.PARTNERZADUZENJESelect2, 13, ref this.m__FINPOREZIDPOREZIsNull);
                this.m_FINPOREZSTOPA     = this.dsDefault.Db.GetDecimal(this.PARTNERZADUZENJESelect2, 8, ref this.m__FINPOREZSTOPAIsNull);
                this.m_NAZIVPARTNER      = this.dsDefault.Db.GetString(this.PARTNERZADUZENJESelect2, 1, ref this.m__NAZIVPARTNERIsNull).TrimEnd(new char[] { ' ' });
                this.m_PARTNEROIB        = this.dsDefault.Db.GetString(this.PARTNERZADUZENJESelect2, 2, ref this.m__PARTNEROIBIsNull);
                this.m_IZNOSZADUZENJA    = decimal.Multiply(this.m_CIJENAZADUZENJA, this.m_KOLICINAZADUZENJA);
                if (!this.m__IZNOSZADUZENJAIsNull)
                {
                    this.m_IZNOSRABATAZADUZENJE = DB.RoundUP(decimal.Divide(decimal.Multiply(this.m_IZNOSZADUZENJA, this.m_RABATZADUZENJA), 100M));
                }
                if (!this.m__IZNOSZADUZENJAIsNull && !this.m__IZNOSRABATAZADUZENJEIsNull)
                {
                    this.m_CIJENAZAFAKTURU = decimal.Subtract(this.m_IZNOSZADUZENJA, this.m_IZNOSRABATAZADUZENJE);
                }
                this.rowPARTNERZADUZENJE = this.PREGLEDZADUZENJASet.PARTNERZADUZENJE.NewPARTNERZADUZENJERow();
                this.rowPARTNERZADUZENJE["IDPARTNER"]         = RuntimeHelpers.GetObjectValue(Interaction.IIf(this.m__IDPARTNERIsNull, RuntimeHelpers.GetObjectValue(Convert.DBNull), this.m_IDPARTNER));
                this.rowPARTNERZADUZENJE["NAZIVPARTNER"]      = RuntimeHelpers.GetObjectValue(Interaction.IIf(this.m__NAZIVPARTNERIsNull, RuntimeHelpers.GetObjectValue(Convert.DBNull), this.m_NAZIVPARTNER));
                this.rowPARTNERZADUZENJE["PARTNEROIB"]        = RuntimeHelpers.GetObjectValue(Interaction.IIf(this.m__PARTNEROIBIsNull, RuntimeHelpers.GetObjectValue(Convert.DBNull), this.m_PARTNEROIB));
                this.rowPARTNERZADUZENJE["NAZIVPROIZVOD"]     = RuntimeHelpers.GetObjectValue(Interaction.IIf(this.m__NAZIVPROIZVODIsNull, RuntimeHelpers.GetObjectValue(Convert.DBNull), this.m_NAZIVPROIZVOD));
                this.rowPARTNERZADUZENJE["IDPROIZVOD"]        = RuntimeHelpers.GetObjectValue(Interaction.IIf(this.m__IDPROIZVODIsNull, RuntimeHelpers.GetObjectValue(Convert.DBNull), this.m_IDPROIZVOD));
                this.rowPARTNERZADUZENJE["IDZADUZENJE"]       = RuntimeHelpers.GetObjectValue(Interaction.IIf(this.m__IDZADUZENJEIsNull, RuntimeHelpers.GetObjectValue(Convert.DBNull), this.m_IDZADUZENJE));
                this.rowPARTNERZADUZENJE["KOLICINAZADUZENJA"] = RuntimeHelpers.GetObjectValue(Interaction.IIf(this.m__KOLICINAZADUZENJAIsNull, RuntimeHelpers.GetObjectValue(Convert.DBNull), this.m_KOLICINAZADUZENJA));
                this.rowPARTNERZADUZENJE["CIJENAZADUZENJA"]   = RuntimeHelpers.GetObjectValue(Interaction.IIf(this.m__CIJENAZADUZENJAIsNull, RuntimeHelpers.GetObjectValue(Convert.DBNull), this.m_CIJENAZADUZENJA));
                this.rowPARTNERZADUZENJE["FINPOREZSTOPA"]     = RuntimeHelpers.GetObjectValue(Interaction.IIf(this.m__FINPOREZSTOPAIsNull, RuntimeHelpers.GetObjectValue(Convert.DBNull), this.m_FINPOREZSTOPA));
                this.rowPARTNERZADUZENJE.IZNOSZADUZENJA       = this.m_IZNOSZADUZENJA;
                this.rowPARTNERZADUZENJE["RABATZADUZENJA"]    = RuntimeHelpers.GetObjectValue(Interaction.IIf(this.m__RABATZADUZENJAIsNull, RuntimeHelpers.GetObjectValue(Convert.DBNull), this.m_RABATZADUZENJA));
                this.rowPARTNERZADUZENJE.IZNOSRABATAZADUZENJE = this.m_IZNOSRABATAZADUZENJE;
                this.rowPARTNERZADUZENJE.CIJENAZAFAKTURU      = this.m_CIJENAZAFAKTURU;
                this.rowPARTNERZADUZENJE["UGOVORBROJ"]        = RuntimeHelpers.GetObjectValue(Interaction.IIf(this.m__UGOVORBROJIsNull, RuntimeHelpers.GetObjectValue(Convert.DBNull), this.m_UGOVORBROJ));
                this.rowPARTNERZADUZENJE["DATUMUGOVORA"]      = RuntimeHelpers.GetObjectValue(Interaction.IIf(this.m__DATUMUGOVORAIsNull, RuntimeHelpers.GetObjectValue(Convert.DBNull), this.m_DATUMUGOVORA));
                this.rowPARTNERZADUZENJE["AKTIVNO"]           = RuntimeHelpers.GetObjectValue(Interaction.IIf(this.m__AKTIVNOIsNull, RuntimeHelpers.GetObjectValue(Convert.DBNull), this.m_AKTIVNO));
                this.AddRowPartnerzaduzenje();
                num++;
                this.cmPARTNERZADUZENJESelect2.HasMoreRows = this.PARTNERZADUZENJESelect2.Read();
            }
            this.PARTNERZADUZENJESelect2.Close();
            this.Cleanup();
        }