Exemplo n.º 1
0
 public static bool sqlDelete(Atributo attr)
 {
     String sql = String.Format("DELETE FROM atributos WHERE idatributos = '{0}'"
                             , attr.Id
                             );
     return BD.getInstance().sqlEjecuta(sql);
 }
Exemplo n.º 2
0
 // ============= custom ============ //
 public static bool existsName(Atributo attr)
 {
     String sql = String.Format("SELECT * FROM atributos WHERE atributo = '{0}'", attr.Attr);
     DataTable dt = BD.getInstance().sqlSelect(sql);
     if (dt.Rows.Count == 0)
         return false;
     return true;
 }
Exemplo n.º 3
0
 public static bool sqlUpdate(Atributo attr)
 {
     String sql = String.Format("UPDATE atributos SET atributo = '{0}', textarea = '{1}' WHERE idatributos = '{2}'"
                                 , attr.Attr
                                 , attr.Textarea
                                 , attr.Id
                                 );
         return BD.getInstance().sqlEjecuta(sql);
 }
Exemplo n.º 4
0
        public static bool sqlLeer(Atributo attr)
        {
            String sql = String.Format("SELECT * FROM atributos WHERE idatributos = '{0}'"
                                       , attr.Id);
            DataTable dt = BD.getInstance().sqlSelect(sql);
            if (dt.Rows.Count == 0)
                return false;

            attr.Attr = dt.Rows[0]["atributo"].ToString();
            attr.Textarea = int.Parse(dt.Rows[0]["textarea"].ToString());
            return true;
        }
Exemplo n.º 5
0
 public static Boolean sqlInsert(Atributo attr)
 {
     if (!existsName(attr))
     {
         String sql = String.Format("INSERT INTO atributos (atributo, textarea) VALUES ('{0}', '{1}')"
                                 , attr.Attr
                                 , attr.Textarea
                                 );
         return BD.getInstance().sqlEjecuta(sql);
     }
     return false;
 }