示例#1
0
        public void SendBatch(object[] content, IdGeneration id = IdGeneration.Default)
        {
            if (content.Length == 0)
                return;

            InnerSendBatch(cb => { }, content, id);
        }
示例#2
0
        private void dataGridViewSprints_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e)
        {
            DataGridViewRow lastRow = null;

            if (e.Row.DataGridView.Rows.Count > 1)
            {
                lastRow = e.Row.DataGridView.Rows[e.Row.Index - 1];
            }
            e.Row.Cells[pIdDataGridViewTextBoxColumn.Name].Value = Guid.NewGuid();

            if (lastRow != null)
            {
                DateTime newStartDate = (DateTime)lastRow.Cells[endDateDataGridViewTextBoxColumn.Name].Value;
                newStartDate = newStartDate.AddDays(1);
                if (newStartDate.DayOfWeek == DayOfWeek.Saturday || newStartDate.DayOfWeek == DayOfWeek.Sunday)
                {
                    do
                    {
                        newStartDate = newStartDate.AddDays(1);
                    } while (newStartDate.DayOfWeek == DayOfWeek.Saturday || newStartDate.DayOfWeek == DayOfWeek.Sunday);
                }
                e.Row.Cells[startDateDataGridViewTextBoxColumn.Name].Value = newStartDate;
                e.Row.Cells[endDateDataGridViewTextBoxColumn.Name].Value   = newStartDate.AddDays(14);
                e.Row.Cells[idDataGridViewTextBoxColumn.Name].Value        = IdGeneration.NextAutoincrementValue(lastRow.Cells[idDataGridViewTextBoxColumn.Name].Value.ToString());
            }
        }
示例#3
0
        public void SendBatch(object[] content, IdGeneration id = IdGeneration.Default)
        {
            if (content.Length == 0)
            {
                return;
            }

            InnerSendBatch(cb => { }, content, id);
        }
示例#4
0
        private void dataGridViewProjects_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e)
        {
            DataGridViewRow lastRow = null;

            if (e.Row.DataGridView.Rows.Count > 1)
            {
                lastRow = e.Row.DataGridView.Rows[e.Row.Index - 1];
            }
            e.Row.Cells[pIdDataGridViewTextBoxColumn.Name].Value = Guid.NewGuid();

            if (lastRow != null)
            {
                e.Row.Cells[idDataGridViewTextBoxColumn.Name].Value = IdGeneration.NextAutoincrementValue(lastRow.Cells[idDataGridViewTextBoxColumn.Name].Value.ToString());
            }
        }
示例#5
0
        void InnerSendBatch(Action <EnvelopeBuilder> configure, object[] messageItems,
                            IdGeneration id = IdGeneration.Default)
        {
            string envelopeId;

            switch (id)
            {
            case IdGeneration.Default:
                envelopeId = _idGenerator();
                break;

            case IdGeneration.HashContent:
                envelopeId = HashContents(configure, messageItems);
                break;

            default:
                throw new ArgumentOutOfRangeException("id");
            }

            var builder = new EnvelopeBuilder(envelopeId);

            foreach (var item in messageItems)
            {
                builder.AddItem(item);
            }
            configure(builder);
            var envelope = builder.Build();


            var data = _streamer.SaveEnvelopeData(envelope);

            var queue = GetOutboundQueue();

            queue.PutMessage(data);

            SystemObserver.Notify(new EnvelopeSent(queue.Name, envelope.EnvelopeId,
                                                   envelope.Items.Select(x => x.MappedType.Name).ToArray(), envelope.GetAllAttributes()));
        }
示例#6
0
        void InnerSendBatch(Action<EnvelopeBuilder> configure, object[] messageItems,
            IdGeneration id = IdGeneration.Default)
        {
            string envelopeId;

            switch (id)
            {
                case IdGeneration.Default:
                    envelopeId = _idGenerator();
                    break;
                case IdGeneration.HashContent:
                    envelopeId = HashContents(configure, messageItems);
                    break;
                default:
                    throw new ArgumentOutOfRangeException("id");
            }

            var builder = new EnvelopeBuilder(envelopeId);
            foreach (var item in messageItems)
            {
                builder.AddItem(item);
            }
            configure(builder);
            var envelope = builder.Build();

            var data = _streamer.SaveEnvelopeData(envelope);

            var queue = GetOutboundQueue();
            queue.PutMessage(data);

            SystemObserver.Notify(new EnvelopeSent(queue.Name, envelope.EnvelopeId,
                envelope.Items.Select(x => x.MappedType.Name).ToArray(), envelope.GetAllAttributes()));
        }