/// <summary> /// Oluşturulan e-Arşiv faturanın gönderimini sağlar /// </summary> /// <returns>E-Arşiv Fatura Gönderme</returns> private void btnArsivGonder_Click(object sender, EventArgs e) { try { if (!CheckConnParam()) { throw new CheckConnParamException( "TCKN/VKN, Gönderici Birim Etiketi, Posta Kutusu Etiketi, WS Kullanıcı Adı ve WS Şifre alanları boş bırakılamaz!"); } var eArsiv = new ArchiveWebService(); var result = eArsiv.EArsivGonder(SetValue(), GetUBLArchiveData(), CheckedSSL()); if (result.Result.Result1 == ResultType.SUCCESS) { MessageBox.Show(result.Detail, "Response", MessageBoxButtons.OK, MessageBoxIcon.Information); txtFaturaUUID.Text = result.preCheckSuccessResults[0].UUID; txtFaturaID.Text = result.preCheckSuccessResults[0].InvoiceNumber; } else { MessageBox.Show(result.preCheckErrorResults[0].ErrorDesc, "Response", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (CheckConnParamException ex) { MessageBox.Show(ex.Message, "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } catch (FaultException <processingFaultType> ex) { MessageBox.Show(ex.Message, "ProcessingFault", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (FaultException ex) { MessageBox.Show(ex.Message, "FaultException", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// Gönderilen faturanın (vknTCKN ile Fatura UUID veya ID bilgisi mevcut olan ) PDF formatında /// kayıt eder /// </summary> /// <returns>E-Arşiv Fatura PDF Kaydetme</returns> private void btnArsivPDFIndir_Click(object sender, EventArgs e) { try { if (!CheckConnParam() || !TextBoxFatura()) { throw new CheckConnParamException( "TCKN / VKN, Şube , WS Kullanıcı Adı, WS Şifre ve İndirilecek Faturanın UUID veya ID alanları boş olamaz!"); } ArchiveWebService eArsiv = new ArchiveWebService(); var result = eArsiv.FaturaPDFIndir(SetValue(), CheckedSSL()); FolderBrowserDialog fbDialog = new FolderBrowserDialog(); fbDialog.Description = "Lütfen kaydetmek istediğiniz dizini seçiniz..."; fbDialog.RootFolder = Environment.SpecialFolder.Desktop; if (fbDialog.ShowDialog() == DialogResult.OK) { //dialog ile kullanıcıya seçtirilen dizine fatura UUID si ile dosya ismini set ederek kayıt işlemi yapıyoruz. File.WriteAllBytes(fbDialog.SelectedPath + "\\" + txtFaturaUUID.Text + ".pdf", result.binaryData); MessageBox.Show("Fatura PDF İndirme Başarılı", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (CheckConnParamException ex) { MessageBox.Show(ex.Message, "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } catch (FaultException <processingFaultType> ex) { MessageBox.Show(ex.Detail.Text, "ProcessingFault", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (FaultException ex) { MessageBox.Show(ex.Message, "FaultException", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }