Exemplo n.º 1
0
 public static int AddNameFilter(string name)
 {
     NameFilterInfo namefilter = new NameFilterInfo();
     namefilter.Name = name;
     INameFilter dal = Factory<INameFilter>.Create("NameFilter");
     return dal.Add(namefilter);
 }
Exemplo n.º 2
0
 public void Update(NameFilterInfo filter)
 {
     string strSql = "UPDATE " + Config.FilterTablePrefix + "NAMEFILTER SET M_NAME=@Name WHERE N_ID=@Id";
     List<OleDbParameter> parms = new List<OleDbParameter>
     {
         new OleDbParameter("@Id", OleDbType.Numeric) {Value = filter.Id},
         new OleDbParameter("@NAme", OleDbType.VarChar) {Value = filter.Name}
     };
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, parms.ToArray());
 }
Exemplo n.º 3
0
 public NameFilterInfo GetById(int id)
 {
     string strSql = "SELECT N_ID,N_NAME FROM " + Config.FilterTablePrefix + "NAMEFILTER WHERE N_ID=@Id";
     NameFilterInfo filter = null;
     using (OleDbDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnString, CommandType.Text, strSql, new OleDbParameter("@Id", OleDbType.Numeric) { Value = id }))
     {
         while (rdr.Read())
         {
             filter = new NameFilterInfo
             {
                 Id = rdr.GetInt32(0),
                 Name = rdr.SafeGetString(1)
             };
         }
     }
     return filter;
 }
Exemplo n.º 4
0
 public void Delete(NameFilterInfo filter)
 {
     string strSql = "DELETE FROM " + Config.FilterTablePrefix + "NAMEFILTER WHERE N_ID=@Id";
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, new OleDbParameter("@Id", OleDbType.VarChar) { Value = filter.Id });
 }
Exemplo n.º 5
0
 public int Add(NameFilterInfo filter)
 {
     string strSql = "INSERT INTO " + Config.FilterTablePrefix + "NAMEFILTER (N_NAME) VALUES (@Name)";
     return Convert.ToInt32(SqlHelper.ExecuteInsertQuery(SqlHelper.ConnString, CommandType.Text, strSql, new OleDbParameter("@Name", OleDbType.VarChar) { Value = filter.Name }));
 }