Exemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mofang.Model.OrderCancle GetModel(int OrderCancleID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select OrderCancleID, RecordIsDelete, RecordUpdateTime, RecordCreateTime, InsureNum, RespCode, TransNo, RespMsg, OrderApplyID, OrderRebateId, CreatUserID, RecordUpdateUserID  ");
            strSql.Append("  from dbo.[OrderCancle] ");
            strSql.Append(" where OrderCancleID=@OrderCancleID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderCancleID", SqlDbType.Int, 4)
            };
            parameters[0].Value = OrderCancleID;


            Mofang.Model.OrderCancle model = new Mofang.Model.OrderCancle();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// datarow转成对象实体
        /// </summary>
        public Mofang.Model.OrderCancle DataRowToModel(DataRow row)
        {
            Mofang.Model.OrderCancle model = new Mofang.Model.OrderCancle();

            if (row != null)
            {
                if (row["OrderCancleID"].ToString() != "")
                {
                    model.OrderCancleID = int.Parse(row["OrderCancleID"].ToString());
                }
                if (row["RecordIsDelete"].ToString() != "")
                {
                    if ((row["RecordIsDelete"].ToString() == "1") || (row["RecordIsDelete"].ToString().ToLower() == "true"))
                    {
                        model.RecordIsDelete = true;
                    }
                    else
                    {
                        model.RecordIsDelete = false;
                    }
                }
                if (row["RecordUpdateTime"].ToString() != "")
                {
                    model.RecordUpdateTime = DateTime.Parse(row["RecordUpdateTime"].ToString());
                }
                if (row["RecordCreateTime"].ToString() != "")
                {
                    model.RecordCreateTime = DateTime.Parse(row["RecordCreateTime"].ToString());
                }
                model.InsureNum = row["InsureNum"].ToString();
                model.RespCode  = row["RespCode"].ToString();
                model.TransNo   = row["TransNo"].ToString();
                model.RespMsg   = row["RespMsg"].ToString();
                if (row["OrderApplyID"].ToString() != "")
                {
                    model.OrderApplyID = int.Parse(row["OrderApplyID"].ToString());
                }
                if (row["OrderRebateId"].ToString() != "")
                {
                    model.OrderRebateId = int.Parse(row["OrderRebateId"].ToString());
                }
                if (row["CreatUserID"].ToString() != "")
                {
                    model.CreatUserID = int.Parse(row["CreatUserID"].ToString());
                }
                if (row["RecordUpdateUserID"].ToString() != "")
                {
                    model.RecordUpdateUserID = int.Parse(row["RecordUpdateUserID"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Mofang.Model.OrderCancle model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update dbo.[OrderCancle] set ");

            strSql.Append(" RecordIsDelete = @RecordIsDelete , ");
            strSql.Append(" RecordUpdateTime = @RecordUpdateTime , ");
            strSql.Append(" RecordCreateTime = @RecordCreateTime , ");
            strSql.Append(" InsureNum = @InsureNum , ");
            strSql.Append(" RespCode = @RespCode , ");
            strSql.Append(" TransNo = @TransNo , ");
            strSql.Append(" RespMsg = @RespMsg , ");
            strSql.Append(" OrderApplyID = @OrderApplyID , ");
            strSql.Append(" OrderRebateId = @OrderRebateId , ");
            strSql.Append(" CreatUserID = @CreatUserID , ");
            strSql.Append(" RecordUpdateUserID = @RecordUpdateUserID  ");
            strSql.Append(" where OrderCancleID=@OrderCancleID ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderCancleID",      model.OrderCancleID),
                new SqlParameter("@RecordIsDelete",     model.RecordIsDelete),
                new SqlParameter("@RecordUpdateTime",   model.RecordUpdateTime),
                new SqlParameter("@RecordCreateTime",   model.RecordCreateTime),
                new SqlParameter("@InsureNum",          model.InsureNum),
                new SqlParameter("@RespCode",           model.RespCode),
                new SqlParameter("@TransNo",            model.TransNo),
                new SqlParameter("@RespMsg",            model.RespMsg),
                new SqlParameter("@OrderApplyID",       model.OrderApplyID),
                new SqlParameter("@OrderRebateId",      model.OrderRebateId),
                new SqlParameter("@CreatUserID",        model.CreatUserID),
                new SqlParameter("@RecordUpdateUserID", model.RecordUpdateUserID)
            };

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Mofang.Model.OrderCancle model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into dbo.[OrderCancle](");
            strSql.Append("RecordIsDelete,RecordUpdateTime,RecordCreateTime,InsureNum,RespCode,TransNo,RespMsg,OrderApplyID,OrderRebateId,CreatUserID,RecordUpdateUserID");
            strSql.Append(") values (");
            strSql.Append("@RecordIsDelete,@RecordUpdateTime,@RecordCreateTime,@InsureNum,@RespCode,@TransNo,@RespMsg,@OrderApplyID,@OrderRebateId,@CreatUserID,@RecordUpdateUserID");
            strSql.Append(") ");
            strSql.Append(";select SCOPE_IDENTITY()");
            SqlParameter[] parameters =
            {
                new SqlParameter("@RecordIsDelete",     model.RecordIsDelete),
                new SqlParameter("@RecordUpdateTime",   model.RecordUpdateTime),
                new SqlParameter("@RecordCreateTime",   model.RecordCreateTime),
                new SqlParameter("@InsureNum",          model.InsureNum),
                new SqlParameter("@RespCode",           model.RespCode),
                new SqlParameter("@TransNo",            model.TransNo),
                new SqlParameter("@RespMsg",            model.RespMsg),
                new SqlParameter("@OrderApplyID",       model.OrderApplyID),
                new SqlParameter("@OrderRebateId",      model.OrderRebateId),
                new SqlParameter("@CreatUserID",        model.CreatUserID),
                new SqlParameter("@RecordUpdateUserID", model.RecordUpdateUserID)
            };


            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Mofang.Model.OrderCancle model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Mofang.Model.OrderCancle model)
 {
     return(dal.Add(model));
 }