private DisarmTimeOR SetValue() { DisarmTimeOR m_Disa = new DisarmTimeOR(); if (Request.QueryString["id"] != null) m_Disa.Disarmid =int.Parse(Request.QueryString["id"]); m_Disa.Disarmname = txtDisarmname.Text;//撤防名称 m_Disa.Disarmstarttime = txtDisarmstarttime.Text;//撤防开始时间 m_Disa.Disarmendtime = txtDisarmendtime.Text;//撤防结束时间 return m_Disa; }
/// <summary> /// 插入t_DisarmTime /// </summary> public virtual bool Insert(DisarmTimeOR disarmTime) { string sql = "insert into t_DisarmTime ( DisarmName, DisarmStartTime, DisarmEndTime) values (@DisarmName, @DisarmStartTime, @DisarmEndTime)"; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@DisarmName", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "DisarmName", DataRowVersion.Default, disarmTime.Disarmname), new SqlParameter("@DisarmStartTime", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "DisarmStartTime", DataRowVersion.Default, disarmTime.Disarmstarttime), new SqlParameter("@DisarmEndTime", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "DisarmEndTime", DataRowVersion.Default, disarmTime.Disarmendtime) }; return db.ExecuteNoQuery(sql, parameters) > -1; }
public DisarmTimeOR selectARowDate(string m_id) { string sql = string.Format("select * from t_DisarmTime where Disarmid='{0}'", m_id); DataTable dt = null; try { dt = db.ExecuteQueryDataSet(sql).Tables[0]; } catch (Exception ex) { throw ex; } if (dt == null) return null; if (dt.Rows.Count == 0) return null; DataRow dr = dt.Rows[0]; DisarmTimeOR m_Disa = new DisarmTimeOR(dr); return m_Disa; }
/// <summary> /// 更新t_DisarmTime /// </summary> public virtual bool Update(DisarmTimeOR disarmTime) { string sql = "update t_DisarmTime set DisarmName = @DisarmName, DisarmStartTime = @DisarmStartTime, DisarmEndTime = @DisarmEndTime where DisarmID = @DisarmID"; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@DisarmID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "DisarmID", DataRowVersion.Default, disarmTime.Disarmid), new SqlParameter("@DisarmName", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "DisarmName", DataRowVersion.Default, disarmTime.Disarmname), new SqlParameter("@DisarmStartTime", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "DisarmStartTime", DataRowVersion.Default, disarmTime.Disarmstarttime), new SqlParameter("@DisarmEndTime", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "DisarmEndTime", DataRowVersion.Default, disarmTime.Disarmendtime) }; return db.ExecuteNoQuery(sql, parameters) > -1; }