/// <summary> /// 得到一个对象实体 /// </summary> public BWJS.Model.NL_AssetInfo GetModel(int ConsultId) { StringBuilder strSql = new StringBuilder(); strSql.Append("select ConsultId, Cars, Houses, OtherLoans, SesameSeed, TaobaoAccount, ParticleLoan, BusinessPolicy, CreditCard, CreditSituation, CreditCardServiceLife "); strSql.Append(" from dbo.[NL_AssetInfo] "); strSql.Append(" where ConsultId=@ConsultId "); SqlParameter[] parameters = { new SqlParameter("@ConsultId", SqlDbType.Int, 4) }; parameters[0].Value = ConsultId; BWJS.Model.NL_AssetInfo model = new BWJS.Model.NL_AssetInfo(); DataSet ds = BWJSHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// datarow转成对象实体 /// </summary> public BWJS.Model.NL_AssetInfo DataRowToModel(DataRow row) { BWJS.Model.NL_AssetInfo model = new BWJS.Model.NL_AssetInfo(); if (row != null) { if (row["ConsultId"].ToString() != "") { model.ConsultId = int.Parse(row["ConsultId"].ToString()); } if (row["Cars"].ToString() != "") { model.Cars = int.Parse(row["Cars"].ToString()); } if (row["Houses"].ToString() != "") { model.Houses = int.Parse(row["Houses"].ToString()); } if (row["OtherLoans"].ToString() != "") { model.OtherLoans = int.Parse(row["OtherLoans"].ToString()); } if (row["SesameSeed"].ToString() != "") { model.SesameSeed = int.Parse(row["SesameSeed"].ToString()); } if (row["TaobaoAccount"].ToString() != "") { model.TaobaoAccount = int.Parse(row["TaobaoAccount"].ToString()); } if (row["ParticleLoan"].ToString() != "") { model.ParticleLoan = int.Parse(row["ParticleLoan"].ToString()); } if (row["BusinessPolicy"].ToString() != "") { model.BusinessPolicy = int.Parse(row["BusinessPolicy"].ToString()); } if (row["CreditCard"].ToString() != "") { model.CreditCard = int.Parse(row["CreditCard"].ToString()); } if (row["CreditSituation"].ToString() != "") { model.CreditSituation = int.Parse(row["CreditSituation"].ToString()); } if (row["CreditCardServiceLife"].ToString() != "") { model.CreditCardServiceLife = int.Parse(row["CreditCardServiceLife"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(BWJS.Model.NL_AssetInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update dbo.[NL_AssetInfo] set "); strSql.Append(" ConsultId=@ConsultId , "); strSql.Append(" Cars=@Cars , "); strSql.Append(" Houses=@Houses , "); strSql.Append(" OtherLoans=@OtherLoans , "); strSql.Append(" SesameSeed=@SesameSeed , "); strSql.Append(" TaobaoAccount=@TaobaoAccount , "); strSql.Append(" ParticleLoan=@ParticleLoan , "); strSql.Append(" BusinessPolicy=@BusinessPolicy , "); strSql.Append(" CreditCard=@CreditCard , "); strSql.Append(" CreditSituation=@CreditSituation , "); strSql.Append(" CreditCardServiceLife=@CreditCardServiceLife "); strSql.Append(" where ConsultId=@ConsultId "); SqlParameter[] parameters = { new SqlParameter("@ConsultId", model.ConsultId), new SqlParameter("@Cars", model.Cars), new SqlParameter("@Houses", model.Houses), new SqlParameter("@OtherLoans", model.OtherLoans), new SqlParameter("@SesameSeed", model.SesameSeed), new SqlParameter("@TaobaoAccount", model.TaobaoAccount), new SqlParameter("@ParticleLoan", model.ParticleLoan), new SqlParameter("@BusinessPolicy", model.BusinessPolicy), new SqlParameter("@CreditCard", model.CreditCard), new SqlParameter("@CreditSituation", model.CreditSituation), new SqlParameter("@CreditCardServiceLife", model.CreditCardServiceLife) }; int rows = BWJSHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(BWJS.Model.NL_AssetInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into dbo.[NL_AssetInfo]("); strSql.Append("ConsultId,Cars,Houses,OtherLoans,SesameSeed,TaobaoAccount,ParticleLoan,BusinessPolicy,CreditCard,CreditSituation,CreditCardServiceLife"); strSql.Append(") values ("); strSql.Append("@ConsultId,@Cars,@Houses,@OtherLoans,@SesameSeed,@TaobaoAccount,@ParticleLoan,@BusinessPolicy,@CreditCard,@CreditSituation,@CreditCardServiceLife"); strSql.Append(") "); strSql.Append(";select SCOPE_IDENTITY()"); SqlParameter[] parameters = { new SqlParameter("@ConsultId", model.ConsultId), new SqlParameter("@Cars", model.Cars), new SqlParameter("@Houses", model.Houses), new SqlParameter("@OtherLoans", model.OtherLoans), new SqlParameter("@SesameSeed", model.SesameSeed), new SqlParameter("@TaobaoAccount", model.TaobaoAccount), new SqlParameter("@ParticleLoan", model.ParticleLoan), new SqlParameter("@BusinessPolicy", model.BusinessPolicy), new SqlParameter("@CreditCard", model.CreditCard), new SqlParameter("@CreditSituation", model.CreditSituation), new SqlParameter("@CreditCardServiceLife", model.CreditCardServiceLife) }; object obj = BWJSHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(BWJS.Model.NL_AssetInfo model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(BWJS.Model.NL_AssetInfo model) { return(dal.Add(model)); }