Пример #1
0
        public AlipayRechargeRecord[] GetAllExceptionAlipayRechargeRecords()
        {
            AlipayRechargeRecord[] records = null;
            MySqlConnection        myconn  = null;

            try
            {
                DataTable dt = new DataTable();

                myconn = MyDBHelper.Instance.CreateConnection();
                myconn.Open();
                string           cmdText = "select * from  alipayrecharge_exception_record ";
                MySqlCommand     mycmd   = new MySqlCommand(cmdText, myconn);
                MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd);
                adapter.Fill(dt);
                records = MetaDBAdapter <AlipayRechargeRecord> .GetAlipayRechargeRecordListFromDataTable(dt);

                dt.Clear();
                dt.Dispose();
                adapter.Dispose();
                mycmd.Dispose();

                return(records);
            }
            catch (Exception exc)
            {
                throw exc;
            }
            finally
            {
                MyDBHelper.Instance.DisposeConnection(myconn);
            }
        }
Пример #2
0
        public AlipayRechargeRecord SearchExceptionAlipayRechargeRecord(string orderNumber)
        {
            AlipayRechargeRecord[] records = null;
            MySqlConnection        myconn  = null;
            MySqlCommand           mycmd   = null;

            try
            {
                DataTable dt = new DataTable();

                myconn = MyDBHelper.Instance.CreateConnection();
                myconn.Open();
                string cmdText = "select * from  alipayrecharge_exception_record where out_trade_no = @out_trade_no ";
                mycmd = new MySqlCommand(cmdText, myconn);
                mycmd.Parameters.AddWithValue("@out_trade_no", orderNumber);
                MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd);
                adapter.Fill(dt);
                records = MetaDBAdapter <AlipayRechargeRecord> .GetAlipayRechargeRecordListFromDataTable(dt);

                dt.Clear();
                dt.Dispose();
                adapter.Dispose();
                if (records == null || records.Length == 0)
                {
                    return(null);
                }
                return(records[0]);
            }
            catch (Exception exc)
            {
                throw exc;
            }
            finally
            {
                if (mycmd != null)
                {
                    mycmd.Dispose();
                }
                MyDBHelper.Instance.DisposeConnection(myconn);
            }
        }
Пример #3
0
        public AlipayRechargeRecord[] GetAllAlipayRechargeRecords(string orderNumber, string alipayOrderNumber, string payEmail, string playerUserName, MyDateTime beginPayTime, MyDateTime endPayTime, int pageItemCount, int pageIndex)
        {
            AlipayRechargeRecord[] records = null;
            MySqlConnection        myconn  = null;

            try
            {
                myconn = MyDBHelper.Instance.CreateConnection();
                MySqlCommand mycmd = myconn.CreateCommand();
                DataTable    dt    = new DataTable();

                string sqlTextA = "select * from  alipayrechargerecord ";

                StringBuilder builder = new StringBuilder();
                if (!string.IsNullOrEmpty(orderNumber))
                {
                    if (builder.Length > 0)
                    {
                        builder.Append(" and ");
                    }
                    builder.Append(" out_trade_no = @orderNumber ");
                    mycmd.Parameters.AddWithValue("@orderNumber", orderNumber);
                }
                if (!string.IsNullOrEmpty(alipayOrderNumber))
                {
                    if (builder.Length > 0)
                    {
                        builder.Append(" and ");
                    }
                    builder.Append(" alipay_trade_no = @alipayOrderNumber ");
                    mycmd.Parameters.AddWithValue("@alipayOrderNumber", alipayOrderNumber);
                }
                if (!string.IsNullOrEmpty(payEmail))
                {
                    if (builder.Length > 0)
                    {
                        builder.Append(" and ");
                    }
                    builder.Append(" buyer_email = @payEmail ");
                    mycmd.Parameters.AddWithValue("@payEmail", payEmail);
                }
                if (!string.IsNullOrEmpty(playerUserName))
                {
                    if (builder.Length > 0)
                    {
                        builder.Append(" and ");
                    }
                    builder.Append(" user_name = @playerUserName ");
                    string encryptUserName = DESEncrypt.EncryptDES(playerUserName);
                    mycmd.Parameters.AddWithValue("@playerUserName", encryptUserName);
                }

                if (beginPayTime != null && !beginPayTime.IsNull && endPayTime != null && !endPayTime.IsNull)
                {
                    if (builder.Length > 0)
                    {
                        builder.Append(" and ");
                    }
                    DateTime beginTime = beginPayTime.ToDateTime();
                    DateTime endTime   = endPayTime.ToDateTime();
                    if (beginTime >= endTime)
                    {
                        return(null);
                    }
                    builder.Append(" pay_time >= @beginPayTime and pay_time < @endPayTime ");
                    mycmd.Parameters.AddWithValue("@beginPayTime", beginTime);
                    mycmd.Parameters.AddWithValue("@endPayTime", endTime);
                }
                string sqlWhere = "";
                if (builder.Length > 0)
                {
                    sqlWhere = " where " + builder.ToString();
                }

                string sqlOrderLimit = " order by id desc ";
                if (pageItemCount > 0)
                {
                    int start = pageIndex <= 0 ? 0 : (pageIndex - 1) * pageItemCount;
                    sqlOrderLimit += " limit " + start.ToString() + ", " + pageItemCount;
                }

                string sqlAllText = sqlTextA + sqlWhere + sqlOrderLimit;

                myconn.Open();
                mycmd.CommandText = sqlAllText;

                MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd);
                adapter.Fill(dt);
                records = MetaDBAdapter <AlipayRechargeRecord> .GetAlipayRechargeRecordListFromDataTable(dt);

                dt.Clear();
                dt.Dispose();
                adapter.Dispose();
                mycmd.Dispose();

                return(records);
            }
            catch (Exception exc)
            {
                throw exc;
            }
            finally
            {
                MyDBHelper.Instance.DisposeConnection(myconn);
            }
        }