コード例 #1
0
        protected void deleteEventButton_Click(object sender, EventArgs e)
        {
            foreach (string id in this.dataGrid.SelectedKeys)
            {
                AMSDeleteEntityExecutor <string, AMSEvent> executor = new AMSDeleteEntityExecutor <string, AMSEvent>(
                    id,
                    key => AMSEventSqlAdapter.Instance.DeleteByID(key),
                    AMSOperationType.DeleteEvent);

                executor.Execute();
            }

            this.InnerRefreshList();
        }
コード例 #2
0
        protected void deleteEventButton_Click(object sender, EventArgs e)
        {
            foreach (string id in this.dataGrid.SelectedKeys)
            {
                AMSDeleteEntityExecutor<string, AMSEvent> executor = new AMSDeleteEntityExecutor<string, AMSEvent>(
                    id,
                    key => AMSEventSqlAdapter.Instance.DeleteByID(key),
                    AMSOperationType.DeleteEvent);

                executor.Execute();
            }

            this.InnerRefreshList();
        }
コード例 #3
0
        public void DeleteEventExecutor()
        {
            AMSEventSqlAdapter.Instance.ClearAll();

            AMSChannel channel = DataHelper.PrepareChannelData();

            AMSEvent eventData = DataHelper.PrepareEventData(channel.ID);

            AMSEditEntityExecutor <AMSEvent> executor = new AMSEditEntityExecutor <AMSEvent>(eventData,
                                                                                             data => AMSEventSqlAdapter.Instance.Update(data), AMSOperationType.EditEvent);

            executor.Execute();

            AMSEvent eventLoaded = AMSEventSqlAdapter.Instance.LoadByChannelID(channel.ID).SingleOrDefault();

            Assert.IsNotNull(eventLoaded);

            AMSDeleteEntityExecutor <string, AMSEvent> deleteExecutor = new AMSDeleteEntityExecutor <string, AMSEvent>(eventData.ID,
                                                                                                                       key => AMSEventSqlAdapter.Instance.Delete(builder => builder.AppendItem("ID", key)), AMSOperationType.DeleteEvent);

            deleteExecutor.Execute();

            Assert.IsFalse(AMSEventSqlAdapter.Instance.Exists(builder => builder.AppendItem("ID", eventData.ID)));
        }
コード例 #4
0
ファイル: AMSExecutorTest.cs プロジェクト: zhshen/HuaweiAMS
        public void DeleteEventExecutor()
        {
            AMSEventSqlAdapter.Instance.ClearAll();

            AMSChannel channel = DataHelper.PrepareChannelData();

            AMSEvent eventData = DataHelper.PrepareEventData(channel.ID);

            AMSEditEntityExecutor<AMSEvent> executor = new AMSEditEntityExecutor<AMSEvent>(eventData,
                data => AMSEventSqlAdapter.Instance.Update(data), AMSOperationType.EditEvent);

            executor.Execute();

            AMSEvent eventLoaded = AMSEventSqlAdapter.Instance.LoadByChannelID(channel.ID).SingleOrDefault();

            Assert.IsNotNull(eventLoaded);

            AMSDeleteEntityExecutor<string, AMSEvent> deleteExecutor = new AMSDeleteEntityExecutor<string, AMSEvent>(eventData.ID,
                key => AMSEventSqlAdapter.Instance.Delete(builder => builder.AppendItem("ID", key)), AMSOperationType.DeleteEvent);

            deleteExecutor.Execute();

            Assert.IsFalse(AMSEventSqlAdapter.Instance.Exists(builder => builder.AppendItem("ID", eventData.ID)));
        }