private void LoadRemitance() { remittance = svc.GetRemitanceByTransID(transID); if (remittance.RemittanceID == 0) { ChallanAmount.Text = challanAmt.ToString(); ChallanDate.Text = DateTime.Now.Date.ToString(); // upload.Visibility = Visibility.Hidden; } else { // upload.Visibility = Visibility.Visible; ChallanDate.Text = remittance.ChallanDate.ToString(); ChallanNo.Text = remittance.ChallanID; AknowledgementNo.Text = remittance.ChallanAckNo; ChallanAmount.Text = remittance.ChallanAmount.ToString(); // CustomerPropertyFileDto customerPropertyFileDto= svc.GetFile(remittance.ChallanFileID.ToString()); CustomerPropertyFileDto customerPropertyFileDto = svc.GetFile(remittance.ChallanBlobID.ToString()); if (customerPropertyFileDto != null) { FileNameLabel.Content = customerPropertyFileDto.FileName; upload.IsEnabled = false; } } }
public async void DownloadFile(CustomerPropertyFileDto customerPropertyFileDto) { try { var downloadPath = Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "{374DE290-123F-4565-9164-39C4925E467B}", String.Empty).ToString(); downloadPath += @"\REproFiles\" + customerPropertyFileDto.FileName; var ms = new MemoryStream(customerPropertyFileDto.FileBlob); var fs = File.Create(downloadPath); ms.Seek(0, SeekOrigin.Begin); ms.CopyTo(fs); MessageBox.Show("File is downloaded successfully. Please Refer the path : " + downloadPath); } catch (Exception ex) { MessageBox.Show("File is not downloaded"); } // HttpResponseMessage response = new HttpResponseMessage(); // response = client.GetAsync("files/blobId/" + blobId).Result; // if (response.IsSuccessStatusCode) // { // await using var ms = await response.Content.ReadAsStreamAsync(); // await using var fs = File.Create(fileName); // ms.Seek(0, SeekOrigin.Begin); // ms.CopyTo(fs); // } }
private void LoadRemitance() { remittance = svc.GetRemitanceByTransID(tdsRemittanceDto.ClientPaymentTransactionID); if (remittance.F16BDateOfReq == null) { RequestDate.Text = DateTime.Now.Date.ToString(); } else { RequestDate.Text = remittance.F16BDateOfReq.ToString(); } // upload.Visibility = Visibility.Visible; customerPan.Text = remittance.CustomerPAN; dateOfBirth.Text = remittance.DateOfBirth.ToString("ddMMyyyy"); if (remittance.F16BRequestNo != "") { RequestNo.Text = remittance.F16BRequestNo; } else { RequestNo.Text = requestNo; } CertificateNo.Text = remittance.F16BCertificateNo; if (remittance.F16CreditedAmount != null) { PaidAmount.Text = remittance.F16CreditedAmount.ToString(); } if (remittance.F16CustName != null) { CustomerName.Text = remittance.F16CustName; } if (remittance.F16UpdateDate != null) { UpdatedDate.Text = remittance.F16UpdateDate.Value.ToString("dd-MMM-yyyy"); } customerPropertyFileDto = svc.GetFile(remittance.Form16BlobID.ToString()); if (customerPropertyFileDto != null) { FileNameLabel.Content = customerPropertyFileDto.FileName; // upload.IsEnabled = false; } else { download.Visibility = Visibility.Hidden; } }
public CustomerPropertyFileDto GetFile(string blobId) { CustomerPropertyFileDto customerPropertyFileDto = null; HttpResponseMessage response = new HttpResponseMessage(); response = client.GetAsync("files/fileinfo/" + blobId).Result; if (response.IsSuccessStatusCode) { customerPropertyFileDto = response.Content.ReadAsAsync <CustomerPropertyFileDto>().Result; } return(customerPropertyFileDto); //if (response.IsSuccessStatusCode) //{ // var ms = response.Content.ReadAsStreamAsync(); // var fs = File.Create() //} }