/// <summary> /// 增加一条数据 /// </summary> public int Add(Tunnel.Model.Tunnel_exam model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@e_id", SqlDbType.BigInt, 8), new SqlParameter("@e_gid", SqlDbType.Int, 4), new SqlParameter("@e_bid", SqlDbType.Int, 4), new SqlParameter("@e_time", SqlDbType.DateTime), new SqlParameter("@e_user", SqlDbType.Int, 4), new SqlParameter("@e_endtime", SqlDbType.DateTime), new SqlParameter("@e_nextbuser", SqlDbType.VarChar, 500), new SqlParameter("@e_nextbid", SqlDbType.BigInt, 8) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.e_gid; parameters[2].Value = model.e_bid; parameters[3].Value = model.e_time; parameters[4].Value = model.e_user; parameters[5].Value = model.e_endtime; parameters[6].Value = model.e_nextbuser; parameters[7].Value = model.e_nextbid; DbHelperSQL.RunProcedure("UP_Tunnel_exam_ADD", parameters, out rowsAffected); return(Convert.ToInt32(parameters[0].Value)); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Tunnel.Model.Tunnel_exam model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@e_id", SqlDbType.BigInt, 8), new SqlParameter("@e_gid", SqlDbType.Int, 4), new SqlParameter("@e_bid", SqlDbType.Int, 4), new SqlParameter("@e_time", SqlDbType.DateTime), new SqlParameter("@e_user", SqlDbType.Int, 4), new SqlParameter("@e_endtime", SqlDbType.DateTime), new SqlParameter("@e_nextbuser", SqlDbType.VarChar, 500), new SqlParameter("@e_nextbid", SqlDbType.BigInt, 8) }; parameters[0].Value = model.e_id; parameters[1].Value = model.e_gid; parameters[2].Value = model.e_bid; parameters[3].Value = model.e_time; parameters[4].Value = model.e_user; parameters[5].Value = model.e_endtime; parameters[6].Value = model.e_nextbuser; parameters[7].Value = model.e_nextbid; DbHelperSQL.RunProcedure("UP_Tunnel_exam_Update", parameters, out rowsAffected); }
/// <summary> /// 得到一个对象实体 /// </summary> public Tunnel.Model.Tunnel_exam GetModel(long e_id) { SqlParameter[] parameters = { new SqlParameter("@e_id", SqlDbType.BigInt) }; parameters[0].Value = e_id; Tunnel.Model.Tunnel_exam model = new Tunnel.Model.Tunnel_exam(); DataSet ds = DbHelperSQL.RunProcedure("UP_Tunnel_exam_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["e_id"].ToString() != "") { model.e_id = long.Parse(ds.Tables[0].Rows[0]["e_id"].ToString()); } if (ds.Tables[0].Rows[0]["e_gid"].ToString() != "") { model.e_gid = int.Parse(ds.Tables[0].Rows[0]["e_gid"].ToString()); } if (ds.Tables[0].Rows[0]["e_bid"].ToString() != "") { model.e_bid = int.Parse(ds.Tables[0].Rows[0]["e_bid"].ToString()); } if (ds.Tables[0].Rows[0]["e_time"].ToString() != "") { model.e_time = DateTime.Parse(ds.Tables[0].Rows[0]["e_time"].ToString()); } if (ds.Tables[0].Rows[0]["e_user"].ToString() != "") { model.e_user = int.Parse(ds.Tables[0].Rows[0]["e_user"].ToString()); } if (ds.Tables[0].Rows[0]["e_endtime"].ToString() != "") { model.e_endtime = DateTime.Parse(ds.Tables[0].Rows[0]["e_endtime"].ToString()); } if (ds.Tables[0].Rows[0]["e_nextbid"].ToString() != "") { model.e_nextbid = long.Parse(ds.Tables[0].Rows[0]["e_nextbid"].ToString()); } model.e_nextbuser = ds.Tables[0].Rows[0]["e_nextbuser"].ToString(); return(model); } else { return(null); } }