public bool UpdateMessage(OpMessagesCollection ResultCollection) { bool flag = false; if (this.TryConnection()) { DatabaseParameters values = null; DatabaseParameters keys = null; ArrayList sqla = new ArrayList(); foreach (MessageObj obj2 in ResultCollection) { keys = new DatabaseParameters(); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpMessage.InternalID.ActualFieldName, obj2.InternalID)); values = new DatabaseParameters(); values.Add(new DatabaseParameter(this.DataStructrure.Tables.OpMessage.IsRead.ActualFieldName, obj2.IsRead ? "1" : "0")); values.Add(new DatabaseParameter(this.DataStructrure.Tables.OpMessage.MessageArrivalDate.ActualFieldName, obj2.MsgArrivalDate)); base.CurSQLFactory.UpdateCommand(keys, values, this.DataStructrure.Tables.OpMessage.ActualTableName); sqla.Add(base.CurSQLFactory.SQL); } if (!(flag = base.CurDBEngine.ExecuteQuery(sqla))) { base.error_occured = true; string errMsg = base.ErrMsg; base.ErrMsg = errMsg + "[OpMessageManager] : UpdateMessage : " + base.CurSQLFactory.SQL + " : " + base.CurDBEngine.ErrorMessage; } this.DisposeObjects(); return(flag); } base.error_occured = true; base.ErrMsg = base.ErrMsg + "[OpMessageManager] : UpdateMessage : " + base.ErrMsg; this.DisposeObjects(); return(flag); }
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); }