public void buildFilterFilter(DBFilter filter) { foreach (DBTerm t in terms) { filter.add(t); } foreach (DBTerm t in filterTerms) { filter.add(t); } foreach (SearchBinder binder in binders) { binder.buildFilterFilter(filter); } }
public ArrayList Select(DBFilter filter, DBManager db) { DateTime startTime = DateTime.Now; IDbCommand command = CreateSelectCommand(db.selectSQLHeader, filter); ArrayList result = ExecuteToArrayList(command, db.fields, db.DBObjectType); // remove the makeClean() so that the update function will update all the field in db every time // if select() and update() is called continuously // e.g use force decrypt function //foreach (DBObject obj in result) // obj.makeClean(); return(result); }
public override bool buildFilter(DBFilter filter) { if (c.Value.Length > 0) { string v = c.Value; if (v.Equals(Common.EMPTY_STRING)) { v = ""; } filter.add(new Match(name, op, v.Trim())); return(true); } else { return(false); } }
public List <WFSelectValue> getValues(DatabaseConnection DBConn, DBFilter filter, CultureInfo ci) { List <WFSelectValue> list = new List <WFSelectValue>(); ResourceManager rm = DBUtils.getResourceManager(); for (int i = 0; i != values.Length; i++) { string s = rm.GetString(display[i], ci); if (s == null) { s = display[i]; } WFSelectValue sv = new WFSelectValue(values[i], s); list.Add(sv); } return(list); }
public bool createFilter(DBFilter f) { bool result = false; foreach (DBTerm t in terms) { f.add(t); } foreach (SearchBinder b in binders) { if (b.buildFilter(f)) { result = true; } } return(result); }
public override bool buildFilter(DBFilter filter) { string v = c.Value; v = v.Trim(); if (v.Equals("")) { OR or = new OR(); or.add(new Match(name, op, "")); or.add(new Match(name, op, null)); filter.add(or); } else { filter.add(new Match(name, op, v)); } return(true); }
public DbCommand CreateDeleteCommand(string DeleteQueryHeader, DBFilter dbFilter) { int commandIndex = 1; int buildSQLIndex = 1; string query = DeleteQueryHeader; DbCommand command = CreateCommand(); command.CommandType = CommandType.Text; if (dbFilter != null) { query += dbFilter.getWhereClause(this, false, buildSQLIndex, out buildSQLIndex); dbFilter.setParams(commandIndex, command); } command.CommandText = query; return(command); }
public IN(string searchFieldName, int[] ItemArray) { this.filter = null; this.selectQueryOrItemList = string.Empty; foreach (int i in ItemArray) { if (string.IsNullOrEmpty(selectQueryOrItemList)) { selectQueryOrItemList = i.ToString(); } else { // Start 0000111, Miranda, 2015-01-03 selectQueryOrItemList += ("," + i.ToString()); } } // End 0000111, Miranda, 2015-01-03 this.searchFieldName = searchFieldName; }
public override bool buildFilter(DBFilter filter) { if ((hasNotSelected && c.SelectedIndex > 0) || (!hasNotSelected && c.SelectedIndex >= 0)) { string column; column = fieldName; string s = c.SelectedValue; if (s.Equals(Common.EMPTY_STRING)) { return(false); } // object v=f.parseValue(s); filter.add(new Match(column, s)); return(true); } else { return(false); } }
public List <WFSelectValue> getValues(DatabaseConnection DBConn, DBFilter filter, CultureInfo ci) { if (terms.Count > 0) { if (filter == null) { filter = new DBFilter(); } foreach (DBTerm t in terms) { filter.add(t); } } if (!string.IsNullOrEmpty(sortField)) { if (filter == null) { filter = new DBFilter(); } filter.add(sortField, true); } IDbCommand command = DBConn.CreateSelectCommand("SELECT DISTINCT " + keyField + " K, " + nameField + " V," + sortField + " FROM " + tableName, filter); DataTable table = DBConn.ExecuteToDataTable(command); List <WFSelectValue> list = new List <WFSelectValue>(); foreach (DataRow row in table.Rows) { string name = row["V"].ToString().Trim(); string val = row["K"].ToString().Trim(); WFSelectValue sv = new WFSelectValue(val, name); list.Add(sv); } return(list); }
public DbCommand CreateSelectCommand(string SelectQueryWithoutConstraint, DBFilter dbFilter, ListInfo info) { int commandIndex = 1; int buildSQLIndex = 1; string query = SelectQueryWithoutConstraint; DbCommand command = CreateCommand(); command.CommandType = CommandType.Text; if (dbFilter != null) { query += dbFilter.getWhereClause(this, false, buildSQLIndex, out buildSQLIndex); query += dbFilter.getGroupCluase(); query += dbFilter.getOrderClause(info); dbFilter.setParams(commandIndex, command); } command.CommandText = query; return(command); }
public DropDownVLBinder(DBManager db, DropDownList c, WFValueList vl, DBFilter filter) : this(db, c, vl, filter, c.ID) { }
public ArrayList select(HROne.DataAccess.DatabaseConnection dbAccess, DBFilter filter) { return(dbAccess.Select(filter, this)); }
public bool delete(HROne.DataAccess.DatabaseConnection dbAccess, DBFilter filter) { return(dbAccess.Delete(filter, this)); }
public virtual bool updateByTemplate(HROne.DataAccess.DatabaseConnection dbAccess, DBObject obj, DBFilter filter) { bool result = dbAccess.UpdateByTemplate(obj, dbclass.tableName, fields, filter); return(result); }
public virtual void buildFilterFilter(DBFilter filter) { buildFilter(filter); }
public IN(string searchFieldName, string[] ItemArray) { this.filter = null; this.selectQueryOrItemList = "'" + string.Join("','", ItemArray) + "'"; this.searchFieldName = searchFieldName; }
public static void loadValues(DatabaseConnection DBConn, ListControl c, WFValueList vl, DBFilter filter) { loadValues(DBConn, c, vl, filter, null, null, "--"); }
public Exists(string tableName, DBFilter filter, bool notExist) : this("*", tableName, filter, notExist) { }
//public DbCommand CreateSelectCommand(string FieldList, string TableList, DBFilter dbFilter) //{ // string query = "SELECT " + FieldList + " FROM " + TableList; // return CreateSelectCommand(query, dbFilter, null); //} private DbCommand CreateUpdateCommand(string tablename, DBObject obj, ICollection <DBField> dbFieldList, DBFilter dbFilter) { int commandIndex = 1; int buildSQLIndex = 1; DbCommand command = CreateCommand(); command.CommandType = CommandType.Text; string updateField = string.Empty; foreach (DBField dbField in dbFieldList) { if (!dbField.isAuto) { if (obj.isModified(dbField.name)) { object value = dbField.property.GetValue(obj, null); if (value is string) { value = ((string)value).Trim(); } if (dbField.transcoder != null) { value = dbField.transcoder.toDB(value); } string fieldParameterName = getQueryValueParameterName(buildSQLIndex.ToString()); buildSQLIndex++; string valueParameterName = "@" + commandIndex++; string assignValue = dbField.columnName + " = " + fieldParameterName; if (updateField.Equals(string.Empty)) { updateField = " SET " + assignValue; } else { updateField += ", " + assignValue; } SetUpdateCommandDBParameter(command, valueParameterName, value); } } } if (!string.IsNullOrEmpty(updateField)) { string query = "UPDATE " + tablename + updateField; if (dbFilter != null) { query += dbFilter.getWhereClause(this, false, buildSQLIndex, out buildSQLIndex); dbFilter.setParams(commandIndex, command); } command.CommandText = query; return(command); } else { return(null); } }
public int count(HROne.DataAccess.DatabaseConnection dbAcces, DBFilter filter) { return(dbAcces.Count(filter, this)); }
public override bool updateByTemplate(DatabaseConnection dbAccess, DBObject obj, DBFilter filter) { if (obj is BaseObjectWithRecordInfo) { BaseObjectWithRecordInfo tmpObj = (BaseObjectWithRecordInfo)obj; tmpObj.RecordLastModifiedDateTime = AppUtils.ServerDateTime(); if (dbAccess is DatabaseConnectionWithAudit) { tmpObj.RecordLastModifiedBy = ((DatabaseConnectionWithAudit)dbAccess).UserID; } else { tmpObj.RecordLastModifiedBy = 0; } } return(base.updateByTemplate(dbAccess, obj, filter)); }
public DbCommand CreateSelectCommand(string SelectQueryWithoutConstraint, DBFilter dbFilter) { return(CreateSelectCommand(SelectQueryWithoutConstraint, dbFilter, null)); }
public bool UpdateByTemplate(DBObject templateObj, string table, ICollection <DBField> dbFieldList, DBFilter criteriaFilter) { DateTime startTime = DateTime.Now; IDbCommand command = CreateUpdateCommand(table, templateObj, dbFieldList, criteriaFilter); bool result = ExecuteNonQuery(command) > 0 ? true : false; return(result); }
public Exists(string tableName, DBFilter filter) : this("*", tableName, filter, false) { }
public static void loadValues(DatabaseConnection DBConn, ListControl c, WFValueList vl, DBFilter filter, CultureInfo ci, string selected, string notSelected) { //if (selected != null && selected.Equals(string.Empty)) // selected = Common.EMPTY_STRING; List <WFSelectValue> list = vl.getValues(DBConn, filter, ci); c.Items.Clear(); if (notSelected != null) { ResourceManager rm = DBUtils.getResourceManager(); string s = rm.GetString(notSelected, ci); if (s == null) { s = notSelected; } c.Items.Add(new ListItem(s, string.Empty)); } foreach (WFSelectValue sv in list) { string key = sv.key; //if (key.Equals("")) // key = Common.EMPTY_STRING; ListItem i = new ListItem(sv.name, key); if (selected != null && sv.key != null && sv.key.Equals(selected)) { i.Selected = true; } c.Items.Add(i); } if (selected != null) { ListItem item = c.Items.FindByValue(selected); if (item != null) { c.SelectedValue = item.Value; } } }
public Exists(string selectFieldList, string tableName, DBFilter filter) : this(selectFieldList, tableName, filter, false) { }
public IN(string searchFieldName, string selectQueryOrItemList, DBFilter filter) { this.filter = filter; this.selectQueryOrItemList = selectQueryOrItemList; this.searchFieldName = searchFieldName; }
public DropDownVLSearchBinder setFilter(DBFilter filter) { this.filter = filter; return(this); }
public abstract bool buildFilter(DBFilter filter);