public OpMessagesCollection GetMessageByTarget(string target_id, int LastMaxNumber) { OpMessagesCollection messagess = null; if (this.TryConnection()) { string sql = string.Concat(new object[] { "SELECT TOP ", LastMaxNumber, " * FROM ", this.DataStructrure.Views.OpMessage.ActualTableName, " WHERE ", this.DataStructrure.Tables.OpMessage.EngineerID.ActualFieldName, " = '", target_id, "'" }); DataTable table = base.CurDBEngine.SelectQuery(sql); if ((table == null) || (table.Rows.Count <= 0)) { return(messagess); } messagess = new OpMessagesCollection(); foreach (DataRow row in table.Rows) { messagess.Add(this.FillData(row)); } } return(messagess); }
public OpMessagesCollection GetMessageBySender(string sender_id) { OpMessagesCollection messagess = null; if (this.TryConnection()) { DatabaseParameters parameters = new DatabaseParameters(); parameters.Add(new DatabaseParameter(this.DataStructrure.Views.OpMessage.SenderID.ActualFieldName, sender_id)); base.CurSQLFactory.SelectCommand(parameters, this.DataStructrure.Views.OpMessage.ActualTableName); DataTable table = base.CurDBEngine.SelectQuery(base.CurSQLFactory.SQL); if ((table == null) || (table.Rows.Count <= 0)) { return(messagess); } messagess = new OpMessagesCollection(); foreach (DataRow row in table.Rows) { messagess.Add(this.FillData(row)); } } return(messagess); }