Ejemplo n.º 1
0
        /// <summary>
        ///     Used internally to initialize the properties of this class.
        /// </summary>
        public MessageResponse(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "clientreference":
                    _clientReference = Convert.ToString(jso[key]);
                    break;

                case "detail":
                    // ???
                    _detail = null;     // Suppress compiler warning.
                    break;

                case "messageid":
                    _messageId = new Guid(Convert.ToString(jso[key]));
                    break;

                case "networkid":
                    _networkId = Convert.ToString(jso[key]);
                    break;

                case "rate":
                    _rate = Convert.ToDouble(jso[key]);
                    break;

                case "status":
                    _status = Convert.ToInt32(jso[key]);
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Action" /> class.
        /// </summary>
        public Action(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "actionmeta":
                    _actionMeta = Convert.ToString(jso[key]);
                    break;

                case "actiontypeid":
                    _actionTypeId = Convert.ToInt64(jso[key]);
                    break;

                case "campaignid":
                    _campaignId = Convert.ToInt64(jso[key]);
                    break;

                case "id":
                    _id = Convert.ToInt64(jso[key]);
                    break;

                case "isactive":
                    _isActive = Convert.ToBoolean(jso[key]);
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        public TicketResponse(ApiDictionary json) : this()
        {
            foreach (string key in json.Keys)
            {
                switch (key.ToLower())
                {
                case "id":
                    _id = Convert.ToInt64(json[key]);
                    break;

                case "time":
                    DateTime timeParsed;
                    if (json[key].ToString() != "")
                    {
                        Time = DateTime.TryParseExact(json[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out timeParsed)
                                ? timeParsed
                                : (DateTime?)null;
                    }
                    break;

                case "content":
                    Content = Convert.ToString(json[key]);
                    break;

                case "attachment":
                    _attachment = Convert.ToString(json[key]);
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Used internally to initialize the properties of this class.
        /// </summary>
        public ServiceType(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "descriptor":
                    _descriptor = Convert.ToString(jso[key]);
                    break;

                case "iscreditbased":
                    _isCreditBased = Convert.ToBoolean(jso[key]);
                    break;

                case "isprepaid":
                    _isPrepaid = Convert.ToBoolean(jso[key]);
                    break;

                case "name":
                    _name = Convert.ToString(jso[key]);
                    break;

                case "rate":
                    _rate = Convert.ToDouble(jso[key]);
                    break;

                case "requiresactivation":
                    _requiresActivation = Convert.ToBoolean(jso[key]);
                    break;
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Used internally to initialize the properties of this class.
        /// </summary>
        public MessageTemplate(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "accountid":
                    AccountId = Convert.ToString(jso[key]);
                    break;

                case "datecreated":
                    DateTime dateCreated;
                    if (jso[key].ToString() != "")
                    {
                        _dateCreated = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateCreated)
                                ? dateCreated
                                : (DateTime?)null;
                    }
                    break;

                case "id":
                    Id = Convert.ToInt64(jso[key]);
                    break;

                case "name":
                    Name = Convert.ToString(jso[key]);
                    break;

                case "text":
                    Text = Convert.ToString(jso[key]);
                    break;
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        ///     Used internally to initialize the properties of this class.
        /// </summary>
        public Settings(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "accountid":
                    _accountId = Convert.ToString(jso[key]);
                    break;

                case "countrycode":
                    CountryCode = Convert.ToString(jso[key]);
                    break;

                case "deliveryreportnotificationurl":
                    DeliveryReportNotificationUrl = Convert.ToString(jso[key]);
                    break;

                case "emaildailysummary":
                    EmailDailySummary = Convert.ToBoolean(jso[key]);
                    break;

                case "emailinvoicereminders":
                    EmailInvoiceReminders = Convert.ToBoolean(jso[key]);
                    break;

                case "emailmaintenance":
                    EmailMaintenance = Convert.ToBoolean(jso[key]);
                    break;

                case "emailnewinvoice":
                    EmailNewInvoice = Convert.ToBoolean(jso[key]);
                    break;

                case "smsfortnightbalance":
                    SmsFortnightBalance = Convert.ToBoolean(jso[key]);
                    break;

                case "smslowbalancenotification":
                    SmsLowBalanceNotification = Convert.ToBoolean(jso[key]);
                    break;

                case "smsmaintenance":
                    SmsMaintenance = Convert.ToBoolean(jso[key]);
                    break;

                case "smspromotionalmessages":
                    SmsPromotionalMessages = Convert.ToBoolean(jso[key]);
                    break;

                case "smstopupnotification":
                    SmsTopUpNotification = Convert.ToBoolean(jso[key]);
                    break;

                case "timezone":
                    TimeZone = Convert.ToString(jso[key]);
                    break;
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        ///     Used internally to initialize this API number plan item.
        /// </summary>
        public NumberPlanItem(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "id":
                    _id = Convert.ToInt64(jso[key]);
                    break;

                case "network":
                    _network = Convert.ToString(jso[key]);
                    break;

                case "payout":
                    _payout = Convert.ToDouble(jso[key]);
                    break;

                case "reversepayout":
                    _reversePayout = Convert.ToDouble(jso[key]);
                    break;

                case "shortcode":
                    _shortCode = Convert.ToString(jso[key]);
                    break;
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        ///     Used internally to initialize the properties of this class.
        /// </summary>
        public Invoice(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "amount":
                    _amount = Convert.ToDouble(jso[key]);
                    break;

                case "created":
                    DateTime dateCreated;
                    if (jso[key].ToString() != "")
                    {
                        _created = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateCreated)
                                ? dateCreated
                                : (DateTime?)null;
                    }

                    break;

                case "description":
                    _description = Convert.ToString(jso[key]);
                    break;

                case "duedate":
                    if (jso[key].ToString() != "")
                    {
                        _dueDate = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateCreated)
                                ? dateCreated
                                : (DateTime?)null;
                    }

                    break;

                case "ending":
                    _ending = Convert.ToDouble(jso[key]);
                    break;

                case "id":
                    _id = Convert.ToInt64(jso[key]);
                    break;

                case "ispaid":
                    _isPaid = Convert.ToBoolean(jso[key]);
                    break;

                case "type":
                    _type = Convert.ToString(jso[key]);
                    break;
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        ///     Used internally to initialize the instance of this class.
        /// </summary>
        public Contact(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "contactid":
                    _contactId = Convert.ToInt64(jso[key]);
                    break;

                case "custom1":
                    Custom1 = Convert.ToString(jso[key]);
                    break;

                case "custom2":
                    Custom2 = Convert.ToString(jso[key]);
                    break;

                case "custom3":
                    Custom3 = Convert.ToString(jso[key]);
                    break;

                case "firstname":
                    FirstName = Convert.ToString(jso[key]);
                    break;

                case "groupid":
                    GroupId = Convert.ToInt64(jso[key]);
                    break;

                case "groupname":
                    _groupName = Convert.ToString(jso[key]);
                    break;

                case "mobilenumber":
                    MobileNumber = Convert.ToString(jso[key]);
                    break;

                case "owner":
                    _owner = Convert.ToString(jso[key]);
                    break;

                case "surname":
                    Surname = Convert.ToString(jso[key]);
                    break;

                case "title":
                    Title = Convert.ToString(jso[key]);
                    break;
                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        ///     Used internally to initialize the properties of this class.
        /// </summary>
        public MoKeyWord(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "alias1":
                    Alias1 = Convert.ToString(jso[key]);
                    break;

                case "alias2":
                    Alias2 = Convert.ToString(jso[key]);
                    break;

                case "alias3":
                    Alias3 = Convert.ToString(jso[key]);
                    break;

                case "alias4":
                    Alias4 = Convert.ToString(jso[key]);
                    break;

                case "alias5":
                    Alias5 = Convert.ToString(jso[key]);
                    break;

                case "id":
                    _id = Convert.ToInt64(jso[key]);
                    break;

                case "isactive":
                    _isActive = Convert.ToBoolean(jso[key]);
                    break;

                case "isdefault":
                    _isDefault = Convert.ToBoolean(jso[key]);
                    break;

                case "keyword":
                    Keyword = Convert.ToString(jso[key]);
                    break;

                case "numberplanid":
                    NumberPlanId = Convert.ToInt64(jso[key]);
                    break;
                }
            }
        }
Ejemplo n.º 11
0
        public ContentLibrary(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "libraryid":
                    _libraryId = new Guid(Convert.ToString(jso[key]));
                    break;

                case "accountid":
                    _accountId = Convert.ToString(jso[key]);
                    break;

                case "name":
                    Name = Convert.ToString(jso[key]);
                    break;

                case "shortname":
                    ShortName = Convert.ToString(jso[key]);
                    break;

                case "datecreated":
                    DateTime dateCreated;
                    if (jso[key].ToString() != "")
                    {
                        DateCreated = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateCreated)
                                ? dateCreated
                                : (DateTime?)null;
                    }
                    break;

                case "datemodified":
                    DateTime dateModified;
                    if (jso[key].ToString() != "")
                    {
                        DateModified = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateModified)
                                ? dateModified
                                : (DateTime?)null;
                    }
                    break;

                case "folderid":
                    _folderId = Convert.ToInt64(jso[key]);
                    break;
                }
            }
        }
Ejemplo n.º 12
0
        public Topup(ApiDictionary dix)
        {
            foreach (string key in dix.Keys)
            {
                switch (key.ToLower())
                {
                case "purchasedcredit":
                    PurchasedCredit = Convert.ToInt64(dix[key]);
                    break;

                case "actualcredit":
                    ActualCredit = Convert.ToDouble(dix[key]);
                    break;
                }
            }
        }
Ejemplo n.º 13
0
        public Tag(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "key":
                    Key = Convert.ToString(jso[key]);
                    break;

                case "value":
                    Value = Convert.ToString(jso[key]);
                    break;
                }
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        ///     Used internally to initialize the properties of this class.
        /// </summary>
        public Sender(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "accountid":
                    AccountId = Convert.ToString(jso[key]);
                    break;

                case "address":
                    Address = Convert.ToString(jso[key]);
                    break;

                case "id":
                    Id = Convert.ToInt64(jso[key]);
                    break;

                case "isdeleted":
                    _isDeleted = Convert.ToBoolean(jso[key]);
                    break;

                case "timeadded":
                    DateTime dateCreated;
                    if (jso[key].ToString() != "")
                    {
                        _timeAdded = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateCreated)
                                ? dateCreated
                                : (DateTime?)null;
                    }
                    break;

                case "timedeleted":
                    DateTime td;
                    if (jso[key].ToString() != "")
                    {
                        _timeDeleted = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out td) ? td : (DateTime?)null;
                    }
                    break;
                }
            }
        }
Ejemplo n.º 15
0
        public TopupLocation(ApiDictionary dix)
        {
            foreach (string key in dix.Keys)
            {
                switch (key.ToLower())
                {
                case "id":
                    Id = Convert.ToInt64(dix[key]);
                    break;

                case "city":
                    City = Convert.ToString(dix[key]);
                    break;

                case "area":
                    Area = Convert.ToString(dix[key]);
                    break;

                case "region":
                    Region = Convert.ToString(dix[key]);
                    break;

                case "details":
                    Details = Convert.ToString(dix[key]);
                    break;

                case "description":
                    Description = Convert.ToString(dix[key]);
                    break;

                case "latitude":
                    Latitude = Convert.ToDouble(dix[key]);
                    break;

                case "longitude":
                    Longitute = Convert.ToDouble(dix[key]);
                    break;
                }
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        ///     Used internally to initialize the properties of this class.
        /// </summary>
        public ContactGroup(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "accountid":
                    _accountId = Convert.ToString(jso[key]);
                    break;

                case "contactcount":
                    _contactCount = Convert.ToInt64(jso[key]);
                    break;

                case "groupid":
                    _groupId = Convert.ToInt64(jso[key]);
                    break;

                case "name":
                    Name = Convert.ToString(jso[key]);
                    break;
                }
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        ///     Used internally to initialize the properties of this class.
        /// </summary>
        public ApiList(ApiDictionary jso)
        {
            _items = new List <T>();
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "count":
                    _count = Convert.ToInt64(jso[key]);
                    break;

                case "totalpages":
                    _totalPages = Convert.ToInt64(jso[key]);
                    break;

                case "actionlist":
                    var apiArray = jso[key] as IEnumerable;
                    if (apiArray != null)
                    {
                        foreach (JObject o in apiArray)
                        {
                            _items.Add((T)Convert.ChangeType(new Action(o.ToObject <ApiDictionary>()), typeof(T)));
                        }
                    }
                    break;

                case "campaignlist":
                    var array = jso[key] as IEnumerable;
                    if (array != null)
                    {
                        foreach (JObject o in array)
                        {
                            _items.Add((T)Convert.ChangeType(new Campaign(o.ToObject <ApiDictionary>()), typeof(T)));
                        }
                    }
                    break;

                case "libraries":
                    var os = jso[key] as IEnumerable;
                    if (os != null)
                    {
                        foreach (JObject o in os)
                        {
                            _items.Add((T)Convert.ChangeType(new ContentLibrary(o.ToObject <ApiDictionary>()), typeof(T)));
                        }
                    }
                    break;

                case "contactlist":
                    var apiArray1 = jso[key] as IEnumerable;
                    if (apiArray1 != null)
                    {
                        foreach (JObject o in apiArray1)
                        {
                            _items.Add((T)Convert.ChangeType(new Contact(o.ToObject <ApiDictionary>()), typeof(T)));
                        }
                    }
                    break;

                case "grouplist":
                    var array1 = jso[key] as IEnumerable;
                    if (array1 != null)
                    {
                        foreach (JObject o in array1)
                        {
                            _items.Add((T)Convert.ChangeType(new ContactGroup(o.ToObject <ApiDictionary>()), typeof(T)));
                        }
                    }
                    break;

                case "invoicestatementlist":
                    var os1 = jso[key] as IEnumerable;
                    if (os1 != null)
                    {
                        foreach (JObject o in os1)
                        {
                            _items.Add((T)Convert.ChangeType(new Invoice(o.ToObject <ApiDictionary>()), typeof(T)));
                        }
                    }
                    break;

                case "messages":
                    var apiArray2 = jso[key] as IEnumerable;
                    if (apiArray2 != null)
                    {
                        foreach (JObject o in apiArray2)
                        {
                            _items.Add((T)Convert.ChangeType(new Message(o.ToObject <ApiDictionary>()), typeof(T)));
                        }
                    }
                    break;

                case "messagetemplatelist":
                    var array2 = jso[key] as IEnumerable;
                    if (array2 != null)
                    {
                        foreach (JObject o in array2)
                        {
                            _items.Add((T)Convert.ChangeType(new MessageTemplate(o.ToObject <ApiDictionary>()), typeof(T)));
                        }
                    }
                    break;

                case "mokeywordlist":
                    var os2 = jso[key] as IEnumerable;
                    if (os2 != null)
                    {
                        foreach (JObject o in os2)
                        {
                            _items.Add((T)Convert.ChangeType(new MoKeyWord(o.ToObject <ApiDictionary>()), typeof(T)));
                        }
                    }
                    break;

                case "numberplanlist":
                    var apiArray3 = jso[key] as IEnumerable;
                    if (apiArray3 != null)
                    {
                        foreach (JObject o in apiArray3)
                        {
                            _items.Add((T)Convert.ChangeType(new NumberPlan(o.ToObject <ApiDictionary>()), typeof(T)));
                        }
                    }
                    break;

                case "senderaddresseslist":
                    var array3 = jso[key] as IEnumerable;
                    if (array3 != null)
                    {
                        foreach (JObject o in array3)
                        {
                            _items.Add((T)Convert.ChangeType(new Sender(o.ToObject <ApiDictionary>()), typeof(T)));
                        }
                    }
                    break;

                case "ticketlist":
                    var array4 = jso[key] as IEnumerable;
                    if (array4 != null)
                    {
                        foreach (JObject o in array4)
                        {
                            _items.Add((T)Convert.ChangeType(new Ticket(o.ToObject <ApiDictionary>()), typeof(T)));
                        }
                    }
                    break;

                case "servicelist":
                    var os3 = jso[key] as IEnumerable;
                    if (os3 != null)
                    {
                        foreach (JObject o in os3)
                        {
                            var d = o.ToObject <ApiDictionary>();
                            _items.Add((T)Convert.ChangeType(new Service(d), typeof(T)));
                        }
                    }
                    break;

                case "folders":
                    var arr = jso[key] as IEnumerable;
                    if (arr != null)
                    {
                        foreach (JObject o in arr)
                        {
                            _items.Add((T)Convert.ChangeType(new ContentFolder(o.ToObject <ApiDictionary>()), typeof(T)));
                        }
                    }
                    break;

                case "medias":
                    var arr1 = jso[key] as IEnumerable;
                    if (arr1 != null)
                    {
                        foreach (JObject o in arr1)
                        {
                            _items.Add((T)Convert.ChangeType(new ContentMedia(o.ToObject <ApiDictionary>()), typeof(T)));
                        }
                    }
                    break;
                }
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="ChildAccount" /> class.
        /// </summary>
        public ChildAccount(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "accountnumber":
                    _accountNumber = Convert.ToInt64(jso[key]);
                    break;

                case "balance":
                    _balance = Convert.ToDouble(jso[key]);
                    break;

                case "canimpersonate":
                    _canImpersonate = Convert.ToBoolean(jso[key]);
                    break;

                case "child":
                    _child = Convert.ToString(jso[key]);
                    break;

                case "credit":
                    _credit = Convert.ToDouble(jso[key]);
                    break;

                case "id":
                    _id = Convert.ToInt64(jso[key]);
                    break;

                case "parent":
                    _parent = Convert.ToString(jso[key]);
                    break;

                case "productid":
                    _productId = Convert.ToString(jso[key]);
                    break;

                case "productname":
                    _productName = Convert.ToString(jso[key]);
                    break;

                case "status":
                    _status = Convert.ToInt32(jso[key]);
                    break;

                case "timecreated":
                    DateTime dateCreated;
                    if (jso[key].ToString() != "")
                    {
                        _timeCreated = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateCreated)
                                ? dateCreated
                                : (DateTime?)null;
                    }

                    break;

                case "timeremoved":
                    DateTime tmr;
                    if (jso[key].ToString() != "")
                    {
                        _timeRemoved = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out tmr) ? tmr : (DateTime?)null;
                    }

                    break;
                }
            }
        }
Ejemplo n.º 19
0
        public ContentFolder(ApiDictionary jso)
        {
            _folders = new List <ContentFolder>();
            _medias  = new List <ContentMedia>();
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "contentfolderid":
                    _contentFolderId = Convert.ToInt64(jso[key]);
                    break;

                case "contentlibraryid":
                    ContentLibraryId = new Guid(Convert.ToString(jso[key]));
                    break;

                case "foldername":
                    FolderName = Convert.ToString(jso[key]);
                    break;

                case "absolutepath":
                    AbosultePath = Convert.ToString(jso[key]);
                    break;

                case "datecreated":
                    DateTime dateCreated;
                    if (jso[key].ToString() != "")
                    {
                        DateCreated = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateCreated)
                                ? dateCreated
                                : (DateTime?)null;
                    }
                    break;

                case "datemodified":
                    DateTime dateModified;
                    if (jso[key].ToString() != "")
                    {
                        DateModified = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateModified)
                                ? dateModified
                                : (DateTime?)null;
                    }
                    break;

                case "parentid":
                    ParentId = Convert.ToInt64(jso[key]);
                    break;

                case "subfoldercount":
                    _subFolderCount = Convert.ToInt64(jso[key]);
                    break;

                case "contentmediacount":
                    _contentMediaCount = Convert.ToInt64(jso[key]);
                    break;

                case "subfolders":
                    var subfolders = jso[key] as IEnumerable;
                    if (subfolders != null)
                    {
                        foreach (JObject mo in subfolders)
                        {
                            _folders.Add(new ContentFolder(mo.ToObject <ApiDictionary>()));
                        }
                    }
                    break;

                case "contentmedias":
                    var medias = jso[key] as IEnumerable;
                    if (medias != null)
                    {
                        foreach (JObject mo in medias)
                        {
                            _medias.Add(new ContentMedia(mo.ToObject <ApiDictionary>()));
                        }
                    }
                    break;
                }
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Campaign" />
        /// </summary>
        public Campaign(ApiDictionary jso)
        {
            _actions    = new List <Action>();
            _moKeywords = new List <MoKeyWord>();

            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "accountid":
                    _accountId = Convert.ToString(jso[key]);
                    break;

                case "actions":
                    var acs = jso[key] as IEnumerable;
                    if (acs != null)
                    {
                        foreach (JObject o in acs)
                        {
                            _actions.Add(new Action(o.ToObject <ApiDictionary>()));
                        }
                    }
                    break;

                case "brief":
                    Brief = Convert.ToString(jso[key]);
                    break;

                case "campaignid":
                    _campaignId = Convert.ToInt64(jso[key]);
                    break;

                case "datecreated":
                    DateTime dateCreated;

                    if (jso[key].ToString() != "")
                    {
                        DateCreated = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateCreated)
                                ? dateCreated
                                : (DateTime?)null;
                    }
                    break;

                case "dateended":
                    DateTime dateEnded;
                    if (jso[key].ToString() != "")
                    {
                        DateEnded = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateEnded)
                                ? dateEnded
                                : (DateTime?)null;
                    }
                    break;

                case "description":
                    Description = Convert.ToString(jso[key]);
                    break;

                case "enabled":
                    _enabled = Convert.ToBoolean(jso[key]);
                    break;

                case "isdefault":
                    _isDefault = Convert.ToBoolean(jso[key]);
                    break;

                case "mokeywords":
                    var mos = jso[key] as IEnumerable;
                    if (mos != null)
                    {
                        foreach (JObject mo in mos)
                        {
                            _moKeywords.Add(new MoKeyWord(mo.ToObject <ApiDictionary>()));
                        }
                    }
                    break;

                case "pendingapproval":
                    _pendingApproval = Convert.ToBoolean(jso[key]);
                    break;
                }
            }
        }
Ejemplo n.º 21
0
        public ContentMedia(ApiDictionary jso)
        {
            Tags = new List <Tag>();
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "id":
                    _id = new Guid(Convert.ToString(jso[key]));
                    break;

                case "accountid":
                    _accountId = Convert.ToString(jso[key]);
                    break;

                case "name":
                    Name = Convert.ToString(jso[key]);
                    break;

                case "libraryid":
                    LibraryId = new Guid(Convert.ToString(jso[key]));
                    break;

                case "locationpath":
                    LocationPath = Convert.ToString(jso[key]);
                    break;

                case "tags":
                    var tags = jso[key] as IEnumerable;
                    if (tags != null)
                    {
                        foreach (JObject mo in tags)
                        {
                            Tags.Add(new Tag(mo.ToObject <ApiDictionary>()));
                        }
                    }
                    break;

                case "type":
                    Type = Convert.ToString(jso[key]);
                    break;

                case "preference":
                    Preference = Convert.ToString(jso[key]);
                    break;

                case "drmprotect":
                    DrmProtect = Convert.ToBoolean(jso[key]);
                    break;

                case "encodingstatus":
                    EncodingStatus = Convert.ToString(jso[key]);
                    break;

                case "streamable":
                    Streamable = Convert.ToBoolean(jso[key]);
                    break;

                case "displaytext":
                    DisplayText = Convert.ToString(jso[key]);
                    break;

                case "contenttext":
                    ContentText = Convert.ToString(jso[key]);
                    break;

                case "approved":
                    Approved = Convert.ToBoolean(jso[key]);
                    break;

                case "deleted":
                    Deleted = Convert.ToBoolean(jso[key]);
                    break;

                case "datecreated":
                    DateTime dateCreated;
                    if (jso[key].ToString() != "")
                    {
                        DateCreated = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateCreated)
                                ? dateCreated
                                : (DateTime?)null;
                    }
                    break;

                case "datemodified":
                    DateTime dateModified;
                    if (jso[key].ToString() != "")
                    {
                        DateModified = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateModified)
                                ? dateModified
                                : (DateTime?)null;
                    }
                    break;

                case "datedeleted":
                    DateTime dateDeleted;
                    if (jso[key].ToString() != "")
                    {
                        DateDeleted = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateDeleted)
                                ? dateDeleted
                                : (DateTime?)null;
                    }
                    break;

                case "callbackurl":
                    CallbackUrl = Convert.ToString(jso[key]);
                    break;
                }
            }
        }
Ejemplo n.º 22
0
 public ApiDictionary(ApiDictionary apiDictionary) : base(apiDictionary, EqualityComparer <string> .Default)
 {
 }
Ejemplo n.º 23
0
        /// <summary>
        ///     Used internally to initialize the properties of this class.
        /// </summary>
        public Message(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "type":
                    Type = Convert.ToInt32(jso[key]);
                    break;

                case "clientreference":
                    ClientReference = Convert.ToString(jso[key]);
                    break;

                case "content":
                    Content = Convert.ToString(jso[key]);
                    break;

                case "direction":
                    _direction = Convert.ToString(jso[key]);
                    break;

                case "flashmessage":
                    FlashMessage = Convert.ToBoolean(jso[key]);
                    break;

                case "from":
                    From = Convert.ToString(jso[key]);
                    break;

                case "messageid":
                    _messageId = new Guid(Convert.ToString(jso[key]));
                    break;

                case "networkid":
                    _networkId = Convert.ToString(jso[key]);
                    break;

                case "rate":
                    _rate = Convert.ToDouble(jso[key]);
                    break;

                case "registereddelivery":
                    RegisteredDelivery = Convert.ToBoolean(jso[key]);
                    break;

                case "status":
                    _status = Convert.ToString(jso[key]);
                    break;

                case "time":
                    //Time = Convert.ToDateTime(jso[key]);
                    DateTime time;
                    if (jso[key].ToString() != "")
                    {
                        Time = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out time) ? time : (DateTime?)null;
                    }
                    break;

                case "to":
                    To = Convert.ToString(jso[key]);
                    break;

                case "udh":
                    Udh = Convert.ToString(jso[key]);
                    break;

                case "units":
                    _units = Convert.ToDouble(jso[key]);
                    break;

                case "updatetime":
                    //_updateTime = Convert.ToDateTime(jso[key]);

                    DateTime dateCreated;
                    if (jso[key].ToString() != "")
                    {
                        _updateTime = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateCreated)
                                ? dateCreated
                                : (DateTime?)null;
                    }

                    break;
                }
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        ///     Used internally to initialize a new instance of this class.
        /// </summary>
        public NumberPlan(ApiDictionary jso)
        {
            _moKeywords      = new List <MoKeyWord>();
            _numberPlanItems = new List <NumberPlanItem>();

            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "accountid":
                    AccountId = Convert.ToString(jso[key]);
                    break;

                case "dateactivated":
                    DateTime dateActivated;
                    if (jso[key].ToString() != "")
                    {
                        _dateActivated = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateActivated)
                                ? dateActivated
                                : (DateTime?)null;
                    }

                    break;

                case "datecreated":
                    DateTime dateCreated;
                    if (jso[key].ToString() != "")
                    {
                        _dateCreated = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateCreated)
                                ? dateCreated
                                : (DateTime?)null;
                    }
                    break;

                case "datedeactivated":
                    DateTime dateDeactivated;
                    if (jso[key].ToString() != "")
                    {
                        _dateDeactivated = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateDeactivated)
                                ? dateDeactivated
                                : (DateTime?)null;
                    }
                    break;

                case "dateexpiring":
                    DateTime dateExpiring;
                    if (jso[key].ToString() != "")
                    {
                        _dateExpiring = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateExpiring)
                                ? dateExpiring
                                : (DateTime?)null;
                    }
                    break;

                case "description":
                    Description = Convert.ToString(jso[key]);
                    break;

                case "id":
                    Id = Convert.ToInt64(jso[key]);
                    break;

                case "initialcost":
                    _initialCost = Convert.ToDouble(jso[key]);
                    break;

                case "isactive":
                    _isActive = Convert.ToBoolean(jso[key]);
                    break;

                case "ispremium":
                    _isPremium = Convert.ToBoolean(jso[key]);
                    break;

                case "maxallowedkeywords":
                    _maxAllowedKeywords = Convert.ToInt32(jso[key]);
                    break;

                case "mokeywords":
                    var mos = jso[key] as IEnumerable;
                    if (mos != null)
                    {
                        foreach (JObject o in mos)
                        {
                            _moKeywords.Add(new MoKeyWord(o.ToObject <ApiDictionary>()));
                        }
                    }
                    break;

                case "notes":
                    _notes = Convert.ToString(jso[key]);
                    break;

                case "numberplanitems":
                    var os = jso[key] as IEnumerable;
                    if (os != null)
                    {
                        foreach (JObject o in os)
                        {
                            _numberPlanItems.Add(new NumberPlanItem(o.ToObject <ApiDictionary>()));
                        }
                    }
                    break;

                case "periodiccostbasis":
                    _periodicCostBasis = Convert.ToDouble(jso[key]);
                    break;

                case "servicetype":
                    var svc = jso[key] as JObject;
                    _serviceType = new ServiceType(svc.ToObject <ApiDictionary>());
                    break;
                }
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="AccountContact" /> class.
        /// </summary>
        public AccountContact(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "accountcontactid":
                    _accountContactId = Convert.ToInt64(jso[key]);
                    break;

                case "address1":
                    Address1 = Convert.ToString(jso[key]);
                    break;

                case "address2":
                    Address2 = Convert.ToString(jso[key]);
                    break;

                case "city":
                    City = Convert.ToString(jso[key]);
                    break;

                case "country":
                    Country = Convert.ToString(jso[key]);
                    break;

                case "firstname":
                    FirstName = Convert.ToString(jso[key]);
                    break;

                case "lastname":
                    LastName = Convert.ToString(jso[key]);
                    break;

                case "province":
                    Province = Convert.ToString(jso[key]);
                    break;

                case "postalcode":
                    PostalCode = Convert.ToString(jso[key]);
                    break;

                case "primaryemail":
                    PrimaryEmail = Convert.ToString(jso[key]);
                    break;

                case "primaryphone":
                    PrimaryPhone = Convert.ToString(jso[key]);
                    break;

                case "privatenote":
                    PrivateNote = Convert.ToString(jso[key]);
                    break;

                case "publicnote":
                    PublicNote = Convert.ToString(jso[key]);
                    break;

                case "secondaryemail":
                    SecondaryEmail = Convert.ToString(jso[key]);
                    break;

                case "secondaryphone":
                    SecondaryPhone = Convert.ToString(jso[key]);
                    break;
                }
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        ///     Used internally to initialize the properties of this class.
        /// </summary>
        public Service(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "accountid":
                    AccountId = Convert.ToString(jso[key]);
                    break;

                case "billdate":
                    DateTime billDate;
                    if (jso[key].ToString() != "")
                    {
                        _billDate = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out billDate)
                                ? billDate
                                : (DateTime?)null;
                    }

                    break;

                case "billingcycleid":
                    BillingCycleId = Convert.ToInt64(jso[key]);
                    break;

                case "datecreated":
                    DateTime dateCreated;
                    if (jso[key].ToString() != "")
                    {
                        _dateCreated = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateCreated)
                                ? dateCreated
                                : (DateTime?)null;
                    }

                    break;

                case "description":
                    Description = Convert.ToString(jso[key]);
                    break;

                case "iscreditbased":
                    IsCreditBased = Convert.ToBoolean(jso[key]);
                    break;

                case "isprepaid":
                    IsPrepaid = Convert.ToBoolean(jso[key]);
                    break;

                case "rate":
                    Rate = Convert.ToDecimal(jso[key]);
                    break;

                case "serviceid":
                    ServiceId = Convert.ToInt64(jso[key]);
                    break;

                case "servicestatustypeid":
                    ServiceStatusTypeId = Convert.ToInt64(jso[key]);
                    break;

                case "servicetypeid":
                    ServiceTypeId = Convert.ToInt64(jso[key]);
                    break;
                }
            }
        }
Ejemplo n.º 27
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="AccountProfile" /> class.
        /// </summary>
        public AccountProfile(ApiDictionary jso)
        {
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "accountid":
                    _accountId = Convert.ToString(jso[key]);
                    break;

                case "accountmanager":
                    _accountManager = Convert.ToString(jso[key]);
                    break;

                case "accountnumber":
                    _accountNumber = Convert.ToInt64(jso[key]);
                    break;

                case "accountstatus":
                    _accountStatus = Convert.ToString(jso[key]);
                    break;

                case "balance":
                    _balance = Convert.ToDecimal(jso[key]);
                    break;

                case "company":
                    _company = Convert.ToString(jso[key]);
                    break;

                case "credit":
                    _credit = Convert.ToDecimal(jso[key]);
                    break;

                case "emailaddress":
                    _emailAddress = Convert.ToString(jso[key]);
                    break;

                case "lastaccessed":
                    DateTime lastAccessedDate;
                    if (jso[key].ToString() != "")
                    {
                        _lastAccessed = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out lastAccessedDate)
                                ? lastAccessedDate
                                : (DateTime?)null;
                    }
                    break;

                case "mobilenumber":
                    _mobileNumber = Convert.ToString(jso[key]);
                    break;

                case "numberofservices":
                    _numberOfServices = Convert.ToInt32(jso[key]);
                    break;

                case "primarycontact":
                    _primaryContact = Convert.ToString(jso[key]);
                    break;

                case "unpostedbalance":
                    _unpostedBalance = Convert.ToDecimal(jso[key]);
                    break;
                }
            }
        }
Ejemplo n.º 28
0
        public Ticket(ApiDictionary jso)
        {
            _responses = new List <TicketResponse>();
            foreach (string key in jso.Keys)
            {
                switch (key.ToLower())
                {
                case "id":
                    _id = Convert.ToInt32(jso[key]);
                    break;

                case "accountid":
                    _accountId = Convert.ToString(jso[key]);
                    break;

                case "assignedto":
                    _assignedTo = Convert.ToString(jso[key]);
                    break;

                case "supportdepartmentid":
                    SupportDepartmentId = Convert.ToInt32(jso[key]);
                    break;

                case "supportcategoryid":
                    SupportCategoryId = Convert.ToInt32(jso[key]);
                    break;

                case "supportstatusid":
                    _supporStatusId = Convert.ToInt32(jso[key]);
                    break;

                case "priority":
                    Priority = Convert.ToInt32(jso[key]);
                    break;

                case "source":
                    Source = Convert.ToString(jso[key]);
                    break;

                case "recipients":
                    _recipients = Convert.ToString(jso[key]);
                    break;

                case "timeadded":

                    if (jso[key].ToString() != "")
                    {
                        DateTime timeParsed;
                        _timeAdded = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out timeParsed)
                                ? timeParsed
                                : (DateTime?)null;
                    }
                    break;

                case "timeclosed":

                    if (jso[key].ToString() != "")
                    {
                        DateTime timeParsed;
                        _timeClosed = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out timeParsed)
                                ? timeParsed
                                : (DateTime?)null;
                    }
                    break;

                case "timeassigned":

                    if (jso[key].ToString() != "")
                    {
                        DateTime timeParsed;
                        _timeAssigned = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out timeParsed)
                                ? timeParsed
                                : (DateTime?)null;
                    }
                    break;

                case "lastupdated":

                    if (jso[key].ToString() != "")
                    {
                        DateTime timeParsed;
                        _lastUpdated = DateTime.TryParseExact(jso[key].ToString(), "yyyy-dd-MM hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out timeParsed)
                                ? timeParsed
                                : (DateTime?)null;
                    }
                    break;

                case "subject":
                    Subject = Convert.ToString(jso[key]);
                    break;

                case "content":
                    Content = Convert.ToString(jso[key]);
                    break;

                case "attachment":
                    _attachment = Convert.ToString(jso[key]);
                    break;

                case "rating":
                    _rating = Convert.ToInt32(jso[key]);
                    break;

                case "responses":
                    var os = jso[key] as IEnumerable;
                    if (os != null)
                    {
                        foreach (JObject o in os)
                        {
                            _responses.Add(new TicketResponse(o.ToObject <ApiDictionary>()));
                        }
                    }
                    break;
                }
            }
        }