Beispiel #1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.Order.OrderCardSend model)
 {
     try
     {
         return(dal.Add(model));
     }
     catch (Exception exception)
     {
         ExceptionHandler.HandleException(exception);
         return(0);
     }
 }
Beispiel #2
0
        /// <summary>
        ///     增加一条数据
        /// </summary>
        public int Add(Model.Order.OrderCardSend model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@id",           SqlDbType.Int,          4),
                new SqlParameter("@orderid",      SqlDbType.VarChar,     30),
                new SqlParameter("@source",       SqlDbType.TinyInt,      1),
                new SqlParameter("@suppId",       SqlDbType.Int,          4),
                new SqlParameter("@success",      SqlDbType.TinyInt,      1),
                new SqlParameter("@summitStatus", SqlDbType.TinyInt,      1),
                new SqlParameter("@orderStatus",  SqlDbType.TinyInt,      1),
                new SqlParameter("@cardno",       SqlDbType.VarChar,     50),
                new SqlParameter("@cardpass",     SqlDbType.VarChar,     50),
                new SqlParameter("@suppTransNo",  SqlDbType.VarChar,     50),
                new SqlParameter("@responseText", SqlDbType.VarChar,   2000),
                new SqlParameter("@errCode",      SqlDbType.NVarChar,    50),
                new SqlParameter("@errMsg",       SqlDbType.NVarChar,   200),
                new SqlParameter("@initTime",     SqlDbType.DateTime),
                new SqlParameter("@message",      SqlDbType.NVarChar,   200),
                new SqlParameter("@completeTime", SqlDbType.DateTime),
                new SqlParameter("@typeid",       SqlDbType.Int,          4),
                new SqlParameter("@facevalue",    SqlDbType.Int, 4)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.orderid;
            parameters[2].Value     = model.source;
            parameters[3].Value     = model.suppId;
            parameters[4].Value     = model.success;
            parameters[5].Value     = model.summitStatus;
            parameters[6].Value     = model.orderStatus;
            parameters[7].Value     = model.cardno;
            parameters[8].Value     = model.cardpass;
            parameters[9].Value     = model.suppTransNo;
            parameters[10].Value    = model.responseText;
            parameters[11].Value    = model.errCode;
            parameters[12].Value    = model.errMsg;
            parameters[13].Value    = model.initTime;
            parameters[14].Value    = model.message;
            parameters[15].Value    = model.completeTime;

            parameters[16].Value = model.typeid;
            parameters[17].Value = model.facevalue;

            DbHelperSQL.RunProcedure("proc_ordercardsend_ADD", parameters, out rowsAffected);
            return((int)parameters[0].Value);
        }
Beispiel #3
0
        /// <summary>
        ///     更新一条数据
        /// </summary>
        public bool Update(Model.Order.OrderCardSend model)
        {
            int rowsAffected = 0;

            SqlParameter[] parameters =
            {
                new SqlParameter("@id",           SqlDbType.Int,          4),
                new SqlParameter("@orderid",      SqlDbType.VarChar,     30),
                new SqlParameter("@source",       SqlDbType.TinyInt,      1),
                new SqlParameter("@suppId",       SqlDbType.Int,          4),
                new SqlParameter("@success",      SqlDbType.TinyInt,      1),
                new SqlParameter("@summitStatus", SqlDbType.TinyInt,      1),
                new SqlParameter("@orderStatus",  SqlDbType.TinyInt,      1),
                new SqlParameter("@cardno",       SqlDbType.VarChar,     50),
                new SqlParameter("@cardpass",     SqlDbType.VarChar,     50),
                new SqlParameter("@suppTransNo",  SqlDbType.VarChar,     50),
                new SqlParameter("@responseText", SqlDbType.VarChar,   2000),
                new SqlParameter("@errCode",      SqlDbType.NVarChar,    50),
                new SqlParameter("@errMsg",       SqlDbType.NVarChar,   200),
                new SqlParameter("@initTime",     SqlDbType.DateTime),
                new SqlParameter("@message",      SqlDbType.NVarChar,   200),
                new SqlParameter("@completeTime", SqlDbType.DateTime)
            };
            parameters[0].Value  = model.id;
            parameters[1].Value  = model.orderid;
            parameters[2].Value  = model.source;
            parameters[3].Value  = model.suppId;
            parameters[4].Value  = model.success;
            parameters[5].Value  = model.summitStatus;
            parameters[6].Value  = model.orderStatus;
            parameters[7].Value  = model.cardno;
            parameters[8].Value  = model.cardpass;
            parameters[9].Value  = model.suppTransNo;
            parameters[10].Value = model.responseText;
            parameters[11].Value = model.errCode;
            parameters[12].Value = model.errMsg;
            parameters[13].Value = model.initTime;
            parameters[14].Value = model.message;
            parameters[15].Value = model.completeTime;

            DbHelperSQL.RunProcedure("proc_ordercardsend_Update", parameters, out rowsAffected);
            if (rowsAffected > 0)
            {
                return(true);
            }
            return(false);
        }
Beispiel #4
0
        /// <summary>
        ///     得到一个对象实体
        /// </summary>
        public Model.Order.OrderCardSend GetModel(int id)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            return(null);
        }
Beispiel #5
0
        /// <summary>
        ///     得到一个对象实体
        /// </summary>
        public Model.Order.OrderCardSend DataRowToModel(DataRow row)
        {
            var model = new Model.Order.OrderCardSend();

            if (row != null)
            {
                if (row["id"] != null && row["id"].ToString() != "")
                {
                    model.id = int.Parse(row["id"].ToString());
                }
                if (row["orderid"] != null)
                {
                    model.orderid = row["orderid"].ToString();
                }
                if (row["source"] != null && row["source"].ToString() != "")
                {
                    model.source = byte.Parse(row["source"].ToString());
                }
                if (row["suppId"] != null && row["suppId"].ToString() != "")
                {
                    model.suppId = int.Parse(row["suppId"].ToString());
                }
                if (row["success"] != null && row["success"].ToString() != "")
                {
                    model.success = int.Parse(row["success"].ToString());
                }
                if (row["summitStatus"] != null && row["summitStatus"].ToString() != "")
                {
                    model.summitStatus = int.Parse(row["summitStatus"].ToString());
                }
                if (row["orderStatus"] != null && row["orderStatus"].ToString() != "")
                {
                    model.orderStatus = int.Parse(row["orderStatus"].ToString());
                }
                if (row["cardno"] != null)
                {
                    model.cardno = row["cardno"].ToString();
                }
                if (row["cardpass"] != null)
                {
                    model.cardpass = row["cardpass"].ToString();
                }
                if (row["suppTransNo"] != null)
                {
                    model.suppTransNo = row["suppTransNo"].ToString();
                }
                if (row["responseText"] != null)
                {
                    model.responseText = row["responseText"].ToString();
                }
                if (row["errCode"] != null)
                {
                    model.errCode = row["errCode"].ToString();
                }
                if (row["errMsg"] != null)
                {
                    model.errMsg = row["errMsg"].ToString();
                }
                if (row["initTime"] != null && row["initTime"].ToString() != "")
                {
                    model.initTime = DateTime.Parse(row["initTime"].ToString());
                }
                if (row["message"] != null)
                {
                    model.message = row["message"].ToString();
                }
                if (row["completeTime"] != null && row["completeTime"].ToString() != "")
                {
                    model.completeTime = DateTime.Parse(row["completeTime"].ToString());
                }
            }
            return(model);
        }
Beispiel #6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.Order.OrderCardSend model)
 {
     return(dal.Update(model));
 }