protected override void Invoke() { DateTime startDate = DateTime.Parse(this.Cmdlet.StartDate); DateTime endDate = EndDateTools.GetEndDate(startDate, this.Cmdlet.EndDate, this.Cmdlet.Duration); AddNewEvent(this.Cmdlet.Add, startDate, endDate, this.Cmdlet.Type); }
private void ChangeItem() { DateTime startDate = this.Cmdlet.StartDate == null ? DateTime.MinValue : DateTime.Parse(this.Cmdlet.StartDate); DateTime endDate = DateTime.MinValue; string endDateStr = this.Cmdlet.EndDate; string durationStr = this.Cmdlet.Duration; //if (endDateStr.NotEmpty() || durationStr.NotEmpty()) //{ // endDate = EndDateTools.GetEndDate(startDate, endDateStr, durationStr); //} // if (startDate!=DateTime.MinValue && endDate==DateTime.MinValue) { endDate = EndDateTools.GetEndDate(startDate, endDateStr, durationStr); } var @event = new Event { NiceId = this.Cmdlet.Change.Value, StartDate = startDate, EndDate = endDate, Name = this.Cmdlet.Add, Type = this.Cmdlet.Type }; InvokeCall(() => Client.ChangeEvent(@event)); }