Exemplo n.º 1
0
        private async Task <docType_ns_VSKSkyrslaSvar> SendToRSK(
            List <VatSumOperationReport> vatSumOperationReports)
        {
            docType_ns_VSKSkyrslaSvar response = null;

            try
            {
                var    client       = new VskClient(txtKennitala.Text, txtPassword.Text);
                long[] longsOrdered = vatSumOperationReports.OrderBy(o => o._Line)
                                      .Select(i => (long)Math.Round(i._Amount != 0 ? i._Amount : i._AmountBase != 0 ? i._AmountBase : 0))
                                      .ToArray();
                response = await client.SkilaVSKSkyrsluAsync(
                    kennitala : txtKennitala.Text,
                    vskNumer : txtVatNo.Text,
                    toDate : ToDate,
                    velta24 : longsOrdered[0],
                    velta11 : longsOrdered[1],
                    velta0 : longsOrdered[2],
                    ut24 : longsOrdered[3],
                    ut11 : longsOrdered[4],
                    inn24 : longsOrdered[5],
                    inn11 : longsOrdered[6]
                    );
            }
            catch (MessageSecurityException)
            {
                UnicontaMessageBox.Show("Rangt notendanafn eða lykilorð", "Villa"); // Wrong user/pass
            }
            catch (Exception e)
            {
                UnicontaMessageBox.Show(e, "Villa");
            }

            return(response);
        }
Exemplo n.º 2
0
        private async Task ResetTestVSK(
            CrudAPI crudApi,
            List <VatSumOperationReport> vatSumOperationReports) // Only for test service URI
        {
            try
            {
                var client = new VskClient(txtKennitala.Text, txtPassword.Text);
                var result = await client.ResetTestAsync(txtKennitala.Text, ToDate, api.CompanyEntity._VatNumber);

                if (result.EydaSkyrsluIProfunSvar != null)
                {
                    UnicontaMessageBox.Show(result.EydaSkyrsluIProfunSvar.status.message, "Villa " + result.EydaSkyrsluIProfunSvar.status.code);
                }
            }
            catch (MessageSecurityException)
            {
                UnicontaMessageBox.Show("Rangt notendanafn eða lykilorð", "Villa"); //Wrong UserName or Password
            }
            catch (Exception e)
            {
                UnicontaMessageBox.Show($"{e.Message} \n\n {e.StackTrace}", "Villa");
            }
        }