Esempio n. 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ColoPay.Model.Pay.AgentPayFee model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Pay_AgentPayFee set ");
            strSql.Append("FeeRate=@FeeRate");
            strSql.Append(" where AgentID=@AgentID and PayModeId=@PayModeId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FeeRate",   SqlDbType.Decimal, 9),
                new SqlParameter("@AgentID",   SqlDbType.Int,     4),
                new SqlParameter("@PayModeId", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.FeeRate;
            parameters[1].Value = model.AgentID;
            parameters[2].Value = model.PayModeId;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(ColoPay.Model.Pay.AgentPayFee model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Pay_AgentPayFee(");
            strSql.Append("AgentID,PayModeId,FeeRate)");
            strSql.Append(" values (");
            strSql.Append("@AgentID,@PayModeId,@FeeRate)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AgentID",   SqlDbType.Int,     4),
                new SqlParameter("@PayModeId", SqlDbType.Int,     4),
                new SqlParameter("@FeeRate",   SqlDbType.Decimal, 9)
            };
            parameters[0].Value = model.AgentID;
            parameters[1].Value = model.PayModeId;
            parameters[2].Value = model.FeeRate;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ColoPay.Model.Pay.AgentPayFee GetModel(int AgentID, int PayModeId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 AgentID,PayModeId,FeeRate from Pay_AgentPayFee ");
            strSql.Append(" where AgentID=@AgentID and PayModeId=@PayModeId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AgentID",   SqlDbType.Int, 4),
                new SqlParameter("@PayModeId", SqlDbType.Int, 4)
            };
            parameters[0].Value = AgentID;
            parameters[1].Value = PayModeId;

            ColoPay.Model.Pay.AgentPayFee model = new ColoPay.Model.Pay.AgentPayFee();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ColoPay.Model.Pay.AgentPayFee DataRowToModel(DataRow row)
 {
     ColoPay.Model.Pay.AgentPayFee model = new ColoPay.Model.Pay.AgentPayFee();
     if (row != null)
     {
         if (row["AgentID"] != null && row["AgentID"].ToString() != "")
         {
             model.AgentID = int.Parse(row["AgentID"].ToString());
         }
         if (row["PayModeId"] != null && row["PayModeId"].ToString() != "")
         {
             model.PayModeId = int.Parse(row["PayModeId"].ToString());
         }
         if (row["FeeRate"] != null && row["FeeRate"].ToString() != "")
         {
             model.FeeRate = decimal.Parse(row["FeeRate"].ToString());
         }
     }
     return(model);
 }