Exemple #1
0
        public void load(FieldsVo field, int mainId, string filtro)
        {
            List <FieldsVo> fields = new List <FieldsVo>();

            fields.Add(field);

            load(fields, mainId, null);
        }
Exemple #2
0
 public int save(FieldsVo field)
 {
     if (field.ID == 0)
     {
         return(insert(field));
     }
     else
     {
         return(update(field));
     }
 }
Exemple #3
0
        public int update(FieldsVo field)
        {
            this.QUERY = new StringBuilder(fromDatabase);

            this.QUERY.AppendLine("UPDATE fields");
            this.QUERY.AppendLine("   SET mainId   =  " + field.MAINID);
            this.QUERY.AppendLine("     , codigo   = '" + field.CODIGO + "'");
            this.QUERY.AppendLine("     , grouping = '" + field.GROUPING + "'");
            this.QUERY.AppendLine(" WHERE id = " + field.ID);

            return(getData().DefaultView.Count);
        }
Exemple #4
0
        public int insert(FieldsVo field)
        {
            this.QUERY = new StringBuilder(fromDatabase);

            this.QUERY.Append("INSERT INTO fields");
            this.QUERY.AppendLine("(mainId, codigo, grouping)");

            this.QUERY.Append("VALUES(");
            this.QUERY.Append("" + field.MAINID + " ,");
            this.QUERY.Append("'" + field.CODIGO + "',");
            this.QUERY.Append("'" + field.GROUPING + "'");
            this.QUERY.AppendLine(")");

            return(getData().DefaultView.Count);
        }
Exemple #5
0
        public void load(List <FieldsVo> fields, int mainId, string filtro)
        {
            DataTable table = select(mainId, filtro, false);

            for (int i = 0; i < table.DefaultView.Count; i++)
            {
                FieldsVo field = new FieldsVo();
                field.MAINID   = mainId;
                field.ID       = (int   )table.DefaultView[i]["id"];
                field.CODIGO   = (string)table.DefaultView[i]["codigo"];
                field.GROUPING = (string)table.DefaultView[i]["grouping"];

                fields.Add(field);
            }
        }
Exemple #6
0
 public int delete(FieldsVo field)
 {
     return(delete(field.MAINID, "id = " + field.ID));
 }
Exemple #7
0
 // load unico
 public void load(FieldsVo field, int mainId)
 {
     load(field, mainId, null);
 }