Exemplo n.º 1
0
        private void btnSmmGonder_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 eSmm   = new SmmWebService();
                var result = eSmm.ESmmGonder(SetValue(), CheckedSSL());

                MessageBox.Show(result[0].UUID, "Response", MessageBoxButtons.OK, MessageBoxIcon.Information);

                txtFaturaUUID.Text = result[0].UUID;
                txtFaturaID.Text   = result[0].ID;
            }
            catch (CheckConnParamException ex)
            {
                MessageBox.Show(ex.Message, "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (FaultException <ProcessingFault> ex)
            {
                MessageBox.Show(ex.Detail.Code + ": " + 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());
            }
        }
Exemplo n.º 2
0
        private void btnSmmMakbuzIndir_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!");
                }

                SmmWebService       eSmm     = new SmmWebService();
                var                 result   = eSmm.SmmPDFIndir(SetValue(), CheckedSSL());
                var                 pdf      = ZipUtility.UncompressFile(result[0].DocData);
                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", pdf);

                    MessageBox.Show("Serbest Makbuz PDF İndirme Başarılı", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (CheckConnParamException ex)
            {
                MessageBox.Show(ex.Message, "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (FaultException <ProcessingFault> ex)
            {
                MessageBox.Show(ex.Detail.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());
            }
        }