Beispiel #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");
                }
            }
        }
Beispiel #2
0
        private void buttonAddRecord_Click(object sender, EventArgs e)
        {
            if (!checkEmptyValue("municipality name", textBoxMunicipalityAdd.Text))
            {
                return;
            }
            if (!checkEmptyValue("tax value", textBoxTaxAdd.Text))
            {
                return;
            }

            WCF_Service.MunicipalityTax dataRequest = new WCF_Service.MunicipalityTax()
            {
                Municipality = textBoxMunicipalityAdd.Text,
                TaxType      = comboBoxTaxTypes.SelectedValue.ToString().Trim(),
                ValidFrom    = Convert.ToDateTime(labelValidFrom.Text),
                ValidTo      = Convert.ToDateTime(labelValidTo.Text),
                Tax          = Decimal.Parse(textBoxTaxAdd.Text)
            };
            TaxManagementClient client = new TaxManagementClient();

            WCF_Service.GeneralResponse resp = client.AddTaxRecord(dataRequest);
            client.Close();
            toolStripStatusLabel.Text = resp.message;
        }
Beispiel #3
0
        private void ML_service_client_Load(object sender, EventArgs e)
        {
            List <string>       TaxTypes = new List <string>();
            TaxManagementClient client   = new TaxManagementClient();

            try
            {
                TaxTypes = client.GetTaxTypes().ToList();
                comboBoxTaxTypes.DataSource = TaxTypes;
                client.Close();
            } catch
            {
                MessageBox.Show("Service is unreachable", "Connection error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }

            updateDates();
            labelDate.Text = monthCalendar2.SelectionStart.ToString("yyyy.MM.dd");
        }
Beispiel #4
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;
        }