Ejemplo n.º 1
0
        protected override void ProcessRecord()
        {
            if (ShouldProcess("Report Activity", "Get-GRepActivity"))
            {
                string _dateStartString = string.Empty;
                string _dateEndString   = string.Empty;

                switch (ParameterSetName)
                {
                case "string":
                    _dateStartString = StartTime;
                    _dateEndString   = EndTime;
                    break;

                case "datetime":
                    _dateStartString = StartDateTime.HasValue ?
                                       XmlConvert.ToString(StartDateTime.Value, XmlDateTimeSerializationMode.Local) : null;

                    _dateEndString = EndDateTime.HasValue ?
                                     XmlConvert.ToString(EndDateTime.Value, XmlDateTimeSerializationMode.Local) : null;
                    break;
                }

                var properties = new dotNet.Reports.Activities.ActivitiesListProperties()
                {
                    StartTime      = _dateStartString,
                    EndTime        = _dateEndString,
                    CustomerId     = CustomerId,
                    ActorIpAddress = ActorIpAddress,
                    EventName      = EventName,
                    Filters        = Filters
                };

                if (MaxResults.HasValue)
                {
                    properties.TotalResults = MaxResults.Value;
                }

                //Allow for the use of 'all'
                string _userKey = (UserKey == "all") ? "all" : GetFullEmailAddress(UserKey, authUserInfo);

                WriteObject(activities.List(_userKey, ApplicationName.ToString(), properties, StandardQueryParams: StandardQueryParams).SelectMany(x => x.Items).ToList());
            }
        }
Ejemplo n.º 2
0
        protected override void ProcessRecord()
        {
            if (ShouldProcess("User Usage Report", "Get-GAUser"))
            {
                if (ParameterSetName == "Params")
                {
                    var body = new Data.Channel()
                    {
                        Id      = Id,
                        Token   = Token,
                        Type    = Type,
                        Address = Address
                    };

                    if (Expiration.HasValue)
                    {
                        body.Expiration = Expiration.Value;
                    }

                    if (Payload.HasValue)
                    {
                        body.Payload = Payload.Value;
                    }

                    if (!string.IsNullOrWhiteSpace(Ttl))
                    {
                        body.Params__        = new Dictionary <string, string>();
                        body.Params__["ttl"] = Ttl;
                    }
                    WriteObject(activities.Watch(body, GetFullEmailAddress(UserKey, authUserInfo), ApplicationName.ToString(), StandardQueryParams: StandardQueryParams));
                }
                else
                {
                    WriteObject(activities.Watch(ChannelBody, GetFullEmailAddress(UserKey, authUserInfo), ApplicationName.ToString(), StandardQueryParams: StandardQueryParams));
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Method to translate <see cref="ApplicationName"/>.
 /// </summary>
 /// <param name="name"><see cref="ApplicationName"/>.</param>
 /// <returns>Translated <see cref="ApplicationName"/>.</returns>
 public string Translate(ApplicationName name)
 {
     return(Translate(name.ToString()));
 }
 /// <summary>
 /// Returns the JSON representation of the object.
 /// </summary>
 /// <param name="writer">The <see cref="T: Newtonsoft.Json.JsonWriter" /> to write to.</param>
 /// <param name="value">The object to serialize to JSON.</param>
 public static void Serialize(JsonWriter writer, ApplicationName value)
 {
     writer.WriteValue(value.ToString());
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 設置Application
 /// </summary>
 private static void Set(ApplicationName name, object value)
 {
     HttpContext.Current.Application.Lock();
     HttpContext.Current.Application[name.ToString()] = value;
     HttpContext.Current.Application.UnLock();
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 取得Application
 /// </summary>
 private static object Get(ApplicationName name)
 {
     return(HttpContext.Current.Application[name.ToString()]);
 }