/// <summary> /// 更新一条数据 /// </summary> public bool Update(M_borrowing_target_detailed model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update hx_borrowing_target_detailed set "); strSql.Append("borrower_registerid=@borrower_registerid,"); strSql.Append("targetid=@targetid,"); strSql.Append("item_details=@item_details,"); strSql.Append("borrower_circumstances=@borrower_circumstances,"); strSql.Append("use_funds=@use_funds,"); strSql.Append("independent_advice=@independent_advice,"); strSql.Append("guarantee_agency_views=@guarantee_agency_views,"); strSql.Append("risk_control_measures=@risk_control_measures"); strSql.Append(" where target_detailed_id=@target_detailed_id"); SqlParameter[] parameters = { new SqlParameter("@borrower_registerid", SqlDbType.Int, 4), new SqlParameter("@targetid", SqlDbType.Int, 4), new SqlParameter("@item_details", SqlDbType.VarChar, -1), new SqlParameter("@borrower_circumstances", SqlDbType.VarChar, -1), new SqlParameter("@use_funds", SqlDbType.VarChar, -1), new SqlParameter("@independent_advice", SqlDbType.VarChar, -1), new SqlParameter("@guarantee_agency_views", SqlDbType.VarChar, -1), new SqlParameter("@risk_control_measures", SqlDbType.VarChar, -1), new SqlParameter("@target_detailed_id", SqlDbType.Int, 4) }; parameters[0].Value = model.borrower_registerid; parameters[1].Value = model.targetid; parameters[2].Value = model.item_details; parameters[3].Value = model.borrower_circumstances; parameters[4].Value = model.use_funds; parameters[5].Value = model.independent_advice; parameters[6].Value = model.guarantee_agency_views; parameters[7].Value = model.risk_control_measures; parameters[8].Value = model.target_detailed_id; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public M_borrowing_target_detailed DataRowToModel(DataRow row) { M_borrowing_target_detailed model = new M_borrowing_target_detailed(); if (row != null) { if (row["target_detailed_id"] != null && row["target_detailed_id"].ToString() != "") { model.target_detailed_id = int.Parse(row["target_detailed_id"].ToString()); } if (row["borrower_registerid"] != null && row["borrower_registerid"].ToString() != "") { model.borrower_registerid = int.Parse(row["borrower_registerid"].ToString()); } if (row["targetid"] != null && row["targetid"].ToString() != "") { model.targetid = int.Parse(row["targetid"].ToString()); } if (row["item_details"] != null) { model.item_details = row["item_details"].ToString(); } if (row["borrower_circumstances"] != null) { model.borrower_circumstances = row["borrower_circumstances"].ToString(); } if (row["borrower_base_material"] != null) { model.borrower_base_material = row["borrower_base_material"].ToString(); } if (row["use_funds"] != null) { model.use_funds = row["use_funds"].ToString(); } if (row["independent_advice"] != null) { model.independent_advice = row["independent_advice"].ToString(); } if (row["guarantee_agency_views"] != null) { model.guarantee_agency_views = row["guarantee_agency_views"].ToString(); } if (row["risk_control_measures"] != null) { model.risk_control_measures = row["risk_control_measures"].ToString(); } if (row["createtime"] != null && row["createtime"].ToString() != "") { model.createtime = DateTime.Parse(row["createtime"].ToString()); } } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(M_borrowing_target_detailed model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into hx_borrowing_target_detailed("); strSql.Append("borrower_registerid,targetid,item_details,borrower_circumstances,borrower_base_material,use_funds,independent_advice,guarantee_agency_views,risk_control_measures,createtime)"); strSql.Append(" values ("); strSql.Append("@borrower_registerid,@targetid,@item_details,@borrower_circumstances,@borrower_base_material,@use_funds,@independent_advice,@guarantee_agency_views,@risk_control_measures,@createtime)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@borrower_registerid", SqlDbType.Int, 4), new SqlParameter("@targetid", SqlDbType.Int, 4), new SqlParameter("@item_details", SqlDbType.VarChar, -1), new SqlParameter("@borrower_circumstances", SqlDbType.VarChar, -1), new SqlParameter("@borrower_base_material", SqlDbType.VarChar, -1), new SqlParameter("@use_funds", SqlDbType.VarChar, -1), new SqlParameter("@independent_advice", SqlDbType.VarChar, -1), new SqlParameter("@guarantee_agency_views", SqlDbType.VarChar, -1), new SqlParameter("@risk_control_measures", SqlDbType.VarChar, -1), new SqlParameter("@createtime", SqlDbType.DateTime) }; parameters[0].Value = model.borrower_registerid; parameters[1].Value = model.targetid; parameters[2].Value = model.item_details; parameters[3].Value = model.borrower_circumstances; parameters[4].Value = model.borrower_base_material; parameters[5].Value = model.use_funds; parameters[6].Value = model.independent_advice; parameters[7].Value = model.guarantee_agency_views; parameters[8].Value = model.risk_control_measures; parameters[9].Value = model.createtime; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public M_borrowing_target_detailed GetModelByTargetid(int targetid) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 target_detailed_id,borrower_registerid,targetid,item_details,borrower_circumstances,borrower_base_material,use_funds,independent_advice,guarantee_agency_views,risk_control_measures,createtime from hx_borrowing_target_detailed "); strSql.Append(" where targetid=@targetid"); SqlParameter[] parameters = { new SqlParameter("@targetid", SqlDbType.Int, 4) }; parameters[0].Value = targetid; M_borrowing_target_detailed model = new M_borrowing_target_detailed(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(M_borrowing_target_detailed model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(M_borrowing_target_detailed model) { return(dal.Add(model)); }