Esempio n. 1
0
 /// <summary>
 /// 由一行数据得到一个实体
 /// </summary>
 private Hi.Model.PAY_PaymentLog GetModel(DataRow r)
 {
     Hi.Model.PAY_PaymentLog model = new Hi.Model.PAY_PaymentLog();
     model.ID         = SqlHelper.GetInt(r["ID"]);
     model.OrderId    = SqlHelper.GetInt(r["OrderId"]);
     model.CompID     = SqlHelper.GetInt(r["CompID"]);
     model.OrgCode    = SqlHelper.GetString(r["OrgCode"]);
     model.MarkNumber = SqlHelper.GetString(r["MarkNumber"]);
     model.Price      = SqlHelper.GetDecimal(r["Price"]);
     model.PayorgCode = SqlHelper.GetString(r["PayorgCode"]);
     model.PayCode    = SqlHelper.GetString(r["PayCode"]);
     model.DisID      = SqlHelper.GetInt(r["DisID"]);
     model.PayTime    = SqlHelper.GetDateTime(r["PayTime"]);
     model.Remark     = SqlHelper.GetString(r["Remark"]);
     model.Start      = SqlHelper.GetString(r["Start"]);
     model.Message    = SqlHelper.GetString(r["Message"]);
     model.CreateUser = SqlHelper.GetInt(r["CreateUser"]);
     model.CreateDate = SqlHelper.GetDateTime(r["CreateDate"]);
     return(model);
 }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Hi.Model.PAY_PaymentLog model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into [PAY_PaymentLog](");
            strSql.Append("[OrderId],[CompID],[OrgCode],[MarkNumber],[Price],[PayorgCode],[PayCode],[DisID],[PayTime],[Remark],[Start],[Message],[CreateUser],[CreateDate])");
            strSql.Append(" values (");
            strSql.Append("@OrderId,@CompID,@OrgCode,@MarkNumber,@Price,@PayorgCode,@PayCode,@DisID,@PayTime,@Remark,@Start,@Message,@CreateUser,@CreateDate)");
            strSql.Append(";select @@Identity");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderId",    SqlDbType.BigInt),
                new SqlParameter("@CompID",     SqlDbType.Int),
                new SqlParameter("@OrgCode",    SqlDbType.NVarChar,   50),
                new SqlParameter("@MarkNumber", SqlDbType.NVarChar,   50),
                new SqlParameter("@Price",      SqlDbType.Decimal),
                new SqlParameter("@PayorgCode", SqlDbType.NVarChar,   50),
                new SqlParameter("@PayCode",    SqlDbType.NVarChar,   50),
                new SqlParameter("@DisID",      SqlDbType.Int),
                new SqlParameter("@PayTime",    SqlDbType.DateTime),
                new SqlParameter("@Remark",     SqlDbType.NVarChar,  200),
                new SqlParameter("@Start",      SqlDbType.NVarChar,   50),
                new SqlParameter("@Message",    SqlDbType.NVarChar,  200),
                new SqlParameter("@CreateUser", SqlDbType.Int),
                new SqlParameter("@CreateDate", SqlDbType.DateTime)
            };
            parameters[0].Value = model.OrderId;
            parameters[1].Value = model.CompID;

            if (model.OrgCode != null)
            {
                parameters[2].Value = model.OrgCode;
            }
            else
            {
                parameters[2].Value = DBNull.Value;
            }


            if (model.MarkNumber != null)
            {
                parameters[3].Value = model.MarkNumber;
            }
            else
            {
                parameters[3].Value = DBNull.Value;
            }

            parameters[4].Value = model.Price;

            if (model.PayorgCode != null)
            {
                parameters[5].Value = model.PayorgCode;
            }
            else
            {
                parameters[5].Value = DBNull.Value;
            }


            if (model.PayCode != null)
            {
                parameters[6].Value = model.PayCode;
            }
            else
            {
                parameters[6].Value = DBNull.Value;
            }

            parameters[7].Value = model.DisID;

            if (model.PayTime != DateTime.MinValue)
            {
                parameters[8].Value = model.PayTime;
            }
            else
            {
                parameters[8].Value = DBNull.Value;
            }


            if (model.Remark != null)
            {
                parameters[9].Value = model.Remark;
            }
            else
            {
                parameters[9].Value = DBNull.Value;
            }


            if (model.Start != null)
            {
                parameters[10].Value = model.Start;
            }
            else
            {
                parameters[10].Value = DBNull.Value;
            }


            if (model.Message != null)
            {
                parameters[11].Value = model.Message;
            }
            else
            {
                parameters[11].Value = DBNull.Value;
            }

            parameters[12].Value = model.CreateUser;

            if (model.CreateDate != DateTime.MinValue)
            {
                parameters[13].Value = model.CreateDate;
            }
            else
            {
                parameters[13].Value = DBNull.Value;
            }

            return(SqlHelper.GetInt(SqlHelper.GetSingle(SqlHelper.LocalSqlServer, strSql.ToString(), parameters)));
        }
Esempio n. 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Hi.Model.PAY_PaymentLog model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update [PAY_PaymentLog] set ");
            strSql.Append("[OrderId]=@OrderId,");
            strSql.Append("[CompID]=@CompID,");
            strSql.Append("[OrgCode]=@OrgCode,");
            strSql.Append("[MarkNumber]=@MarkNumber,");
            strSql.Append("[Price]=@Price,");
            strSql.Append("[PayorgCode]=@PayorgCode,");
            strSql.Append("[PayCode]=@PayCode,");
            strSql.Append("[DisID]=@DisID,");
            strSql.Append("[PayTime]=@PayTime,");
            strSql.Append("[Remark]=@Remark,");
            strSql.Append("[Start]=@Start,");
            strSql.Append("[Message]=@Message,");
            strSql.Append("[CreateUser]=@CreateUser,");
            strSql.Append("[CreateDate]=@CreateDate");
            strSql.Append(" where [ID]=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",         SqlDbType.BigInt),
                new SqlParameter("@OrderId",    SqlDbType.BigInt),
                new SqlParameter("@CompID",     SqlDbType.Int),
                new SqlParameter("@OrgCode",    SqlDbType.NVarChar,   50),
                new SqlParameter("@MarkNumber", SqlDbType.NVarChar,   50),
                new SqlParameter("@Price",      SqlDbType.Decimal),
                new SqlParameter("@PayorgCode", SqlDbType.NVarChar,   50),
                new SqlParameter("@PayCode",    SqlDbType.NVarChar,   50),
                new SqlParameter("@DisID",      SqlDbType.Int),
                new SqlParameter("@PayTime",    SqlDbType.DateTime),
                new SqlParameter("@Remark",     SqlDbType.NVarChar,  200),
                new SqlParameter("@Start",      SqlDbType.NVarChar,   50),
                new SqlParameter("@Message",    SqlDbType.NVarChar,  200),
                new SqlParameter("@CreateUser", SqlDbType.Int),
                new SqlParameter("@CreateDate", SqlDbType.DateTime)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.OrderId;
            parameters[2].Value = model.CompID;

            if (model.OrgCode != null)
            {
                parameters[3].Value = model.OrgCode;
            }
            else
            {
                parameters[3].Value = DBNull.Value;
            }


            if (model.MarkNumber != null)
            {
                parameters[4].Value = model.MarkNumber;
            }
            else
            {
                parameters[4].Value = DBNull.Value;
            }

            parameters[5].Value = model.Price;

            if (model.PayorgCode != null)
            {
                parameters[6].Value = model.PayorgCode;
            }
            else
            {
                parameters[6].Value = DBNull.Value;
            }


            if (model.PayCode != null)
            {
                parameters[7].Value = model.PayCode;
            }
            else
            {
                parameters[7].Value = DBNull.Value;
            }

            parameters[8].Value = model.DisID;

            if (model.PayTime != DateTime.MinValue)
            {
                parameters[9].Value = model.PayTime;
            }
            else
            {
                parameters[9].Value = DBNull.Value;
            }


            if (model.Remark != null)
            {
                parameters[10].Value = model.Remark;
            }
            else
            {
                parameters[10].Value = DBNull.Value;
            }


            if (model.Start != null)
            {
                parameters[11].Value = model.Start;
            }
            else
            {
                parameters[11].Value = DBNull.Value;
            }


            if (model.Message != null)
            {
                parameters[12].Value = model.Message;
            }
            else
            {
                parameters[12].Value = DBNull.Value;
            }

            parameters[13].Value = model.CreateUser;

            if (model.CreateDate != DateTime.MinValue)
            {
                parameters[14].Value = model.CreateDate;
            }
            else
            {
                parameters[14].Value = DBNull.Value;
            }


            return(SqlHelper.ExecuteSql(SqlHelper.LocalSqlServer, strSql.ToString(), parameters) > 0);
        }