Exemplo n.º 1
0
		/// <summary>
		/// メディア付きのツイートを投稿します。
		/// </summary>
		public static async Task<Status> UpdateStatus(
			this TwitterToken token, string status, string[] mediaPaths, StatusId? inReplyToStatusId = null)
		{
			// media が空だったら通常の投稿に切り替える
			if (!mediaPaths.HasValue()) return await token.UpdateStatus(status, inReplyToStatusId);

			var endpoint = token.Endpoints["statuses/update_with_media"];

			using (var client = token.GetClient())
			using (var content = new MultipartFormDataContent { { new StringContent(status), "\"status\"" } })
			{
				if (inReplyToStatusId.HasValue)
				{
					content.Add(new StringContent(inReplyToStatusId.ToString()), "\"in_reply_to_status_id\"");
				}
				foreach (var path in mediaPaths)
				{
					var media = File.ReadAllBytes(path);
					var filename = Path.GetFileName(path);
					content.Add(new ByteArrayContent(media), "media[]", "\"" + filename + "\"");
				}

				return await client.PostAsyncEx(
					endpoint.Definition.Url,
					content,
					res => endpoint.RateLimit.Set(res.Headers),
					json => Status.Parse(json, StatusSource.Update),
					() => token.FallbackToken.UpdateStatus(status, mediaPaths, inReplyToStatusId));
			}
		}
Exemplo n.º 2
0
 public DebtDetailResponse ToDebtDetail(DynamicsGatewayOptions options)
 {
     return(new DebtDetailResponse
     {
         Id = Id,
         Amount = decimal.Parse(Amount),
         Reference = CreditorExternalReference,
         DebtTypeName = Type,
         NINO = NationalInsuranceNumber,
         CreatedOn = CreatedOn.ToDateTimeOffset(),
         ModifiedOn = ModifiedOn.ToDateTimeOffset(),
         Status = options.DebtStatus[StatusId.ToString()],
         SoldToCreditorName = ProposedCreditor?.Name,
         SoldToCreditorId = ProposedCreditor?.Id,
         PreviouslySold = PreviouslySold,
         CreditorName = Creditor.Name,
         CreditorId = Creditor.Id,
         StartsOn = CommencementDate?.ToDateTimeOffset(),
         EndsOn = ExpiryDate?.ToDateTimeOffset(),
         RemovedOn = RemovalDate?.ToDateTimeOffset(),
         DebtTypeId = TypeId,
         DebtEligibilityReview = DebtEligibilityReview != null
             ? DebtEligibilityReview.ToDebtEligibilityReview(options)
             : null,
         DebtRemovalReason = DebtRemovalReasonId.HasValue ?
                             options.DebtRemovalReason.First(r => r.Value == DebtRemovalReasonId.ToString()).Key :
                             (DebtRemovalReason?)null
     });
 }
Exemplo n.º 3
0
 /// <inheritdoc />
 public override string ToString()
 {
     if (null == StatusMeta)
     {
         return(Name ?? StatusId.ToString());
     }
     return($"{Name ?? StatusId.ToString()}: {StatusMeta}");
 }
 public DebtEligibilityReviewResponse ToDebtEligibilityReview(DynamicsGatewayOptions options)
 {
     return(new DebtEligibilityReviewResponse
     {
         CreditorNotes = CreditorNotes,
         Reason = (DebtEligibilityReviewReasons)int.Parse(options.DebtEligibilityReviewReasons
                                                          .First(r => r.Value == ReasonId.ToString()).Key),
         Status = options.DebtEligibilityReviewStatus[StatusId.ToString()],
         MoneyAdviserNotes = MoneyAdviserNotes,
         CreatedOn = CreatedOn.ToDateTimeOffset(),
         ModifiedOn = ModifiedOn.ToDateTimeOffset(),
     });
 }
Exemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        phong           = (new PMPhong(this)).GetOne(ID);
        tenphong.Value  = Ten;
        loaiphong.Value = IdLoaiPhong.ToString();
        status.Value    = StatusId.ToString();

        if (StatusId == 3)
        {
            tgbatdau.Text = TGStart.ToString("dd/MM/yyyy HH:mm:ss");
            tenkh.Value   = TenKH;
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "chi", "btnbatdauclick();", true);
        }
        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "loadjs", "ctphong_ready();", true);
    }
 public DebtorEligibilityReviewResponse ToDebtorEligibilityReview(DynamicsGatewayOptions options)
 {
     return(new DebtorEligibilityReviewResponse
     {
         CreditorId = CreditorId,
         CreditorNotes = CreditorNotes,
         MoneyAdviserNotes = MoneyAdviserNotes,
         CreditorName = Creditor,
         Status = options.DebtorEligibilityReviewStatus[StatusId.ToString()],
         CreatedOn = CreatedOn.ToDateTimeOffset(),
         EndReason = options.GetEligibilityReviewParentReasonById(ReasonId),
         ModifiedOn = ModifiedOn.ToDateTimeOffset(),
         NoLongerEligibleReason = SubreasonId != Guid.Empty
             ? options.GetEligibilityReviewChildReasonById(SubreasonId)
             : null
     });
 }
Exemplo n.º 7
0
        public string ConvertToSearch()
        {
            var cc = DbUtil.Db.ScratchPadCondition();

            cc.Reset();
            var c = cc.AddNewClause(QueryType.OrgSearchMember, CompareType.Equal, "1,True");

            if (Name.HasValue())
            {
                c.OrgName = Name;
            }
            if (ProgramId != 0)
            {
                c.Program = ProgramId.ToString();
            }
            if (DivisionId != 0)
            {
                c.Division = DivisionId.ToString();
            }
            if (StatusId != 0)
            {
                c.OrgStatus = StatusId.ToString();
            }
            if (TypeId != 0)
            {
                c.OrgType2 = TypeId ?? 0;
            }
            if (CampusId != 0)
            {
                c.Campus = CampusId.ToString();
            }
            if (ScheduleId != 0)
            {
                c.Schedule = ScheduleId.ToString();
            }
            if (OnlineReg != 0)
            {
                c.OnlineReg = OnlineReg.ToString();
            }

            cc.Save(DbUtil.Db);
            return("/Query/" + cc.Id);
        }
Exemplo n.º 8
0
		public static async Task<Status> ShowStatus(this TwitterToken token, StatusId statusId, bool? trimUser = true)
		{
			var endpoint = token.Endpoints["statuses/show/:id"];
			var param = new Dictionary<string, string>();
			var urlParam = new Dictionary<string, string> { { ":id", statusId.ToString() }, };
			if (trimUser.HasValue) param.Add("trim_user", trimUser.Value.ToString());

			return await endpoint.GetAsync(token, param, urlParam, Status.Parse, t => t.ShowStatus(statusId, trimUser));
		}
Exemplo n.º 9
0
 private Status(StatusId id)
 {
     Id   = id;
     Name = id.ToString();
 }