public override void Insert(System.Data.IDbConnection connection, object instance)
        {
            var request = (DataProviderTransaction) instance;
            var sql = GenerateInsertStatement();
            var values = new
            {
                Id = request.Transaction.Id,
                StreamId = request.Transaction.StreamId,
                Date = request.Transaction.Date,
                RequestId = request.Transaction.ParentRequest.Id,
                DataProvider = request.Transaction.DataProvider.Id,
                DataProviderName = request.Transaction.DataProvider.Name,
                ConnectionType = request.Transaction.ConnectionType.Type,
                Connection = request.Transaction.ConnectionType.Connection,
                Action = request.Transaction.Action.Name,
                State = request.Transaction.State.Name,
                StateId = request.Transaction.State.Id,
                CostPrice = request.Transaction.DataProvider.CostPrice,
                RecommendedPrice = request.Transaction.DataProvider.RecommendedPrice,
                BillableForNoRecordState = request.Transaction.BillNoRecords.Name,
                BillableForNoRecordStateId = request.Transaction.BillNoRecords.Id
            };

            connection.Execute(sql, values);

        }
        public override void Insert(System.Data.IDbConnection connection, object instance)
        {
            var request = instance as MonitoringApiRequest;
            var sql = GenerateInsertStatement();
            var values = new
            {
                RequestId = request.Request.RequestId,
                RequestDate = request.Request.RequestDate,
                UserHostAddress = request.Request.UserHostAddress,
                Authorization = request.Request.Header.Authorization,
                UserName = request.Request.UserName,
                Method = request.Request.Method,
                BasePath = request.Request.Url.BasePath,
                HostName = request.Request.Url.HostName,
                IsSecure = request.Request.Url.IsSecure,
                Port = request.Request.Url.Port,
                Query = request.Request.Url.Query,
                SiteBase = request.Request.Url.SiteBase,
                Scheme = request.Request.Url.Scheme,
                Host = request.Request.Header.Host,
                UserAgent = request.Request.Header.UserAgent,
                ContentType = request.Request.Header.ContentType,
                JsonRequest = request.Request.JsonRequest
            };

            connection.Execute(sql, values);
        }
Example #3
0
        public static void ExecuteRuleSet(System.Workflow.Activities.Rules.RuleSet ruleSet, object thisObject)
        {
            System.Workflow.Activities.Rules.RuleValidation validation = new System.Workflow.Activities.Rules.RuleValidation(thisObject.GetType(), null);
            ruleSet.Validate(validation);

            System.Workflow.ComponentModel.Compiler.ValidationErrorCollection errors = validation.Errors;
            if (errors.Count > 0)
            {
                System.Windows.MessageBox.Show("There were Errors in the validation");
            }

            System.Workflow.Activities.Rules.RuleExecution execution = new System.Workflow.Activities.Rules.RuleExecution(validation, thisObject);
            ruleSet.Execute(execution);
        }
        public override void Insert(System.Data.IDbConnection connection, object instance)
        {
            var command = instance as DataProviderEvent;
            var sql = GenerateInsertStatement();

            var values = new
            {
                Id = command.Command.Id,
                CommitSequence = command.Command.Payload.CommitSequence,
                Payload = command.Command.Payload.Payload,
                DataProvider = command.Command.Payload.DataProvider,
                DataProviderId = command.Command.Payload.DataProviderId,
                CommandType = command.Command.Payload.CommandType,
                CommandTypeId = command.Command.Payload.CommandTypeId,
                Type = command.Command.Payload.TypeStringValue
            };
            connection.Execute(sql, values);
        }
Example #5
0
			public PinnedRepoElement(CodeFramework.Core.Data.PinnedRepository pinnedRepo, System.Windows.Input.ICommand command)
				: base(pinnedRepo.Name, () => command.Execute(new RepositoryIdentifier { Owner = pinnedRepo.Owner, Name = pinnedRepo.Name }), Images.Repo)
			{
				PinnedRepo = pinnedRepo;

                // BUG FIX: App keeps getting relocated so the URLs become off
                if (PinnedRepo.ImageUri.EndsWith("repository.png", System.StringComparison.Ordinal))
                {
                    Image = UIImage.FromFile("Images/repository.png");
                }
                else if (PinnedRepo.ImageUri.EndsWith("repository_fork.png", System.StringComparison.Ordinal))
                {
                    Image = UIImage.FromFile("Images/repository_fork.png");
                }
                else
                {
                    ImageUri = new System.Uri(PinnedRepo.ImageUri);
                }
			}
Example #6
0
 public PinnedRepoElement(CodeFramework.Core.Data.PinnedRepository pinnedRepo, System.Windows.Input.ICommand command)
     : base(pinnedRepo.Name, () => command.Execute(new CodeHub.Core.Utils.RepositoryIdentifier { Owner = pinnedRepo.Owner, Name = pinnedRepo.Name }), Images.Repo)
 {
     PinnedRepo = pinnedRepo;
     ImageUri = new System.Uri(PinnedRepo.ImageUri);
 }
Example #7
0
		private void SafelyExecute(System.Windows.Input.ICommand command)
		{
			if (command.CanExecute(null))
				command.Execute(null);
		}
Example #8
0
        static void Insert(System.Data.OleDb.OleDbConnection cn, System.Data.IDbTransaction tr = null)
        {
            var sql = @"INSERT INTO Item(ItemName) VALUES(@ItemName)";
            var count = cn.Execute(sql, new { ItemName = DateTime.Now.Millisecond.ToString() }, transaction: tr);

            Console.WriteLine(count.ToString());
        }
Example #9
0
        static void GetIdentityWithDapper(System.Data.OleDb.OleDbConnection cn)
        {
            //  2回回しても問題なく動作する
            for (int i = 0; i < 2; i++)
            {
                var sql = "INSERT INTO Item(ItemName) VALUES (@ItemName)";
                cn.Execute(sql, new { ItemName = "秋映" });

                var id = (int)cn.Query("SELECT @@IDENTITY as ID").First().ID;
                Console.WriteLine("@@IDENTITY -> " + id.ToString());

                var results = cn.Query<Item>("SELECT * FROM Item WHERE ID = @Id", new { @Id = id });
                Console.WriteLine(results.First().ID + ":" + results.First().ItemName);
            }
        }
Example #10
0
        static void Update(System.Data.OleDb.OleDbConnection cn, System.Data.IDbTransaction tr = null)
        {
            var sql = @"UPDATE Item SET ItemName = 'シナノゴールド' WHERE ID = @Id";
            var count = cn.Execute(sql, new { Id = 1 }, transaction: tr);

            Console.WriteLine(count.ToString());
        }