//
        // checkVat
        //
        private void simpleButton_Click(object sender, EventArgs e)
        {
            requestLabel.Text     = optionLabelText;
            this.Height           = 233;
            textBoxOutput.Visible = false;
            try
            {
                if (countryComboBox.SelectedItem != null && vatNumberTextBox.Text.Length >= 9)
                {
                    simpleButton.Enabled = false;
                    this.Cursor          = Cursors.WaitCursor;
                    VatModel viesVAT = CheckService.getDetails(countryCode, vatNumber);

                    if (viesVAT.Valid)
                    {
                        MessageBox.Show(
                            "VAT Number: " + viesVAT.VatNumber + "\n" + "Member State: " + viesVAT.CountryCode + "\n" + "is " + (viesVAT.Valid == true ? "VALID" : "INVALID") + "\n" +
                            "Name: " + viesVAT.Name + "\n" + "Address: " + viesVAT.Address,
                            "Results from EU VIES VAT Services",
                            MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        MessageBox.Show(
                            "The VAT Number: " + viesVAT.VatNumber + "\n" + "Member State: " + viesVAT.CountryCode + " is " + (viesVAT.Valid == true ? "VALID" : "INVALID"),
                            "VAT Number Validation",
                            MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show(
                        "Member State or VAT Number is incorect.",
                        "Warning",
                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    "The service has responded with an error. " + ex.Message,
                    "Service error occurred",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                simpleButton.Enabled = true;
                this.Cursor          = Cursors.Default;
            }
        }
Example #2
0
        public async Task <VatModel> GetVatForPeriod(VatModel vatData)
        {
            using (HttpResponseMessage response = await _apiService.ApiClient.PostAsJsonAsync("/api/Vat/Period", vatData))
            {
                if (response.IsSuccessStatusCode)
                {
                    var result = await response.Content.ReadAsAsync <VatModel>();

                    return(result);
                }
                else
                {
                    throw new Exception(response.ReasonPhrase);
                }
            }
        }
Example #3
0
        public VatModel GetByPeriod(VatModel vatData)
        {
            try
            {
                _sql.StartTransaction("AccountingConnStr");

                var vatCalculation = _sql.LoadDataInTransaction <VatModel, dynamic>("dbo.spVatArchive_CalculateForPeriod",
                                                                                    new { DateFrom = vatData.DateFrom, DateTo = vatData.DateTo }).FirstOrDefault();
                vatCalculation.DateFrom = vatData.DateFrom;
                vatCalculation.DateTo   = vatData.DateTo;

                return(vatCalculation);
            }
            catch (System.Exception)
            {
                _sql.RollBackTransaction();
                throw;
            }
        }
Example #4
0
 public bool SaveVat(VatModel model)
 {
     try
     {
         if (model.Id == 0)
         {
             model.Id = vats.Count + 1;
         }
         else
         {
             vats.Remove(vats.Single(v => v.Id == model.Id));
         }
         vats.Add(model);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Example #5
0
 public VatModel GetForPeriod([FromBody] VatModel value)
 {
     return(_data.GetByPeriod(value));
 }
Example #6
0
 public SimplifiedVat(VatModel model) : this(model.Id.Value, model.Value)
 {
 }
Example #7
0
 public PrimitiveContainer <bool> Change([FromBody] VatModel value)
 {
     return(new PrimitiveContainer <bool> {
         Value = this.vatRepository.SaveVat(value)
     });
 }