public void Execute(IDataCommand dataCommand) { IVolume volume = dataCommand.GetDevice() as IVolume; if (volume != null) { volume.IncrementVolume(); } }
public void Execute(IDataCommand dataCommand) { ITemperature control = dataCommand.GetDevice() as ITemperature; if (control != null) { control.IncrementTemperature(); } }
public void Undo(IDataCommand dataCommand) { IVolume volume = dataCommand.GetDevice() as IVolume; if (volume != null) { volume.DecrementVolume(); } }
public void Execute(IDataCommand dataCommand) { IClimatControl control = dataCommand.GetDevice() as IClimatControl; if (control != null) { control.Auto = !control.Auto; } }
public void Undo(IDataCommand dataCommand) { ITemperature control = dataCommand.GetDevice() as ITemperature; if (control != null) { control.DecrementTemperature(); } }
public void Execute(IDataCommand dataCommand) { ILight light = dataCommand.GetDevice() as ILight; if (light != null) { light.IncrementLight(); } }
public void Execute(IDataCommand dataCommand) { IOnOff onOff = dataCommand.GetDevice() as IOnOff; if (onOff != null) { onOff.Off(); } }
public void Undo(IDataCommand dataCommand) { ILight light = dataCommand.GetDevice() as ILight; if (light != null) { light.DecrementLight(); } }
public void Execute(IDataCommand dataCommand) { HouseCinema control = dataCommand.GetDevice() as HouseCinema; if (control != null) { control.OnOffDvd(); } }
public void Execute(IDataCommand dataCommand) { ClimatControl control = dataCommand.GetDevice() as ClimatControl; if (control != null) { control.OnOffHeat(); } }
public void Undo(IDataCommand dataCommand) { IOnOff onOff = dataCommand.GetDevice() as IOnOff; if (onOff != null) { onOff.On(); } }
public void SetUp() { mocker = new MockRepository(); scripter = mocker.CreateMock<ISqlScripter>(); database = mocker.CreateMock<IDataCommand>(); factory = new SqlScripterFactory(database); //harvestor = new Harvestor(factory, ); }
public void Execute(IDataCommand dataCommand) { Room room = dataCommand.GetRoom(); if (room != null) { room.AddDevice(new Lamp(dataCommand.DeviceData)); } }
private string AddParameter(IDataCommand cmd, object value) { var paramName = string.Format("@p{0}", _parameterCount); _parameterCount++; cmd.AddParameter(paramName, value); return paramName; }
/// <summary> /// 更新RMAItem信息 /// </summary> public void UpdateRMAItem(RMAItem entity) { IDataCommand dataCommand = IocManager.Instance.Resolve <IDataCommand>(); dataCommand.CreateCommand("UpdateRMAItem"); //DataCommand cmd = new DataCommand("UpdateRMAItem"); dataCommand.SetParameter <RMAItem>(entity); dataCommand.ExecuteNonQuery(); }
/// <summary> /// 根据MasterSysNo获取列表 /// </summary> /// <param name="rmaMasterSysNo"></param> /// <returns></returns> public List <RMAItem> LoadRMAItems(int rmaMasterSysNo) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); cmd.CreateCommand("LoadRMAItems"); //DataCommand cmd = new DataCommand("LoadRMAItems"); cmd.SetParameter("@RMASysNo", DbType.Int32, rmaMasterSysNo); return(cmd.ExecuteEntityList <RMAItem>()); }
public static Model.Customer CustomerDetail(Model.Customer customer) { IDataCommand dataCommand = DataCommandManager.GetCommand("Customer_CustomerDetail"); dataCommand.SetParameter("@CustomerID", customer.CustomerID); Model.Customer customerInfo = dataCommand.ExecuteEntity <Model.Customer>(); return(customerInfo); }
public void UpdateCellPhoneConfirmTempStatusExpired(string tel) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); cmd.CreateCommand("UpdateCellPhoneConfirmTempStatusExpired"); //DataCommand cmd = new DataCommand("UpdateCellPhoneConfirmTempStatusExpired"); cmd.SetParameter("@tel", DbType.String, tel); cmd.ExecuteNonQuery(); }
/// <summary> /// 创建CustomerMapping信息 /// </summary> public void InsertCustomerMapping(CustomerMapping entity) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); //new DataCommand("CustomerCheckTelIsExist"); cmd.CreateCommand("InsertCustomerMapping"); //DataCommand cmd = new DataCommand("InsertCustomerMapping"); cmd.SetParameter <CustomerMapping>(entity); cmd.ExecuteNonQuery(); }
/// <summary> /// 更新Authentication信息 /// </summary> public void UpdateAuthentication(Authentication entity) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); //new DataCommand("CustomerCheckTelIsExist"); cmd.CreateCommand("UpdateAuthentication"); //DataCommand cmd = new DataCommand("UpdateAuthentication"); cmd.SetParameter <Authentication>(entity); cmd.ExecuteNonQuery(); }
/// <summary> /// 删除RMAMaster信息 /// </summary> public static void DeleteRMAMaster(int sysNo) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); cmd.CreateCommand("DeleteRMAMaster"); //DataCommand cmd = new DataCommand("DeleteRMAMaster"); cmd.SetParameter("@SysNo", DbType.Int32, sysNo); cmd.ExecuteNonQuery(); }
/// <summary> /// 更新RMAMaster信息 /// </summary> public static void UpdateRMAMaster(RMAMaster entity) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); cmd.CreateCommand("UpdateRMAMaster"); //DataCommand cmd = new DataCommand("UpdateRMAMaster"); cmd.SetParameter <RMAMaster>(entity); cmd.ExecuteNonQuery(); }
public CountdownInfo LoadCountdown(int productSysNo) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); cmd.CreateCommand("Seckill_LoadCountDown"); //DataCommand dataCommand = new DataCommand("Seckill_LoadCountDown"); cmd.SetParameter("@ProductSysNo", DbType.Int32, productSysNo); return(cmd.ExecuteEntity <CountdownInfo>()); }
public static List <CountdownInfo> GetAllCountDown(int CountdownStatus = 10) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); cmd.CreateCommand("Seckill_GetAllCountDown"); //DataCommand dataCommand = new DataCommand("Seckill_GetAllCountDown"); cmd.SetParameter("@CountdownStatus", DbType.Int32, CountdownStatus); return(cmd.ExecuteEntityList <CountdownInfo>()); }
/// <summary> /// 删除RMAItem信息 /// </summary> public void DeleteRMAItemByRMASysNo(int rmaSysNo) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); cmd.CreateCommand("DeleteRMAItemByRMASysNo"); // DataCommand cmd = new DataCommand("DeleteRMAItemByRMASysNo"); cmd.SetParameter("@SysNo", DbType.Int32, rmaSysNo); cmd.ExecuteNonQuery(); }
/// <summary> /// Executes the select statement for the Select method. /// </summary> /// <param name="dataCommand">The data command to execute.</param> /// <param name="parameters">The parameters to use in the command.</param> private DbDataReader ExecuteSelect(IDataCommand dataCommand, params DbParameter[] parameters) { lock (_padLock) { OnSelectingRaised(DataAdapterEventArgs.Empty); DbDataReader reader = Manager.ExecuteReader(dataCommand, parameters); OnSelectedRaised(DataAdapterEventArgs.Empty); return(reader); } }
/// <summary> /// 更新CustomerInfo信息 /// </summary> public void UpdateCustomerInfo(CustomerInfo entity) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); //new DataCommand("CustomerCheckTelIsExist"); cmd.CreateCommand("UpdateCustomerInfo"); //DataCommand cmd = new DataCommand("UpdateCustomerInfo"); cmd.SetParameter <CustomerInfo>(entity); cmd.ExecuteNonQuery(); }
/// <summary> /// 删除CustomerInfo信息 /// </summary> public void DeleteCustomerInfo(int sysNo) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); //new DataCommand("CustomerCheckTelIsExist"); cmd.CreateCommand("DeleteCustomerInfo"); //DataCommand cmd = new DataCommand("DeleteCustomerInfo"); cmd.SetParameter("@SysNo", DbType.Int32, sysNo); cmd.ExecuteNonQuery(); }
/// <summary> /// 更新PromotionTemplates信息 /// </summary> public void UpdatePromotionTemplates(PromotionTemplates entity) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); cmd.CreateCommand("UpdatePromotionTemplates"); //DataCommand cmd = new DataCommand("UpdatePromotionTemplates"); cmd.SetParameter <PromotionTemplates>(entity); cmd.ExecuteNonQuery(); }
public List <RecommendProductInfo> GetAllRecommendProductInfo(int CommonStatus = 1) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); cmd.CreateCommand("Seckill_GetAllRecommendProductInfo"); //DataCommand dataCommand = new DataCommand("Seckill_GetAllRecommendProductInfo"); cmd.SetParameter("@CommonStatus", DbType.Int32, CommonStatus); return(cmd.ExecuteEntityList <RecommendProductInfo>()); }
/// <summary> /// 更新Topic信息 /// </summary> public void UpdateTopic(Topic entity) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); cmd.CreateCommand("UpdateTopic"); //DataCommand cmd = new DataCommand("UpdateTopic"); cmd.SetParameter <Topic>(entity); cmd.ExecuteNonQuery(); }
/// <summary> /// 充值增加账户余额 /// </summary> public void UpdateCustomerBalance(int CustomerSysNo, decimal BalancePayAmount) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); //new DataCommand("CustomerCheckTelIsExist"); cmd.CreateCommand("UpdateCustomerBalance"); //DataCommand cmd = new DataCommand("UpdateCustomerBalance"); cmd.SetParameter("@CustomerSysNo", DbType.Int32, CustomerSysNo); cmd.SetParameter("@Balance", DbType.Decimal, BalancePayAmount); cmd.ExecuteNonQuery(); }
public static void SaveCustomerSetting(Model.CustomerSetting customerSetting) { IDataCommand dataCommand = DataCommandManager.GetCommand("Customer_SaveCustomerSetting"); dataCommand.SetParameter("@CustomerSysNo", customerSetting.CustomerSysNo); dataCommand.SetParameter("@Setting", customerSetting.Setting); dataCommand.ExecuteNonQuery(); customerSetting.SysNo = Convert.ToInt32(dataCommand.Parameters["@SysNo"].Value); }
public SOLogistic GetSOLogistic(int sosysno) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); cmd.CreateCommand("GetSOLogistic"); //DataCommand cmd = new DataCommand("GetSOLogistic"); cmd.SetParameter("@SOSysNo", DbType.Int32, sosysno); return(cmd.ExecuteEntity <SOLogistic>()); }
public void InsertNewSMS(SMSInfo item) { IDataCommand datacommand = IocManager.Instance.Resolve <IDataCommand>(); datacommand.CreateCommand("CustomerInsertNewSMS"); //DataCommand datacommand = new DataCommand("CustomerInsertNewSMS"); datacommand.SetParameter <SMSInfo>(item); datacommand.ExecuteNonQuery(); }
public List <SOStatistics> GetSOStatistics(int customersysno) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); cmd.CreateCommand("GetSOStatistics"); //DataCommand cmd = new DataCommand("GetSOStatistics"); cmd.SetParameter("@CustomerSysNo", DbType.Int32, customersysno); return(cmd.ExecuteEntityList <SOStatistics>()); }
/// <summary> /// Adds a new parameter with the <see cref="IDataParameter" /> fluent object. /// </summary> /// <typeparam name="TParameter"></typeparam> /// <param name="dataCommand">The <see cref="IDataCommand"/> for this extension method.</param> /// <param name="configurator">The <see langword="delegate" /> to configurator the <see cref="IDataParameter" />.</param> /// <returns> /// A fluent <see langword="interface" /> to the data command. /// </returns> public static IDataCommand Parameter <TParameter>(this IDataCommand dataCommand, Action <IDataParameter <TParameter> > configurator) { var parameter = dataCommand.Command.CreateParameter(); var dataParameter = new DataParameter <TParameter>(dataCommand, parameter); configurator(dataParameter); return(dataCommand.Parameter(parameter)); }
/// <summary> /// 更新ShippingAddress信息 /// </summary> public void UpdateShippingAddress(ShippingAddress entity) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); cmd.CreateCommand("UpdateShippingAddress"); //DataCommand cmd = new DataCommand("UpdateShippingAddress"); cmd.SetParameter <ShippingAddress>(entity); cmd.ExecuteNonQuery(); }
public void CreatePushMessage(PushMessage msg) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); cmd.CreateCommand("CreatePushMessage"); //DataCommand cmd = new DataCommand("CreatePushMessage"); cmd.SetParameter <PushMessage>(msg); cmd.ExecuteNonQuery(); }
public void CreateRechargeRequest(RechargeRequest request) { IDataCommand cmd = IocManager.Instance.Resolve <IDataCommand>(); //new DataCommand("CustomerCheckTelIsExist"); cmd.CreateCommand("InsertRechargeRequest"); //DataCommand cmd = new DataCommand("InsertRechargeRequest"); cmd.SetParameter <RechargeRequest>(request); int result = cmd.ExecuteNonQuery(); }
public void Pull() { IDbManager dbManager = ObjectPool.Instance.Resolve <IDbManager>(); IDataCommand db = dbManager.GetDatabase(ApplicationSettings.Instance.Database.DefaultConnection.Name); MutableObservableCollection <CreateOrderModel> newPaymentOrder = new MutableObservableCollection <CreateOrderModel>(); MutableObservableCollection <CreateOrderModel> newPrintOrder = new MutableObservableCollection <CreateOrderModel>(); MutableObservableCollection <CreateOrderModel> newQueue = new MutableObservableCollection <CreateOrderModel>(); KeyValueOption selectedRange = this.SelectedRange; if (IndexRefreshing == -1 || IndexRefreshing == 1) { newPrintOrder = new MutableObservableCollection <CreateOrderModel>(); newPrintOrder = db.Query <CreateOrderModel>("GetPrintOrder", new { Between = Convert.ToInt32(selectedRange.Id) * -1 }).Convert <CreateOrderModel>(); PrintOrderMaster.Source = newPrintOrder.Convert <CreateOrderModel>(); GetDetails(PrintOrderMaster.Source, db); } if (IndexRefreshing == -1 || IndexRefreshing == 2) { newPaymentOrder = new MutableObservableCollection <CreateOrderModel>(); newPaymentOrder = db.Query <CreateOrderModel>("GetFinishedOrder", new { Between = Convert.ToInt32(selectedRange.Id) * -1 }).Convert <CreateOrderModel>(); PaymentOrderMaster.Source = newPaymentOrder.Convert <CreateOrderModel>(); GetDetails(PaymentOrderMaster.Source, db); } if (IndexRefreshing == -1 || IndexRefreshing == 3) { newQueue = new MutableObservableCollection <CreateOrderModel>(); newQueue = db.Query <CreateOrderModel>("GetQueue", new { Between = Convert.ToInt32(selectedRange.Id) * -1 }).Convert <CreateOrderModel>(); QueueMaster.Source = newQueue.Convert <CreateOrderModel>(); GetDetails(QueueMaster.Source, db); } if (string.IsNullOrEmpty(searchInput)) { if (IndexRefreshing == -1 || IndexRefreshing == 1) { PaymentOrder.CheckedHeader = false; PrintOrder.Source = newPrintOrder; GetDetails(PrintOrder.Source, db); } if (IndexRefreshing == -1 || IndexRefreshing == 1) { PrintOrder.CheckedHeader = false; PaymentOrder.Source = newPaymentOrder; GetDetails(PaymentOrder.Source, db); } if (IndexRefreshing == -1 || IndexRefreshing == 1) { Queue.CheckedHeader = false; Queue.Source = newQueue; GetDetails(Queue.Source, db); } } db.Close(); }
public static void UpdateRetrieveTaskStatus(Model.RetrieveTask retrieveTask) { IDataCommand dataCommand = DataCommandManager.GetCommand("Task_UpdateRetrieveTaskStatus"); dataCommand.SetParameter("@TaskSysNo", retrieveTask.RunTaskSysNo); dataCommand.SetParameter("@RetrieveTask", retrieveTask.SysNo); dataCommand.SetParameter("@Status", retrieveTask.Status); dataCommand.SetParameter("@Description", retrieveTask.Description); dataCommand.ExecuteNonQuery(); }
/// <summary> /// Initializes a new instance of the <see cref="DataWatcher"/> class. /// </summary> /// <param name="manager">The <see cref="DataManager"/> to be used for the underlying data operations.</param> /// <param name="command">The <see cref="IDataCommand"/> to execute and monitor for changes.</param> /// <param name="dueTime">The amount of time to delay before the associated <see cref="Watcher"/> starts signaling. Specify negative one (-1) milliseconds to prevent the signaling from starting. Specify zero (0) to start the signaling immediately.</param> /// <param name="period">The time interval between periodic signaling for changes of the provided <paramref name="command"/>.</param> /// <param name="dueTimeOnChanged">The amount of time to postpone a <see cref="Watcher.Changed"/> event. Specify zero (0) to disable postponing.</param> /// <param name="parameters">An optional array of <see cref="DbParameter"/> to use with the associated <paramref name="command"/>.</param> /// <remarks>Monitors the provided <paramref name="command"/> for changes in an interval specified by <paramref name="period"/> using a MD5 hash check on the query result.</remarks> public DataWatcher(DataManager manager, IDataCommand command, TimeSpan dueTime, TimeSpan period, TimeSpan dueTimeOnChanged, params DbParameter[] parameters) : base(dueTime, period, dueTimeOnChanged) { if (command == null) { throw new ArgumentNullException(nameof(command)); } Manager = manager; Command = command; Parameters = parameters; Signature = 0; }
protected IDataCommand AddWhereParams(IDataCommand command) { string prefix = "@where"; foreach (var condition in _whereBuilder.QueryConditions.Keys) { command.Parameter(prefix + condition.Field.FieldName, condition.Value); } return(command); }
public void Execute(IDataCommand dataCommand) { if (!string.IsNullOrEmpty(dataCommand.Value)) { ILight light = dataCommand.GetDevice() as ILight; if (light != null) { light.Brightness = (LightsState) Enum.Parse(typeof (LightsState), dataCommand.Value); } } }
public void Write(IDataCommand dataCommand) { panHouse.Controls.Clear(); foreach (Room room in Home.Rooms.Values) { RoomControl roomControl = new RoomControl(Home, room); panHouse.Controls.Add(roomControl); panHouse.Controls.Add(new LiteralControl("<br />")); panHouse.Controls.Add(new LiteralControl("<br />")); } }
public void Execute(IDataCommand dataCommand) { Device dev = dataCommand.GetDevice(); if (dev != null) { Room room = dataCommand.GetRoom(); if (room != null) { room.DeleteDevice(dataCommand.DeviceData); } } }
public void Undo(IDataCommand dataCommand) { Device dev = dataCommand.GetDevice(); if (dev != null) { Room room = dataCommand.GetRoom(); if (room != null) { room.AddDevice(dev); } } }
public void Dispose() { if (database != null) { database.Rollback(); database = null; } if (itemReader != null) { itemReader.Close(); itemReader = null; } }
public DataSetAdapter( string adapterName, IDbDataAdapter dbDataAdapter, DataSource dataSource, IDataCommand selectCommand, IDataCommand updateCommand, IDataCommand insertCommand, IDataCommand deleteCommand) : this(adapterName, dataSource) { _dbDataAdapter = dbDataAdapter; _selectCommand = selectCommand; _updateCommand = updateCommand; _insertCommand = insertCommand; _deleteCommand = deleteCommand; }
public void Undo(IDataCommand dataCommand) { dataCommand.Home.DeleteRoom(dataCommand.RoomData); }
public void Execute(IDataCommand dataCommand) { dataCommand.Home.AddRoom(new Room(dataCommand.RoomData)); }
public void Undo(IDataCommand device) { Execute(device); }
internal void FireQueryFinished(IDataCommand cmd) { if(OnQueryFinished != null) { OnQueryFinished(cmd); } }
public void Undo(IDataCommand dataCommand) { dataCommand.Home.DeleteDevice(dataCommand.RoomData, dataCommand.DeviceData); }
public SqlScripter(IDataCommand database, ScriptInfo scriptInfo) { this.database = database; this.scriptInfo = scriptInfo; LoadSchema(); }
/// <summary> /// Initializes a new instance of the <see cref="HarvestService"/> class. /// </summary> /// <param name="sqlConfiguration">The SQL configuration.</param> public HarvestService(SqlHarvesterConfiguration sqlConfiguration) { this.sqlConfiguration = sqlConfiguration; database = new Database(sqlConfiguration.ConnectionString); }
public void Execute(IDataCommand dataCommand) { dataCommand.Home.DeleteRoom(dataCommand.RoomData); }
public void Undo(IDataCommand dataCommand) { dataCommand.Home.AddRoom(new Room(dataCommand.RoomData)); }
private void OnQueryFinished(IDataCommand command) { Interlocked.Increment(ref _totalQueryCount); lock(_statsLock) { _totalQueryTime = _totalQueryTime.Add(command.ExecutionTime); } }