Пример #1
0
        public void Load(FiltersVo filter, int mainId)
        {
            List <FiltersVo> filters = new List <FiltersVo>();

            filters.Add(filter);

            Load(filters, mainId, "id = " + filter.ID);
        }
Пример #2
0
        public int update(FiltersVo filter)
        {
            this.QUERY = new StringBuilder();

            this.addInQuery(fromDatabase);
            this.addInQuery("UPDATE filters");
            this.addInQuery("   SET tabela      = '" + filter.TABELA + "'");
            this.addInQuery("      ,campo       = '" + filter.CAMPO + "'");
            this.addInQuery("      ,filtro      = '" + filter.FILTRO + "'");
            this.addInQuery("      ,tipofiltro  = '" + filter.TIPOFILTRO + "'");
            this.addInQuery(" WHERE id = " + filter.ID);

            return(getData().DefaultView.Count);
        }
Пример #3
0
        public int save(FiltersVo filter)
        {
            int iRet = 0;

            if (filter.ID == 0)
            {
                iRet = insert(filter);
            }
            else
            {
                iRet = update(filter);
            }
            return(iRet);
        }
Пример #4
0
        public int insert(FiltersVo filter)
        {
            this.QUERY = new StringBuilder();

            this.addInQuery(fromDatabase);
            this.addInQuery("INSERT INTO filters (mainId, tabela, campo, filtro, tipofiltro)");
            this.QUERY.Append("VALUES (");
            this.QUERY.Append("" + filter.MAINID + ",");
            this.QUERY.Append("'" + filter.TABELA + "',");
            this.QUERY.Append("'" + filter.CAMPO + "',");
            this.QUERY.Append("'" + filter.FILTRO + "',");
            this.QUERY.Append("'" + filter.TIPOFILTRO + "'");
            this.addInQuery(")");

            return(getData().DefaultView.Count);
        }
Пример #5
0
        public void Load(List <FiltersVo> filters, int mainId, string filtro)
        {
            DataTable table = select(mainId, filtro, false);

            for (int i = 0; i < table.DefaultView.Count; i++)
            {
                FiltersVo filter = new FiltersVo();
                filter.MAINID = mainId;

                filter.ID         = (int)table.DefaultView[i]["id"];
                filter.TABELA     = (string)table.DefaultView[i]["tabela"];
                filter.TIPOFILTRO = (string)table.DefaultView[i]["tipofiltro"];
                filter.FILTRO     = (string)table.DefaultView[i]["filtro"];
                filter.CAMPO      = (string)table.DefaultView[i]["campo"];

                filters.Add(filter);
            }
        }
Пример #6
0
 public int delete(FiltersVo filter)
 {
     return(delete(filter.MAINID, "id = " + filter.ID));
 }