//コマンドを送信する void SendCommand(CommandStruct c, UnityAction call) { if (sending) { throw new IOException("Already sending command"); } //応答ファイルがあれば削除する if (File.Exists(ResponseFilePath)) { File.Delete(ResponseFilePath); } //シーケンス番号を更新 c.sequence = lastsequence + 1; //コマンドを書き込み var json = JsonUtility.ToJson(c); File.WriteAllText(CommandFilePath, json, new UTF8Encoding(false)); //シーケンス番号を記憶 lastsequence = c.sequence; //コールバック設定 callback = call; //受信処理を開始 sending = true; checkTime = 0; //実行開始 Launcher.LaunchTweetHelper("command"); }
private bool SendToDb <T>(T data, EntityPropertyGetFunc <T> getFunc, EnttiyPostColumnFunc <T> postColumnFunc, bool synchronous) where T : ISqlEntity { if (Equals(data, null)) { return(false); } SchemaTable schemaTable = EntitySchemaSet.Get(data.GetType()); DbBaseProvider dbProvider = DbConnectionProvider.CreateDbProvider(_connectKey ?? schemaTable.ConnectKey); if (dbProvider == null) { return(false); } CommandStruct command = GenerateCommand(dbProvider, data, schemaTable, getFunc, postColumnFunc); if (command != null) { bool result = (synchronous ? dbProvider.ExecuteQuery(CommandType.Text, command.Sql, command.Parameters) : dbProvider.ExecuteNonQuery(data.GetMessageQueueId(), CommandType.Text, command.Sql, command.Parameters)) > 0; data.ResetState(); return(result); } return(false); }
private bool SendToDb <T>(T data, EntityPropertyGetFunc <T> getFunc, EnttiyPostColumnFunc <T> postColumnFunc, bool synchronous) where T : ISqlEntity { if (Equals(data, null)) { return(false); } SchemaTable schemaTable = EntitySchemaSet.Get(data.GetType()); DbBaseProvider dbProvider = DbConnectionProvider.CreateDbProvider(_connectKey ?? schemaTable.ConnectKey); if (dbProvider == null) { return(false); } CommandStruct command = GenerateCommand(dbProvider, data, schemaTable, getFunc, postColumnFunc); if (command != null) { int result; if (synchronous) { //同时采集 ProfileManager.PostSqlOfMessageQueueTimes(command.TableName, 1); ProfileManager.ProcessSqlOfMessageQueueTimes(command.TableName); result = dbProvider.ExecuteQuery(CommandType.Text, command.Sql, command.Parameters); } else { //put into pool result = dbProvider.ExecuteNonQuery(data.GetMessageQueueId(), CommandType.Text, command.TableName, command.Sql, command.Parameters); } data.ResetState(); return(result > 0); } return(false); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { try { CommandStruct cmd = new CommandStruct() { Command = (EnumCommand)(values[0]), AxisIndex = System.Convert.ToInt32(values[1]), DriveVelocity = System.Convert.ToInt32(values[2]), TotalSteps = System.Convert.ToInt32(values[3]), Mode = (bool)(values[4]) ? MoveMode.ABS : MoveMode.REL, }; if (cmd.Mode == MoveMode.REL && values[5].ToString() == "-") { cmd.TotalSteps *= -1; } return(cmd); } catch { return(null); } }
//ツイートする public void tweet(string status, UnityAction call) { CommandStruct c = new CommandStruct(); c.command = "update"; c.status = status; c.imagePath = ""; SendCommand(c, call); }
//画像つきツイートする public void tweetWithImage(string status, string imagePath, UnityAction call) { CommandStruct c = new CommandStruct(); c.command = "updateWithImage"; c.status = status; c.imagePath = imagePath; SendCommand(c, call); }
//リプライを取得 public void getReply(UnityAction call) { CommandStruct c = new CommandStruct(); c.command = "reply"; c.status = ""; c.imagePath = ""; SendCommand(c, call); }
//バージョン情報を取得 public void getVersion(UnityAction call) { CommandStruct c = new CommandStruct(); c.command = "version"; c.status = ""; c.imagePath = ""; SendCommand(c, call); }
private int InsertOrUpdate(CommandStruct command, Dictionary <string, object> parameters, string condition) { foreach (var param in parameters) { command.AddParameter(param.Key, param.Value); } command.Filter.Condition = condition; command.Parser(); return(m_DB.ExecuteQuery(CommandType.Text, command.Sql, command.Parameters)); }
public static bool UpdateCommandSecurity(CommandStruct command) { if (!Commands.ContainsKey(command.Name)) { return(false); } Commands[command.Name].Security = command.NeededLevel; return(true); }
async void StartMoveAsync(CommandStruct args) { bool success = await _controller.MoveAsync(args.AxisIndex, args.DriveVelocity, args.TotalSteps, args.Mode); if (!success) { Messenger.Default.Send <NotificationMessage <string> >( new NotificationMessage <string>( string.Format("Unable to move, {0}", _controller.LastError), "Error")); } }
/// <summary> /// /// </summary> /// <param name="identityId"></param> /// <param name="command"></param> /// <returns></returns> public override SqlStatement GenerateSql(int identityId, CommandStruct command) { command.Parser(); SqlStatement statement = new SqlStatement(); statement.IdentityID = identityId; statement.ConnectionString = ConnectionString; statement.ProviderType = "MySqlDataProvider"; statement.CommandType = command.CommandType; statement.CommandText = command.Sql; statement.Params = SqlStatementManager.ConvertSqlParam(command.Parameters); return(statement); }
/// <summary> /// /// </summary> /// <param name="feedbackId"></param> /// <param name="replyContent"></param> /// <param name="replyId">回复者</param> /// <returns></returns> public bool ReplyToFeedBack(int feedbackId, string replyContent, int replyId) { CommandStruct command = new CommandStruct("GMFeedBack", CommandMode.Modify); command.AddParameter("RContent", SqlDbType.VarChar, replyContent); command.AddParameter("ReplyID", SqlDbType.VarChar, replyId); command.AddParameter("ReplyTime", SqlDbType.DateTime, DateTime.Now); command.Filter = new CommandFilter(); command.Filter.Condition = "GMId=@GMId"; command.Filter.AddParam("@GMId", SqlDbType.Int, 0, feedbackId); command.Parser(); return(SqlHelper.ExecuteNonQuery(ConfigManger.connectionString, CommandType.Text, command.Sql, command.SqlParameters) > 0); }
/// <summary> /// /// </summary> /// <param name="feedbackId"></param> /// <param name="replyContent"></param> /// <param name="replyId">回复者</param> /// <returns></returns> public bool ReplyToFeedBack(int feedbackId, string replyContent, int replyId) { CommandStruct command = ConfigManger.Provider.CreateCommandStruct("GMFeedBack", CommandMode.Modify); command.AddParameter("RContent", replyContent); command.AddParameter("ReplyID", replyId); command.AddParameter("ReplyTime", DateTime.Now); command.Filter = ConfigManger.Provider.CreateCommandFilter(); command.Filter.Condition = ConfigManger.Provider.FormatFilterParam("GMId"); command.Filter.AddParam("GMId", feedbackId); command.Parser(); return(ConfigManger.Provider.ExecuteQuery(CommandType.Text, command.Sql, command.Parameters) > 0); }
/// <summary> /// 修改状态 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Update(OrderInfo model) { CommandStruct command = new CommandStruct("OrderInfo", CommandMode.Modify); command.AddParameter("SerialNumber", SqlDbType.VarChar, model.SerialNumber); command.AddParameter("PayStatus", SqlDbType.Int, model.PayStatus); command.AddParameter("@Signature", SqlDbType.VarChar, 0, model.Signature); command.Filter = new CommandFilter(); command.Filter.Condition = "OrderNO=@OrderNO"; command.Filter.AddParam("@OrderNO", SqlDbType.VarChar, 0, model.OrderNO); command.Parser(); int rows = SqlHelper.ExecuteNonQuery(ConfigManger.connectionString, CommandType.Text, command.Sql, command.SqlParameters); return(rows > 0); }
/// <summary> /// Generate sql statement /// </summary> /// <typeparam name="T"></typeparam> /// <param name="data"></param> /// <returns></returns> internal SqlStatement GenerateSqlQueue <T>(T data) where T : AbstractEntity { SchemaTable schemaTable = data.GetSchema(); DbBaseProvider dbProvider = DbConnectionProvider.CreateDbProvider(schemaTable.ConnectKey); if (dbProvider != null) { CommandStruct command = GenerateCommand(dbProvider, data, schemaTable, false, null); if (command != null) { int identityId = data.GetIdentityId(); return(dbProvider.GenerateSql(identityId, command)); } } return(null); }
/// <summary> /// /// </summary> /// <param name="info"></param> public bool PostFeedBack(FeedbackInfo info) { CommandStruct command = ConfigManger.Provider.CreateCommandStruct("GMFeedBack", CommandMode.Insert); command.AddParameter("UId", info.Uid); command.AddParameter("GameID", info.GameID); command.AddParameter("ServerID", info.ServerID); command.AddParameter("GMType", info.Type); command.AddParameter("content", info.Content); command.AddParameter("Pid", info.Pid); command.AddParameter("NickName", info.NickName); command.AddParameter("SubmittedTime", info.CreateDate); command.Parser(); return(ConfigManger.Provider.ExecuteQuery(CommandType.Text, command.Sql, command.Parameters) > 0); }
/// <summary> /// /// </summary> /// <param name="info"></param> public bool PostFeedBack(FeedbackInfo info) { CommandStruct command = new CommandStruct("GMFeedBack", CommandMode.Insert); command.AddParameter("UId", SqlDbType.Int, info.Uid); command.AddParameter("GameID", SqlDbType.Int, info.GameID); command.AddParameter("ServerID", SqlDbType.Int, info.ServerID); command.AddParameter("GMType", SqlDbType.Int, info.Type); command.AddParameter("content", SqlDbType.VarChar, info.Content); command.AddParameter("Pid", SqlDbType.VarChar, info.Pid); command.AddParameter("NickName", SqlDbType.VarChar, info.NickName); command.AddParameter("SubmittedTime", SqlDbType.DateTime, info.CreateDate); command.Parser(); return(SqlHelper.ExecuteNonQuery(ConfigManger.connectionString, CommandType.Text, command.Sql, command.SqlParameters) > 0); }
/// <summary> /// Generate sql statement /// </summary> /// <typeparam name="T"></typeparam> /// <param name="data"></param> /// <param name="getFunc"></param> /// <param name="postColumnFunc"></param> /// <returns></returns> internal SqlStatement GenerateSqlQueue <T>(T data, EntityPropertyGetFunc <T> getFunc = null, EnttiyPostColumnFunc <T> postColumnFunc = null) where T : ISqlEntity { SchemaTable schemaTable = EntitySchemaSet.Get(data.GetType()); DbBaseProvider dbProvider = DbConnectionProvider.CreateDbProvider(schemaTable.ConnectKey); if (dbProvider != null) { //process all columns. CommandStruct command = GenerateCommand(dbProvider, data, schemaTable, getFunc, postColumnFunc); if (command != null) { var identityId = data.GetMessageQueueId(); return(dbProvider.GenerateSql(identityId, command)); } } return(null); }
private void UpdateToDb <T>(T data, bool isChange, string connectKey, EntityBeforeProcess handle) where T : AbstractEntity { if (data == null) { return; } SchemaTable schemaTable = data.GetSchema(); DbBaseProvider dbProvider = DbConnectionProvider.CreateDbProvider(connectKey ?? schemaTable.ConnectKey); if (dbProvider == null) { return; } CommandStruct command = GenerateCommand(dbProvider, data, schemaTable, isChange, handle); if (command != null) { dbProvider.ExecuteNonQuery(data.GetIdentityId(), CommandType.Text, command.Sql, command.Parameters); data.OnUnNew(); } }
public bool UpdateBy91(OrderInfo model, bool callback) { CommandStruct command = new CommandStruct("OrderInfo", CommandMode.Modify); if (callback) { command.AddParameter("MerchandiseName", SqlDbType.VarChar, model.MerchandiseName); command.AddParameter("PayType", SqlDbType.VarChar, model.PayType); command.AddParameter("Amount", SqlDbType.Decimal, model.Amount); command.AddParameter("SendState", SqlDbType.Int, model.SendState); command.AddParameter("PayStatus", SqlDbType.Int, model.PayStatus); command.AddParameter("GameCoins", SqlDbType.Int, model.GameCoins); command.AddParameter("Signature", SqlDbType.VarChar, model.Signature); } else { command.AddParameter("ServerID", SqlDbType.Int, model.ServerID); command.AddParameter("PassportID", SqlDbType.VarChar, model.PassportID); command.AddParameter("GameID", SqlDbType.Int, model.GameID); command.AddParameter("RetailID", SqlDbType.VarChar, model.RetailID);//20 //修改了服务器名称为空写库的BUG panx 2012-11-26 if (!string.IsNullOrEmpty(model.ServerName)) { command.AddParameter("ServerName", SqlDbType.VarChar, model.ServerName); } //修改了游戏名称为空写库的BUG panx 2012-11-26 if (!string.IsNullOrEmpty(model.GameName)) { command.AddParameter("gameName", SqlDbType.VarChar, model.GameName); } } command.Filter = new CommandFilter(); command.Filter.Condition = "OrderNO=@OrderNO"; command.Filter.AddParam("@OrderNO", SqlDbType.VarChar, 0, model.OrderNO); command.Parser(); int rows = SqlHelper.ExecuteNonQuery(ConfigManger.connectionString, CommandType.Text, command.Sql, command.SqlParameters); return(rows > 0); }
//添加订单 public bool Add(OrderInfo model) { model.CreateDate = DateTime.Now; CommandStruct command = new CommandStruct("OrderInfo", CommandMode.Insert); command.AddParameter("OrderNO", SqlDbType.VarChar, model.OrderNO); command.AddParameter("MerchandiseName", SqlDbType.VarChar, model.MerchandiseName); command.AddParameter("PayType", SqlDbType.VarChar, model.PayType); command.AddParameter("Amount", SqlDbType.Decimal, model.Amount); command.AddParameter("Currency", SqlDbType.VarChar, model.Currency); command.AddParameter("Expand", SqlDbType.VarChar, model.Expand); command.AddParameter("SerialNumber", SqlDbType.VarChar, model.SerialNumber); command.AddParameter("PassportID", SqlDbType.VarChar, model.PassportID); command.AddParameter("ServerID", SqlDbType.Int, model.ServerID); command.AddParameter("GameID", SqlDbType.Int, model.GameID); command.AddParameter("gameName", SqlDbType.VarChar, model.GameName); command.AddParameter("ServerName", SqlDbType.VarChar, model.ServerName); command.AddParameter("PayStatus", SqlDbType.Int, model.PayStatus); command.AddParameter("Signature", SqlDbType.VarChar, model.Signature); command.AddParameter("Remarks", SqlDbType.Text, model.Remarks); command.AddParameter("GameCoins", SqlDbType.Int, model.GameCoins); command.AddParameter("SendState", SqlDbType.Int, model.SendState); command.AddParameter("RetailID", SqlDbType.VarChar, model.RetailID);//添加渠道商ID 孙德尧 2012/4/1 9:24 command.AddParameter("DeviceID", SqlDbType.VarChar, model.DeviceID == null ? string.Empty : model.DeviceID); if (model.SendDate > DateTime.MinValue) { command.AddParameter("SendDate", SqlDbType.DateTime, model.SendDate); } command.AddParameter("CreateDate", SqlDbType.DateTime, model.CreateDate); command.Parser(); int rows = SqlHelper.ExecuteNonQuery(ConfigManger.connectionString, CommandType.Text, command.Sql, command.SqlParameters); if (rows > 0) { return(true); } return(false); }
//是否发送修改 public bool Updatestr(string OrderNo) { CommandStruct command = new CommandStruct("OrderInfo", CommandMode.Modify); command.AddParameter("SendState", 2); command.AddParameter("SendDate", SqlDbType.DateTime, DateTime.Now); command.Filter = new CommandFilter(); command.Filter.Condition = "OrderNO=@OrderNO"; command.Filter.AddParam("@OrderNO", SqlDbType.VarChar, 0, OrderNo); command.Parser(); int rows = SqlHelper.ExecuteNonQuery(ConfigManger.connectionString, CommandType.Text, command.Sql, command.SqlParameters); { if (rows > 0) { return(true); } else { return(false); } } }
internal bool PaySuccess(string orderNo, OrderInfo orderInfo) { CommandStruct command = new CommandStruct("OrderInfo", CommandMode.Modify); orderInfo.PayStatus = 2; command.AddParameter("PayStatus", SqlDbType.Int, orderInfo.PayStatus); if (!string.IsNullOrEmpty(orderInfo.PayType)) { command.AddParameter("PayType", SqlDbType.VarChar, orderInfo.PayType); } if (orderInfo.Amount > 0 && orderInfo.GameCoins > 0) { command.AddParameter("Amount", SqlDbType.Decimal, orderInfo.Amount); command.AddParameter("GameCoins", SqlDbType.Int, orderInfo.GameCoins); } command.Filter = new CommandFilter(); command.Filter.Condition = "OrderNO=@OrderNO"; command.Filter.AddParam("@OrderNO", SqlDbType.VarChar, 0, orderNo); command.Parser(); int rows = SqlHelper.ExecuteNonQuery(ConfigManger.connectionString, CommandType.Text, command.Sql, command.SqlParameters); return(rows > 0); }
/// <summary> /// /// </summary> /// <param name="identityId"></param> /// <param name="command"></param> /// <returns></returns> public override SqlStatement GenerateSql(int identityId, CommandStruct command) { command.Parser(); SqlStatement statement = new SqlStatement(); statement.IdentityID = identityId; statement.Table = command.TableName; statement.ConnectionString = ConnectionString; statement.ProviderType = "MySqlDataProvider"; statement.CommandType = command.CommandType; statement.CommandText = command.Sql; statement.Params = SqlStatementManager.ConvertSqlParam(command.Parameters); return statement; }
private void SendCommandToServer(CommandStruct cmd, byte[] extra) { byte[] data = Common.SerializeStruct<CommandStruct>(cmd); clientStream.Write(data, 0, Common.CommandStructSize); if (cmd.ExtraDataSize > 0) { clientStream.Write(extra, 0, (int)cmd.ExtraDataSize); Console.WriteLine("Command send : {0}", Common.ParseEnumValue<NetworkCommands>(cmd.CommandIndex).ToString()); } }
private void UpdateToDb <T>(T data, bool isChange, string connectKey, EntityBeforeProcess handle) where T : AbstractEntity { if (data == null) { return; } SchemaTable schemaTable = data.GetSchema(); if (!schemaTable.IsStoreInDb || (string.IsNullOrEmpty(schemaTable.ConnectKey) && string.IsNullOrEmpty(schemaTable.ConnectionString))) { return; } string[] columns = GetColumns(schemaTable, data, isChange); if (columns == null || columns.Length == 0) { TraceLog.WriteError("Class:{0} is not change column.", data.GetType().FullName); return; } DbBaseProvider dbProvider = DbConnectionProvider.CreateDbProvider(connectKey ?? schemaTable.ConnectKey); if (dbProvider == null) { //TraceLog.WriteError("DbBaseProvider:{0} is null.", (connectKey ?? schemaTable.ConnectKey)); return; } CommandStruct command = null; if (data.IsDelete) { command = dbProvider.CreateCommandStruct(schemaTable.Name, CommandMode.Delete); } else if (schemaTable.AccessLevel == AccessLevel.WriteOnly) { command = dbProvider.CreateCommandStruct(schemaTable.Name, CommandMode.Insert); } else { command = dbProvider.CreateCommandStruct(schemaTable.Name, CommandMode.ModifyInsert); } //StringBuilder changeLog = new StringBuilder(); //changeLog.AppendFormat("\"Keys\":\"{0}\"", data.GetKeyCode()); //处理列 foreach (string columnName in columns) { if (columnName.IsEmpty()) { continue; } SchemaColumn schemaColumn; if (schemaTable.Columns.TryGetValue(columnName, out schemaColumn)) { if (schemaColumn.Disable || schemaColumn.IsIdentity) { continue; } object value = data.GetPropertyValue(schemaColumn.CanRead, columnName); if (handle != null) { var e = new EntityEvent() { Data = data, FieldName = columnName, FieldValue = value }; value = handle(e); } if (CovertDataValue(schemaTable, schemaColumn, ref value)) { //changeLog.AppendFormat(",\"{0}\":\"{1}\"", columnName, value); IDataParameter parameter = CreateParameter(dbProvider, columnName, schemaColumn.DbType, value); command.AddParameter(parameter); } } } //处理条件 string[] keyList = schemaTable.Keys; if (keyList.Length == 0) { throw new ArgumentNullException(string.Format("Table:{0} key is empty.", schemaTable.Name)); } string condition = string.Empty; command.Filter = dbProvider.CreateCommandFilter(); foreach (string columnName in keyList) { SchemaColumn schemaColumn; if (schemaTable.Columns.TryGetValue(columnName, out schemaColumn)) { string keyName = columnName; string paramName = "F_" + columnName; if (condition.Length > 0) { condition += " AND "; } condition += dbProvider.FormatFilterParam(schemaColumn.Name, "", paramName); object value = data.GetPropertyValue(schemaColumn.CanRead, columnName); if (handle != null) { var e = new EntityEvent() { Data = data, FieldName = columnName, FieldValue = value }; value = handle(e); } if (CovertDataValue(schemaTable, schemaColumn, ref value)) { IDataParameter parameter = CreateParameter(dbProvider, paramName, schemaColumn.DbType, value); command.Filter.AddParam(parameter); if (!schemaColumn.IsIdentity) { command.AddKey(CreateParameter(dbProvider, keyName, schemaColumn.DbType, value)); } } } } command.Filter.Condition = condition; command.Parser(); //if (schemaTable.AccessLevel == AccessLevel.ReadWrite) //{ // TraceLog.ReleaseWriteDebug("Update change \"{0}\" data:{1}", data.GetType().FullName, changeLog.ToString()); //} dbProvider.ExecuteNonQuery(data.GetIdentityId(), CommandType.Text, command.Sql, command.Parameters); data.OnUnNew(); }
public void UpdateCommandSecurity(CommandStruct command, ulong sender) { _permissionsFile.Permissions.UpdateCommandSecurity(command, sender); _permissionsFile.Save(); }
private CommandStruct GenerateCommand <T>(DbBaseProvider dbProvider, T data, SchemaTable schemaTable, bool isChange, EntityBeforeProcess handle) where T : AbstractEntity { CommandStruct command = null; if (!(schemaTable.StorageType.HasFlag(StorageType.ReadOnlyDB) || schemaTable.StorageType.HasFlag(StorageType.ReadWriteDB) || schemaTable.StorageType.HasFlag(StorageType.WriteOnlyDB)) || (string.IsNullOrEmpty(schemaTable.ConnectKey) && string.IsNullOrEmpty(schemaTable.ConnectionString))) { return(null); } string[] columns = GetColumns(schemaTable, data, isChange); if (columns == null || columns.Length == 0) { TraceLog.WriteError("Class:{0} is not change column.", data.GetType().FullName); return(null); } string tableName = schemaTable.GetTableName(); if (data.IsDelete) { command = dbProvider.CreateCommandStruct(tableName, CommandMode.Delete); } else if (schemaTable.AccessLevel == AccessLevel.WriteOnly) { command = dbProvider.CreateCommandStruct(tableName, CommandMode.Insert); } else { command = dbProvider.CreateCommandStruct(tableName, CommandMode.ModifyInsert); } //StringBuilder changeLog = new StringBuilder(); //changeLog.AppendFormat("\"Keys\":\"{0}\"", data.GetKeyCode()); //处理列 foreach (string columnName in columns) { if (columnName.IsEmpty()) { continue; } SchemaColumn schemaColumn; if (schemaTable.Columns.TryGetValue(columnName, out schemaColumn)) { if (schemaColumn.Disable || schemaColumn.IsIdentity) { continue; } object value = data.GetPropertyValue(schemaColumn.CanRead, columnName); if (handle != null) { var e = new EntityEvent() { Data = data, FieldName = columnName, FieldValue = value }; value = handle(e); } if (CovertDataValue(schemaTable, schemaColumn, ref value)) { //changeLog.AppendFormat(",\"{0}\":\"{1}\"", columnName, value); IDataParameter parameter = CreateParameter(dbProvider, columnName, schemaColumn.DbType, value); command.AddParameter(parameter); } } } //处理条件 string[] keyList = schemaTable.Keys; if (keyList.Length == 0) { throw new ArgumentNullException(string.Format("Table:{0} key is empty.", schemaTable.EntityName)); } string condition = string.Empty; command.Filter = dbProvider.CreateCommandFilter(); foreach (string columnName in keyList) { SchemaColumn schemaColumn; if (schemaTable.Columns.TryGetValue(columnName, out schemaColumn)) { string keyName = columnName; string paramName = "F_" + columnName; if (condition.Length > 0) { condition += " AND "; } condition += dbProvider.FormatFilterParam(schemaColumn.Name, "", paramName); object value = data.GetPropertyValue(schemaColumn.CanRead, columnName); if (handle != null) { var e = new EntityEvent() { Data = data, FieldName = columnName, FieldValue = value }; value = handle(e); } if (CovertDataValue(schemaTable, schemaColumn, ref value)) { IDataParameter parameter = CreateParameter(dbProvider, paramName, schemaColumn.DbType, value); command.Filter.AddParam(parameter); if (!schemaColumn.IsIdentity) { command.AddKey(CreateParameter(dbProvider, keyName, schemaColumn.DbType, value)); } } } } command.Filter.Condition = condition; command.Parser(); return(command); }