コード例 #1
0
        public override TList <Payout> GetPaged(TransactionManager transactionManager, string whereClause, string orderBy, int start, int pageLength, out int count)
        {
            SqlDatabase database = new SqlDatabase(this._connectionString);
            DbCommand   command  = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Payout_GetPaged", this._useStoredProcedure);

            database.AddInParameter(command, "@WhereClause", DbType.String, whereClause);
            database.AddInParameter(command, "@OrderBy", DbType.String, orderBy);
            database.AddInParameter(command, "@PageIndex", DbType.Int32, start);
            database.AddInParameter(command, "@PageSize", DbType.Int32, pageLength);
            IDataReader    reader = null;
            TList <Payout> rows   = new TList <Payout>();

            try
            {
                try
                {
                    if (transactionManager != null)
                    {
                        reader = Utility.ExecuteReader(transactionManager, command);
                    }
                    else
                    {
                        reader = Utility.ExecuteReader(database, command);
                    }
                    PayoutProviderBaseCore.Fill(reader, rows, 0, 0x7fffffff);
                    count = rows.Count;
                    if (reader.NextResult() && reader.Read())
                    {
                        count = reader.GetInt32(0);
                    }
                    return(rows);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
            return(rows);
        }
コード例 #2
0
        public override TList <Payout> Find(TransactionManager transactionManager, SqlFilterParameterCollection parameters, string orderBy, int start, int pageLength, out int count)
        {
            SqlDatabase database = new SqlDatabase(this._connectionString);
            DbCommand   command  = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Payout_Find_Dynamic", typeof(PayoutColumn), parameters, orderBy, start, pageLength);

            if (parameters != null)
            {
                for (int i = 0; i < parameters.Count; i++)
                {
                    SqlFilterParameter parameter = parameters[i];
                    database.AddInParameter(command, parameter.Name, parameter.DbType, parameter.Value);
                }
            }
            TList <Payout> rows   = new TList <Payout>();
            IDataReader    reader = null;

            try
            {
                if (transactionManager != null)
                {
                    reader = Utility.ExecuteReader(transactionManager, command);
                }
                else
                {
                    reader = Utility.ExecuteReader(database, command);
                }
                PayoutProviderBaseCore.Fill(reader, rows, 0, 0x7fffffff);
                count = rows.Count;
                if (!reader.NextResult())
                {
                    return(rows);
                }
                if (reader.Read())
                {
                    count = reader.GetInt32(0);
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
            return(rows);
        }
コード例 #3
0
        public override Payout GetByPayoutCode(TransactionManager transactionManager, string payoutCode, int start, int pageLength, out int count)
        {
            SqlDatabase database = new SqlDatabase(this._connectionString);
            DbCommand   command  = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Payout_GetByPayoutCode", this._useStoredProcedure);

            database.AddInParameter(command, "@PayoutCode", DbType.AnsiString, payoutCode);
            IDataReader    reader = null;
            TList <Payout> rows   = new TList <Payout>();

            try
            {
                if (transactionManager != null)
                {
                    reader = Utility.ExecuteReader(transactionManager, command);
                }
                else
                {
                    reader = Utility.ExecuteReader(database, command);
                }
                PayoutProviderBaseCore.Fill(reader, rows, start, pageLength);
                count = -1;
                if (reader.NextResult() && reader.Read())
                {
                    count = reader.GetInt32(0);
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
            if (rows.Count == 1)
            {
                return(rows[0]);
            }
            if (rows.Count != 0)
            {
                throw new DataException("Cannot find the unique instance of the class.");
            }
            return(null);
        }
コード例 #4
0
        public override TList <Payout> GetByProjectCode(TransactionManager transactionManager, string projectCode, int start, int pageLength, out int count)
        {
            SqlDatabase database = new SqlDatabase(this._connectionString);
            DbCommand   command  = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Payout_GetByProjectCode", this._useStoredProcedure);

            database.AddInParameter(command, "@ProjectCode", DbType.AnsiString, projectCode);
            IDataReader    reader = null;
            TList <Payout> rows   = new TList <Payout>();

            try
            {
                if (transactionManager != null)
                {
                    reader = Utility.ExecuteReader(transactionManager, command);
                }
                else
                {
                    reader = Utility.ExecuteReader(database, command);
                }
                PayoutProviderBaseCore.Fill(reader, rows, start, pageLength);
                count = -1;
                if (!reader.NextResult())
                {
                    return(rows);
                }
                if (reader.Read())
                {
                    count = reader.GetInt32(0);
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
            return(rows);
        }
コード例 #5
0
        public override TList <Payout> Find(TransactionManager transactionManager, string whereClause, int start, int pageLength, out int count)
        {
            count = -1;
            if (whereClause.IndexOf(";") > -1)
            {
                return(new TList <Payout>());
            }
            SqlDatabase database = new SqlDatabase(this._connectionString);
            DbCommand   command  = StoredProcedureProvider.GetCommandWrapper(database, "dbo.Payout_Find", this._useStoredProcedure);
            bool        flag     = false;

            if (whereClause.IndexOf(" OR ") > 0)
            {
                flag = true;
            }
            database.AddInParameter(command, "@SearchUsingOR", DbType.Boolean, flag);
            database.AddInParameter(command, "@PayoutCode", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@PayoutID", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@ProjectCode", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@PaymentCodes", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@PayoutDate", DbType.DateTime, DBNull.Value);
            database.AddInParameter(command, "@PaymentType", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@Payer", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@SupplyCode", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@BillNo", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@InvoNo", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@BankName", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@BankAccount", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@SubjectCode", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@Money", DbType.Decimal, DBNull.Value);
            database.AddInParameter(command, "@Status", DbType.Int32, DBNull.Value);
            database.AddInParameter(command, "@InputPerson", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@InputDate", DbType.DateTime, DBNull.Value);
            database.AddInParameter(command, "@CheckPerson", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@CheckDate", DbType.DateTime, DBNull.Value);
            database.AddInParameter(command, "@CheckOpinion", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@SupplyName", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@Remark", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@ReceiptCount", DbType.Int32, DBNull.Value);
            database.AddInParameter(command, "@GroupCode", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@IsApportioned", DbType.Int32, DBNull.Value);
            database.AddInParameter(command, "@Cash", DbType.Decimal, DBNull.Value);
            database.AddInParameter(command, "@MoneyType", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@ExchangeRate", DbType.Decimal, DBNull.Value);
            database.AddInParameter(command, "@VoucherNo", DbType.AnsiString, DBNull.Value);
            database.AddInParameter(command, "@SubjectSetCode", DbType.AnsiString, DBNull.Value);
            whereClause = whereClause.Replace(" AND ", "|").Replace(" OR ", "|");
            string[] textArray = whereClause.ToLower().Split(new char[] { '|' });
            char[]   trimChars = new char[] { '=' };
            char[]   chArray2  = new char[] { '\'' };
            foreach (string text in textArray)
            {
                if (text.Trim().StartsWith("payoutcode ") || text.Trim().StartsWith("payoutcode="))
                {
                    database.SetParameterValue(command, "@PayoutCode", text.Replace("payoutcode", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("payoutid ") || text.Trim().StartsWith("payoutid="))
                {
                    database.SetParameterValue(command, "@PayoutID", text.Replace("payoutid", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("projectcode ") || text.Trim().StartsWith("projectcode="))
                {
                    database.SetParameterValue(command, "@ProjectCode", text.Replace("projectcode", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("paymentcodes ") || text.Trim().StartsWith("paymentcodes="))
                {
                    database.SetParameterValue(command, "@PaymentCodes", text.Replace("paymentcodes", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("payoutdate ") || text.Trim().StartsWith("payoutdate="))
                {
                    database.SetParameterValue(command, "@PayoutDate", text.Replace("payoutdate", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("paymenttype ") || text.Trim().StartsWith("paymenttype="))
                {
                    database.SetParameterValue(command, "@PaymentType", text.Replace("paymenttype", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("payer ") || text.Trim().StartsWith("payer="))
                {
                    database.SetParameterValue(command, "@Payer", text.Replace("payer", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("supplycode ") || text.Trim().StartsWith("supplycode="))
                {
                    database.SetParameterValue(command, "@SupplyCode", text.Replace("supplycode", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("billno ") || text.Trim().StartsWith("billno="))
                {
                    database.SetParameterValue(command, "@BillNo", text.Replace("billno", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("invono ") || text.Trim().StartsWith("invono="))
                {
                    database.SetParameterValue(command, "@InvoNo", text.Replace("invono", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("bankname ") || text.Trim().StartsWith("bankname="))
                {
                    database.SetParameterValue(command, "@BankName", text.Replace("bankname", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("bankaccount ") || text.Trim().StartsWith("bankaccount="))
                {
                    database.SetParameterValue(command, "@BankAccount", text.Replace("bankaccount", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("subjectcode ") || text.Trim().StartsWith("subjectcode="))
                {
                    database.SetParameterValue(command, "@SubjectCode", text.Replace("subjectcode", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("money ") || text.Trim().StartsWith("money="))
                {
                    database.SetParameterValue(command, "@Money", text.Replace("money", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("status ") || text.Trim().StartsWith("status="))
                {
                    database.SetParameterValue(command, "@Status", text.Replace("status", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("inputperson ") || text.Trim().StartsWith("inputperson="))
                {
                    database.SetParameterValue(command, "@InputPerson", text.Replace("inputperson", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("inputdate ") || text.Trim().StartsWith("inputdate="))
                {
                    database.SetParameterValue(command, "@InputDate", text.Replace("inputdate", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("checkperson ") || text.Trim().StartsWith("checkperson="))
                {
                    database.SetParameterValue(command, "@CheckPerson", text.Replace("checkperson", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("checkdate ") || text.Trim().StartsWith("checkdate="))
                {
                    database.SetParameterValue(command, "@CheckDate", text.Replace("checkdate", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("checkopinion ") || text.Trim().StartsWith("checkopinion="))
                {
                    database.SetParameterValue(command, "@CheckOpinion", text.Replace("checkopinion", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("supplyname ") || text.Trim().StartsWith("supplyname="))
                {
                    database.SetParameterValue(command, "@SupplyName", text.Replace("supplyname", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("remark ") || text.Trim().StartsWith("remark="))
                {
                    database.SetParameterValue(command, "@Remark", text.Replace("remark", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("receiptcount ") || text.Trim().StartsWith("receiptcount="))
                {
                    database.SetParameterValue(command, "@ReceiptCount", text.Replace("receiptcount", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("groupcode ") || text.Trim().StartsWith("groupcode="))
                {
                    database.SetParameterValue(command, "@GroupCode", text.Replace("groupcode", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("isapportioned ") || text.Trim().StartsWith("isapportioned="))
                {
                    database.SetParameterValue(command, "@IsApportioned", text.Replace("isapportioned", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("cash ") || text.Trim().StartsWith("cash="))
                {
                    database.SetParameterValue(command, "@Cash", text.Replace("cash", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("moneytype ") || text.Trim().StartsWith("moneytype="))
                {
                    database.SetParameterValue(command, "@MoneyType", text.Replace("moneytype", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("exchangerate ") || text.Trim().StartsWith("exchangerate="))
                {
                    database.SetParameterValue(command, "@ExchangeRate", text.Replace("exchangerate", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else if (text.Trim().StartsWith("voucherno ") || text.Trim().StartsWith("voucherno="))
                {
                    database.SetParameterValue(command, "@VoucherNo", text.Replace("voucherno", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
                else
                {
                    if (!text.Trim().StartsWith("subjectsetcode ") && !text.Trim().StartsWith("subjectsetcode="))
                    {
                        throw new ArgumentException("Unable to use this part of the where clause in this version of Find: " + text);
                    }
                    database.SetParameterValue(command, "@SubjectSetCode", text.Replace("subjectsetcode", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2));
                }
            }
            IDataReader    reader = null;
            TList <Payout> rows   = new TList <Payout>();

            try
            {
                if (transactionManager != null)
                {
                    reader = Utility.ExecuteReader(transactionManager, command);
                }
                else
                {
                    reader = Utility.ExecuteReader(database, command);
                }
                PayoutProviderBaseCore.Fill(reader, rows, start, pageLength);
                if (reader.NextResult() && reader.Read())
                {
                    count = reader.GetInt32(0);
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
            return(rows);
        }