/// <summary> /// 得到一个对象实体 /// </summary> public Tunnel.Model.Tunnel_kaosetting GetModel(long k_id) { SqlParameter[] parameters = { new SqlParameter("@k_id", SqlDbType.BigInt) }; parameters[0].Value = k_id; Tunnel.Model.Tunnel_kaosetting model = new Tunnel.Model.Tunnel_kaosetting(); DataSet ds = DbHelperSQL.RunProcedure("Tunnel_kaosetting_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["k_id"].ToString() != "") { model.k_id = long.Parse(ds.Tables[0].Rows[0]["k_id"].ToString()); } model.k_amtime = ds.Tables[0].Rows[0]["k_amtime"].ToString(); model.k_pmtime = ds.Tables[0].Rows[0]["k_pmtime"].ToString(); model.k_xiu = ds.Tables[0].Rows[0]["k_xiu"].ToString(); model.k_am2time = ds.Tables[0].Rows[0]["k_am2time"].ToString(); model.k_pm2time = ds.Tables[0].Rows[0]["k_pm2time"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Tunnel.Model.Tunnel_kaosetting model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@k_id", SqlDbType.BigInt, 8), new SqlParameter("@k_amtime", SqlDbType.VarChar, 20), new SqlParameter("@k_pmtime", SqlDbType.VarChar, 20), new SqlParameter("@k_xiu", SqlDbType.VarChar, 20), new SqlParameter("@k_am2time", SqlDbType.VarChar, 20), new SqlParameter("@k_pm2time", SqlDbType.VarChar, 20) }; parameters[0].Value = model.k_id; parameters[1].Value = model.k_amtime; parameters[2].Value = model.k_pmtime; parameters[3].Value = model.k_xiu; parameters[4].Value = model.k_am2time; parameters[5].Value = model.k_pm2time; DbHelperSQL.RunProcedure("Tunnel_kaosetting_Update", parameters, out rowsAffected); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Tunnel.Model.Tunnel_kaosetting model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@k_id", SqlDbType.BigInt, 8), new SqlParameter("@k_amtime", SqlDbType.VarChar, 20), new SqlParameter("@k_pmtime", SqlDbType.VarChar, 20), new SqlParameter("@k_xiu", SqlDbType.VarChar, 20), new SqlParameter("@k_am2time", SqlDbType.VarChar, 20), new SqlParameter("@k_pm2time", SqlDbType.VarChar, 20) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.k_amtime; parameters[2].Value = model.k_pmtime; parameters[3].Value = model.k_xiu; parameters[4].Value = model.k_am2time; parameters[5].Value = model.k_pm2time; DbHelperSQL.RunProcedure("Tunnel_kaosetting_ADD", parameters, out rowsAffected); return((int)parameters[0].Value); }