Exemple #1
0
        private void btnGetSignedXmlArchive_Click(object sender, EventArgs e)
        {
            try
            {
                //gridde secılı arsıvlerın ımzalı xmlını dıske yazar
                List <string> listUnvalidArchive = new List <string>();

                foreach (DataGridViewRow row in tableArchiveGrid.SelectedRows)
                {
                    byte[] content = Singl.archiveControllerGet.getReadFromEArchive(row.Cells[nameof(EI.Invoice.uuid)].Value.ToString(), nameof(EI.DocumentType.XML));
                    if (content != null)
                    {
                        string path = FolderControl.inboxFolderArchive + row.Cells[nameof(EI.Invoice.ID)].Value.ToString() + "." + nameof(EI.DocumentType.XML);
                        FolderControl.writeFileOnDiskWithByte(content, path);
                    }
                    else
                    {
                        listUnvalidArchive.Add(row.Cells[nameof(EI.Invoice.ID)].Value.ToString());
                    }
                }

                if (listUnvalidArchive.Count > 0)
                {
                    MessageBox.Show(string.Join(Environment.NewLine, listUnvalidArchive) + Environment.NewLine + Lang.noGetInvoice);//Seçili arsivler getirilemedi
                }
                else
                {
                    MessageBox.Show(Lang.succesful);//"Başarılı"
                }
            }
            catch (FaultException <REQUEST_ERRORType> ex)
            {
                if (ex.Detail.ERROR_CODE == 2005)
                {
                    Singl.authControllerGet.Login(FrmLogin.usurname, FrmLogin.password);
                }
                MessageBox.Show(ex.Detail.ERROR_SHORT_DES, "ProcessingFault", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (System.Data.Entity.Infrastructure.DbUpdateException ex)
            {
                MessageBox.Show(Lang.dbFault + " " + ex.InnerException.Message.ToString(), "DataBaseFault", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (System.Data.DataException ex)
            {
                MessageBox.Show(ex.InnerException.Message.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
Exemple #2
0
        private void btnCreditNoteView_Click(object sender, EventArgs e)
        {
            try
            {
                string       uuid    = tableGrid.SelectedRows[0].Cells[nameof(EI.SelfEmploymentReceipt.uuid)].Value.ToString();
                CONTENT_TYPE docType = CONTENT_TYPE.XML;

                if (rdViewHtml.Checked) //html
                {
                    string xmlContent = Singl.smmControllerGet.getSmmContentXml(uuid);
                    if (xmlContent != null)
                    {
                        FrmView previewInvoices = new FrmView(xmlContent, nameof(EI.SelfEmploymentReceipt.SelfEmploymentReceipts));
                        previewInvoices.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show(Lang.cantGetContent);//content dıskten sılınmıs ve servısten getırılemedı
                    }
                }
                else  //html degılse
                {
                    if (rdViewXml.Checked) // xml ise
                    {
                        docType = CONTENT_TYPE.XML;
                    }
                    else //hicbirini secmezse pdf  görüntülenecektır
                    {
                        docType = CONTENT_TYPE.PDF;
                    }
                    /////////////
                    byte[] content = Singl.smmControllerGet.getSmmWithType(uuid, docType);
                    if (content != null)
                    {
                        string path = FolderControl.smmFolderPath + uuid + "." + docType;
                        FolderControl.writeFileOnDiskWithByte(content, path);
                        System.Diagnostics.Process.Start(path);
                    }
                    else
                    {
                        MessageBox.Show(Lang.cantGetContent);//content dıskten sılınmıs ve servısten getırılemedı
                    }
                }
            }
            catch (FaultException <SERVICES.serviceCreditNote.REQUEST_ERRORType> ex)  //archive req error
            {
                if (ex.Detail.ERROR_CODE == 2005)
                {
                    Singl.authControllerGet.Login(FrmLogin.usurname, FrmLogin.password);
                }
                MessageBox.Show(ex.Detail.ERROR_SHORT_DES, "ProcessingFault", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (System.Data.Entity.Infrastructure.DbUpdateException ex)
            {
                MessageBox.Show(Lang.dbFault + " " + ex.InnerException.Message.ToString(), "DataBaseFault", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (System.Data.DataException ex)
            {
                MessageBox.Show(ex.InnerException.Message.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }