Exemplo n.º 1
0
        private void buttonOpenFile_Click(object sender, EventArgs e)
        {
            DialogResult result = openFileDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                long l = new FileInfo(openFileDialog1.FileName).Length;
                if (l > 104857600)
                {
                    MessageBox.Show("File is too large. Max allowed size 100 MB", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                textBoxFileName.Text = openFileDialog1.FileName;
                WCF_Service.FileTransferRequest req = new WCF_Service.FileTransferRequest();
                req.FileName = openFileDialog1.SafeFileName;

                req.Content = File.ReadAllBytes(openFileDialog1.FileName);
                WCF_Service.MunicipalityTaxResponse        TaxResponse     = new WCF_Service.MunicipalityTaxResponse();
                List <WCF_Service.MunicipalityTaxResponse> TaxResponseList = new List <WCF_Service.MunicipalityTaxResponse>();
                TaxManagementClient client = new TaxManagementClient();
                TaxResponseList = client.UploadDataFromFile(req).ToList();
                client.Close();

                if ((TaxResponseList.Count() == 1) && (string.IsNullOrWhiteSpace(TaxResponseList.First().Municipality)))
                {
                    MessageBox.Show(TaxResponseList.First().Message, "File transfer error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    dataGridView1.DataSource = TaxResponseList;
                    dataGridView1.Columns.Remove("Status");
                    dataGridView1.Columns.Remove("ExtensionData");
                }
            }
        }
Exemplo n.º 2
0
 public System.Threading.Tasks.Task <WCF_Service.MunicipalityTaxResponse[]> UploadDataFromFileAsync(WCF_Service.FileTransferRequest req)
 {
     return(base.Channel.UploadDataFromFileAsync(req));
 }
Exemplo n.º 3
0
 public WCF_Service.MunicipalityTaxResponse[] UploadDataFromFile(WCF_Service.FileTransferRequest req)
 {
     return(base.Channel.UploadDataFromFile(req));
 }