Beispiel #1
0
        public void SyncLeave(Guid leaveId)
        {
            var leave = EventStore.Get(leaveId);

            using (var conn = ReadModelDbContext.GetConnection())
            {
                conn.Execute(@"
					begin tran
					delete LeaveReadModel where Id = @Id
					insert into 
					LeaveReadModel(Id, Applicant, Evaluator, StartDate, EndDate, ApplicantComment, EvaluatorComment, Reason, Status, AppliedOn, EvaluatedOn, WorkingDays) 
					values(@Id, @Applicant, @Evaluator, @StartDate, @EndDate, @ApplicantComment, @EvaluatorComment, @Reason, @Status, @AppliedOn, @EvaluatedOn, @WorkingDays) 
					commit tran
				"                , leave);
            }
        }
Beispiel #2
0
        public void Init()
        {
            using (var conn = ReadModelDbContext.GetConnection())
                conn.Execute(@"
					if not exists (select * from sys.tables where name='leaveReadModel')
					begin
					create table leaveReadModel (
						Id uniqueidentifier  primary key,
						Applicant varchar(200),
						Evaluator varchar(200),
						StartDate datetime2,
						EndDate datetime2,
						Reason int,
						Status int,
						AppliedOn datetime2,
						EvaluatedOn datetime2,
						ApplicantComment varchar(1024),
						EvaluatorComment varchar(1024),
						WorkingDays int
					)
					end
				"                );
        }