Beispiel #1
0
        /// <summary>
        ///     更新一条数据
        /// </summary>
        public bool Update(Model.Order.Cardwithholds model)
        {
            int rowsAffected = 0;

            SqlParameter[] parameters =
            {
                new SqlParameter("@id",            SqlDbType.Int,      4),
                new SqlParameter("@withholdid",    SqlDbType.Int,      4),
                new SqlParameter("@orderid",       SqlDbType.VarChar, 30),
                new SqlParameter("@withhold_type", SqlDbType.TinyInt,  1),
                new SqlParameter("@method",        SqlDbType.TinyInt,  1),
                new SqlParameter("@refervalue",    SqlDbType.Decimal,  9),
                new SqlParameter("@settle",        SqlDbType.Decimal,  9),
                new SqlParameter("@withhold",      SqlDbType.Decimal,  9),
                new SqlParameter("@backamt",       SqlDbType.Decimal,  9),
                new SqlParameter("@addtime",       SqlDbType.DateTime)
            };
            parameters[0].Value = model.id;
            parameters[1].Value = model.withholdid;
            parameters[2].Value = model.orderid;
            parameters[3].Value = model.withhold_type;
            parameters[4].Value = model.method;
            parameters[5].Value = model.refervalue;
            parameters[6].Value = model.settle;
            parameters[7].Value = model.withhold;
            parameters[8].Value = model.backamt;
            parameters[9].Value = model.addtime;

            DbHelperSQL.RunProcedure("proc_cardwithholds_Update", parameters, out rowsAffected);
            if (rowsAffected > 0)
            {
                return(true);
            }
            return(false);
        }
Beispiel #2
0
        /// <summary>
        ///     增加一条数据
        /// </summary>
        public int Add(Model.Order.Cardwithholds model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@id",            SqlDbType.Int,      4),
                new SqlParameter("@withholdid",    SqlDbType.Int,      4),
                new SqlParameter("@orderid",       SqlDbType.VarChar, 30),
                new SqlParameter("@withhold_type", SqlDbType.TinyInt,  1),
                new SqlParameter("@method",        SqlDbType.TinyInt,  1),
                new SqlParameter("@refervalue",    SqlDbType.Decimal,  9),
                new SqlParameter("@settle",        SqlDbType.Decimal,  9),
                new SqlParameter("@withhold",      SqlDbType.Decimal,  9),
                new SqlParameter("@backamt",       SqlDbType.Decimal,  9),
                new SqlParameter("@addtime",       SqlDbType.DateTime)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.withholdid;
            parameters[2].Value     = model.orderid;
            parameters[3].Value     = model.withhold_type;
            parameters[4].Value     = model.method;
            parameters[5].Value     = model.refervalue;
            parameters[6].Value     = model.settle;
            parameters[7].Value     = model.withhold;
            parameters[8].Value     = model.backamt;
            parameters[9].Value     = model.addtime;

            DbHelperSQL.RunProcedure("proc_cardwithholds_ADD", parameters, out rowsAffected);
            return((int)parameters[0].Value);
        }
Beispiel #3
0
        /// <summary>
        ///     得到一个对象实体
        /// </summary>
        public Model.Order.Cardwithholds DataRowToModel(DataRow row)
        {
            var model = new Model.Order.Cardwithholds();

            if (row != null)
            {
                if (row["id"] != null && row["id"].ToString() != "")
                {
                    model.id = int.Parse(row["id"].ToString());
                }
                if (row["withholdid"] != null && row["withholdid"].ToString() != "")
                {
                    model.withholdid = int.Parse(row["withholdid"].ToString());
                }
                if (row["orderid"] != null)
                {
                    model.orderid = row["orderid"].ToString();
                }
                if (row["withhold_type"] != null && row["withhold_type"].ToString() != "")
                {
                    model.withhold_type = int.Parse(row["withhold_type"].ToString());
                }
                if (row["method"] != null && row["method"].ToString() != "")
                {
                    model.method = int.Parse(row["method"].ToString());
                }
                if (row["refervalue"] != null && row["refervalue"].ToString() != "")
                {
                    model.refervalue = decimal.Parse(row["refervalue"].ToString());
                }
                if (row["settle"] != null && row["settle"].ToString() != "")
                {
                    model.settle = decimal.Parse(row["settle"].ToString());
                }
                if (row["withhold"] != null && row["withhold"].ToString() != "")
                {
                    model.withhold = decimal.Parse(row["withhold"].ToString());
                }
                if (row["backamt"] != null && row["backamt"].ToString() != "")
                {
                    model.backamt = decimal.Parse(row["backamt"].ToString());
                }
                if (row["addtime"] != null && row["addtime"].ToString() != "")
                {
                    model.addtime = DateTime.Parse(row["addtime"].ToString());
                }
            }
            return(model);
        }
Beispiel #4
0
        /// <summary>
        ///     得到一个对象实体
        /// </summary>
        public Model.Order.Cardwithholds GetModel(int id)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            var     model = new Model.Order.Cardwithholds();
            DataSet ds    = DbHelperSQL.RunProcedure("proc_cardwithholds_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            return(null);
        }