Example #1
0
 public PromoCode ParseFromJson(Dictionary <string, object> json)
 {
     Code          = json["Code"] as string;
     Data          = (json["Data"] as Dictionary <string, object>).ToStrStrDict();
     MaxClaimCount = (uint)(long)json["MaxClaimCount"];
     StartDate     = DateFromObject(json["StartDate"]).Value;
     EndDate       = DateFromObject(json["EndDate"]);
     Creator       = new UserReference().ParseFromJson(json["Creator"] as Dictionary <string, object>);
     ClaimCount    = (uint)(long)json["ClaimCount"];
     Enabled       = (bool)json["Enabled"];
     Claimable     = (bool)json["Claimable"];
     return(this);
 }
Example #2
0
 public PromoCode ParseFromAJO(AndroidJavaObject ajo)
 {
     using (ajo) {
         Code          = ajo.CallStr("getCode");
         Data          = ajo.CallAJO("getData").FromJavaHashMap();
         MaxClaimCount = (uint)ajo.CallInt("getMaxClaimCount");
         StartDate     = DateFromAjo(ajo.CallAJO("getStartDate")).Value;
         EndDate       = DateFromAjo(ajo.CallAJO("getEndDate"));
         Creator       = new UserReference().ParseFromAJO(ajo.CallAJO("getCreator"));
         ClaimCount    = (uint)ajo.CallInt("getClaimCount");
         Enabled       = ajo.CallBool("isEnabled");
         Claimable     = ajo.CallBool("isClaimable");
     }
     return(this);
 }
        public Notification ParseFromJson(Dictionary <string, object> dictionary)
        {
            Title              = dictionary["Title"] as string;
            Id                 = dictionary["Id"] as string;
            Status             = dictionary["Status"] as string;
            CreatedAt          = (long)dictionary["CreatedAt"];
            Text               = dictionary["Text"] as string;
            ImageUrl           = dictionary["ImageUrl"] as string;
            VideoUrl           = dictionary["VideoUrl"] as string;
            NotificationAction =
                new GetSocialAction().ParseFromJson(dictionary["Action"] as Dictionary <string, object>);
            ActionButtons = ((List <object>)dictionary["ActionButtons"]).ConvertAll(item =>
                                                                                    new ActionButton().ParseFromJson((Dictionary <string, object>)item));
            NotificationType = dictionary["Type"] as string;
#pragma warning disable 618
            Action = (Type)(long)dictionary["OldAction"];
#pragma warning restore 618
            Sender        = new UserReference().ParseFromJson(dictionary["Sender"] as Dictionary <string, object>);
            Customization = new NotificationCustomization().ParseFromJson(dictionary["Customization"] as Dictionary <string, object>);
            return(this);
        }
        public Notification ParseFromAJO(AndroidJavaObject ajo)
        {
            Id               = ajo.CallStr("getId");
            Status           = ajo.CallStr("getStatus");
            NotificationType = ajo.CallStr("getType");
#pragma warning disable 618
            Action = (Type)ajo.CallInt("getActionType");
#pragma warning restore 618
            CreatedAt          = ajo.CallLong("getCreatedAt");
            Title              = ajo.CallStr("getTitle");
            Text               = ajo.CallStr("getText");
            NotificationAction = new GetSocialAction().ParseFromAJO(ajo.CallAJO("getAction"));
            ActionButtons      = ajo.CallAJO("getActionButtons").FromJavaList().ConvertAll(item => {
                using (item) {
                    return(new ActionButton().ParseFromAJO(item));
                }
            });
            ImageUrl      = ajo.CallStr("getImageUrl");
            VideoUrl      = ajo.CallStr("getVideoUrl");
            Sender        = new UserReference().ParseFromAJO(ajo.CallAJO("getSender"));
            Customization = new NotificationCustomization().ParseFromAJO(ajo.CallAJO("getCustomization"));
            return(this);
        }
Example #5
0
 internal PromoCode(string code, Dictionary <string, string> data, uint maxClaimCount, DateTime startDate, DateTime?endDate, UserReference creator, uint claimCount, bool enabled, bool claimable)
 {
     this.Code          = code;
     this.MaxClaimCount = maxClaimCount;
     this.StartDate     = startDate;
     this.Creator       = creator;
     this.ClaimCount    = claimCount;
     this.Enabled       = enabled;
     this.Claimable     = claimable;
     this.Data          = data;
     this.EndDate       = endDate;
 }
#pragma warning disable 0618
        internal Notification(string id, GetSocialAction notificationAction, Type action, string status, string notificationType, long createdAt, string title, string text, string imageUrl, string videoUrl, UserReference sender, List <ActionButton> actionButtons, NotificationCustomization customization)
        {
#pragma warning restore 0618
            this.Id = id;
            this.NotificationAction = notificationAction;
#pragma warning disable 0618
            this.Action = action;
#pragma warning restore 0618
            this.ActionButtons    = actionButtons;
            this.Status           = status;
            this.NotificationType = notificationType;
            this.CreatedAt        = createdAt;
            this.Title            = title;
            this.Text             = text;
            this.ImageUrl         = imageUrl;
            this.VideoUrl         = videoUrl;
            this.Sender           = sender;
            this.Customization    = customization;
        }