示例#1
0
 /// <summary>
 /// 由一行数据得到一个实体
 /// </summary>
 private Hi.Model.PAY_Financing GetModel(DataRow r)
 {
     Hi.Model.PAY_Financing model = new Hi.Model.PAY_Financing();
     model.ID         = SqlHelper.GetInt(r["ID"]);
     model.DisID      = SqlHelper.GetInt(r["DisID"]);
     model.CompID     = SqlHelper.GetInt(r["CompID"]);
     model.State      = SqlHelper.GetInt(r["State"]);
     model.OpenAccID  = SqlHelper.GetInt(r["OpenAccID"]);
     model.OrderID    = SqlHelper.GetInt(r["OrderID"]);
     model.AclAmt     = SqlHelper.GetDecimal(r["AclAmt"]);
     model.Guid       = SqlHelper.GetString(r["Guid"]);
     model.Type       = SqlHelper.GetInt(r["Type"]);
     model.RspCode    = SqlHelper.GetString(r["RspCode"]);
     model.RspMsg     = SqlHelper.GetString(r["RspMsg"]);
     model.ReqXml     = SqlHelper.GetString(r["ReqXml"]);
     model.CcyCd      = SqlHelper.GetString(r["CcyCd"]);
     model.vdef1      = SqlHelper.GetString(r["vdef1"]);
     model.vdef2      = SqlHelper.GetString(r["vdef2"]);
     model.vdef3      = SqlHelper.GetString(r["vdef3"]);
     model.ts         = SqlHelper.GetDateTime(r["ts"]);
     model.dr         = SqlHelper.GetInt(r["dr"]);
     model.modifyuser = SqlHelper.GetInt(r["modifyuser"]);
     return(model);
 }
示例#2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Hi.Model.PAY_Financing model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into [PAY_Financing](");
            strSql.Append("[DisID],[CompID],[State],[OpenAccID],[OrderID],[AclAmt],[Guid],[Type],[RspCode],[RspMsg],[ReqXml],[vdef1],[vdef2],[vdef3],[ts],[dr],[modifyuser])");
            strSql.Append(" values (");
            strSql.Append("@DisID,@CompID,@State,@OpenAccID,@OrderID,@AclAmt,@Guid,@Type,@RspCode,@RspMsg,@ReqXml,@vdef1,@vdef2,@vdef3,@ts,@dr,@modifyuser)");
            strSql.Append(";select @@Identity");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DisID",      SqlDbType.Int),
                new SqlParameter("@CompID",     SqlDbType.Int),
                new SqlParameter("@State",      SqlDbType.Int),
                new SqlParameter("@OpenAccID",  SqlDbType.BigInt),
                new SqlParameter("@OrderID",    SqlDbType.BigInt),
                new SqlParameter("@AclAmt",     SqlDbType.Decimal),
                new SqlParameter("@Guid",       SqlDbType.NVarChar,   50),
                new SqlParameter("@Type",       SqlDbType.Int),
                new SqlParameter("@RspCode",    SqlDbType.NVarChar,   50),
                new SqlParameter("@RspMsg",     SqlDbType.NVarChar,  200),
                new SqlParameter("@ReqXml",     SqlDbType.NVarChar,  500),
                new SqlParameter("@vdef1",      SqlDbType.NVarChar,   50),
                new SqlParameter("@vdef2",      SqlDbType.NVarChar,   50),
                new SqlParameter("@vdef3",      SqlDbType.NVarChar,   50),
                new SqlParameter("@ts",         SqlDbType.DateTime),
                new SqlParameter("@dr",         SqlDbType.SmallInt),
                new SqlParameter("@modifyuser", SqlDbType.Int)
            };
            parameters[0].Value = model.DisID;
            parameters[1].Value = model.CompID;
            parameters[2].Value = model.State;
            parameters[3].Value = model.OpenAccID;
            parameters[4].Value = model.OrderID;
            parameters[5].Value = model.AclAmt;
            parameters[6].Value = model.Guid;
            parameters[7].Value = model.Type;

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


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


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


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


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


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

            parameters[14].Value = model.ts;
            parameters[15].Value = model.dr;
            parameters[16].Value = model.modifyuser;
            return(SqlHelper.GetInt(SqlHelper.GetSingle(SqlHelper.LocalSqlServer, strSql.ToString(), parameters)));
        }
示例#3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Hi.Model.PAY_Financing model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update [PAY_Financing] set ");
            strSql.Append("[DisID]=@DisID,");
            strSql.Append("[CompID]=@CompID,");
            strSql.Append("[State]=@State,");
            strSql.Append("[OpenAccID]=@OpenAccID,");
            strSql.Append("[OrderID]=@OrderID,");
            strSql.Append("[AclAmt]=@AclAmt,");
            strSql.Append("[Guid]=@Guid,");
            strSql.Append("[Type]=@Type,");
            strSql.Append("[RspCode]=@RspCode,");
            strSql.Append("[RspMsg]=@RspMsg,");
            strSql.Append("[ReqXml]=@ReqXml,");
            strSql.Append("[CcyCd]=@CcyCd,");
            strSql.Append("[vdef1]=@vdef1,");
            strSql.Append("[vdef2]=@vdef2,");
            strSql.Append("[vdef3]=@vdef3,");
            strSql.Append("[ts]=@ts,");
            strSql.Append("[dr]=@dr,");
            strSql.Append("[modifyuser]=@modifyuser");
            strSql.Append(" where [ID]=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",         SqlDbType.BigInt),
                new SqlParameter("@DisID",      SqlDbType.Int),
                new SqlParameter("@CompID",     SqlDbType.Int),
                new SqlParameter("@State",      SqlDbType.Int),
                new SqlParameter("@OpenAccID",  SqlDbType.BigInt),
                new SqlParameter("@OrderID",    SqlDbType.BigInt),
                new SqlParameter("@AclAmt",     SqlDbType.Decimal),
                new SqlParameter("@Guid",       SqlDbType.NVarChar,   50),
                new SqlParameter("@Type",       SqlDbType.Int),
                new SqlParameter("@RspCode",    SqlDbType.NVarChar,   50),
                new SqlParameter("@RspMsg",     SqlDbType.NVarChar,  200),
                new SqlParameter("@ReqXml",     SqlDbType.NVarChar,  500),
                new SqlParameter("@CcyCd",      SqlDbType.NVarChar,   20),
                new SqlParameter("@vdef1",      SqlDbType.NVarChar,   50),
                new SqlParameter("@vdef2",      SqlDbType.NVarChar,   50),
                new SqlParameter("@vdef3",      SqlDbType.NVarChar,   50),
                new SqlParameter("@ts",         SqlDbType.DateTime),
                new SqlParameter("@dr",         SqlDbType.SmallInt),
                new SqlParameter("@modifyuser", SqlDbType.Int)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.DisID;
            parameters[2].Value = model.CompID;
            parameters[3].Value = model.State;
            parameters[4].Value = model.OpenAccID;
            parameters[5].Value = model.OrderID;
            parameters[6].Value = model.AclAmt;
            parameters[7].Value = model.Guid;
            parameters[8].Value = model.Type;

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


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


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

            parameters[12].Value = model.CcyCd;

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


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


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

            parameters[16].Value = model.ts;
            parameters[17].Value = model.dr;
            parameters[18].Value = model.modifyuser;

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