コード例 #1
0
ファイル: jmp_apprate.cs プロジェクト: sunman001/dxpay
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(JMP.MDL.jmp_apprate model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into jmp_apprate(");
            strSql.Append("r_id,r_appid,r_paymodeid,r_proportion,r_state,r_time,r_name");
            strSql.Append(") values (");
            strSql.Append("@r_id,@r_appid,@r_paymodeid,@r_proportion,@r_state,@r_time,@r_name");
            strSql.Append(") ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@r_id",         SqlDbType.Int,       4),
                new SqlParameter("@r_appid",      SqlDbType.Int,       4),
                new SqlParameter("@r_paymodeid",  SqlDbType.Int,       4),
                new SqlParameter("@r_proportion", SqlDbType.Decimal,   9),
                new SqlParameter("@r_state",      SqlDbType.Int,       4),
                new SqlParameter("@r_time",       SqlDbType.DateTime),
                new SqlParameter("@r_name",       SqlDbType.NVarChar, 50)
            };

            parameters[0].Value = model.r_id;
            parameters[1].Value = model.r_appid;
            parameters[2].Value = model.r_paymodeid;
            parameters[3].Value = model.r_proportion;
            parameters[4].Value = model.r_state;
            parameters[5].Value = model.r_time;
            parameters[6].Value = model.r_name;
            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
コード例 #2
0
ファイル: jmp_apprate.cs プロジェクト: sunman001/dxpay
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public JMP.MDL.jmp_apprate GetModel(int r_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select r_id, r_appid, r_paymodeid, r_proportion, r_state, r_time, r_name  ");
            strSql.Append("  from jmp_apprate ");
            strSql.Append(" where r_id=@r_id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@r_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = r_id;


            JMP.MDL.jmp_apprate model = new JMP.MDL.jmp_apprate();
            DataSet             ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["r_id"].ToString() != "")
                {
                    model.r_id = int.Parse(ds.Tables[0].Rows[0]["r_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["r_appid"].ToString() != "")
                {
                    model.r_appid = int.Parse(ds.Tables[0].Rows[0]["r_appid"].ToString());
                }
                if (ds.Tables[0].Rows[0]["r_paymodeid"].ToString() != "")
                {
                    model.r_paymodeid = int.Parse(ds.Tables[0].Rows[0]["r_paymodeid"].ToString());
                }
                if (ds.Tables[0].Rows[0]["r_proportion"].ToString() != "")
                {
                    model.r_proportion = decimal.Parse(ds.Tables[0].Rows[0]["r_proportion"].ToString());
                }
                if (ds.Tables[0].Rows[0]["r_state"].ToString() != "")
                {
                    model.r_state = int.Parse(ds.Tables[0].Rows[0]["r_state"].ToString());
                }
                if (ds.Tables[0].Rows[0]["r_time"].ToString() != "")
                {
                    model.r_time = DateTime.Parse(ds.Tables[0].Rows[0]["r_time"].ToString());
                }
                model.r_name = ds.Tables[0].Rows[0]["r_name"].ToString();

                return(model);
            }
            else
            {
                return(null);
            }
        }
コード例 #3
0
ファイル: jmp_apprate.cs プロジェクト: sunman001/dxpay
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(JMP.MDL.jmp_apprate model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update jmp_apprate set ");

            strSql.Append(" r_id = @r_id , ");
            strSql.Append(" r_appid = @r_appid , ");
            strSql.Append(" r_paymodeid = @r_paymodeid , ");
            strSql.Append(" r_proportion = @r_proportion , ");
            strSql.Append(" r_state = @r_state , ");
            strSql.Append(" r_time = @r_time , ");
            strSql.Append(" r_name = @r_name  ");
            strSql.Append(" where r_id=@r_id  ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@r_id",         SqlDbType.Int,       4),
                new SqlParameter("@r_appid",      SqlDbType.Int,       4),
                new SqlParameter("@r_paymodeid",  SqlDbType.Int,       4),
                new SqlParameter("@r_proportion", SqlDbType.Decimal,   9),
                new SqlParameter("@r_state",      SqlDbType.Int,       4),
                new SqlParameter("@r_time",       SqlDbType.DateTime),
                new SqlParameter("@r_name",       SqlDbType.NVarChar, 50)
            };

            parameters[0].Value = model.r_id;
            parameters[1].Value = model.r_appid;
            parameters[2].Value = model.r_paymodeid;
            parameters[3].Value = model.r_proportion;
            parameters[4].Value = model.r_state;
            parameters[5].Value = model.r_time;
            parameters[6].Value = model.r_name;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }