Пример #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");
                }
            }
        }
Пример #2
0
        private void getTax_Click_Click(object sender, EventArgs e)
        {
            if (!checkEmptyValue("municipality name", textBoxMunicipality.Text))
            {
                return;
            }

            string s = comboBoxTaxTypes.SelectedValue.ToString();

            WCF_Service.MunicipalityTax req = new WCF_Service.MunicipalityTax();
            req.Municipality = textBoxMunicipality.Text;
            req.ValidFrom    = monthCalendar2.SelectionStart;

            TaxManagementClient client = new TaxManagementClient();

            WCF_Service.MunicipalityTaxResponse resp = new WCF_Service.MunicipalityTaxResponse();
            resp = client.GetTaxInfo(req);
            textBoxResult.Text = resp.Tax.ToString();
            client.Close();
            toolStripStatusLabel.Text = resp.Message;
        }