private void btnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                //bos eleamn olmaması
                if (validEmptyComponent())
                {
                    //iade secılı ıse temel fatura olarak gonderılmesı
                    if (isValidInvoice())
                    {
                        //tutar hesapla
                        calculateTotalMoney();

                        //kullanıcı bılgılerı getır
                        getUserInformationOnDb();

                        ////////UBL OLUSTURMA ISLEMI////////
                        BaseInvoiceUBL invoice;

                        //eger INVOİCE ıse
                        if (invoiceType == nameof(EI.Invoice.Invoices))
                        {
                            invoice = new InvoiceUBL(cmbScenario.Text, cmbInvType.Text);
                        }
                        else //ARCHİVE İSE
                        {
                            invoice = new ArchiveUBL(cmbArchiveSendingType.Text, cmbScenario.Text, cmbInvType.Text);

                            if (cmbArchiveType.Text == nameof(EI.ArchiveType.INTERNET))
                            {
                                //eger gonderım tıpı ınternet ıse ekstra adınatıonal ref ekle
                                invoice.addAdditionalDocumentReference(nameof(EI.Profileid.EARSIVFATURA), cmbArchiveType.Text);

                                //DELİVERY BOLUMU EKLE
                                //carrıer ekle
                                PartyType carrierParty = invoice.createParty(txtCarrierTitle.Text, "", "", "");
                                invoice.addPartyIdentification(carrierParty, 1, nameof(EI.VknTckn.VKN), msdDeliveryVkn.Text, "", "", "", "");
                                invoice.createDelivery(carrierParty, Convert.ToDateTime(datepicDespatchDate.Text));

                                //payment means ekle
                                invoice.createPaymentMeans(getPaymentCode(cmbPaymentType.Text), Convert.ToDateTime(datepicPaymentDate.Text), txtMediator.Text);
                            }
                        }

                        PartyType supParty;
                        PartyType cusParty;
                        string    partyIdentificationSchemaType;

                        //SUPPLİER  PARTY OLUSTURULMASI
                        supParty = invoice.createParty(partyName, cityName, telephone, mail);
                        if (senderVknTc.Length == 10) //sup vkn
                        {
                            partyIdentificationSchemaType = nameof(EI.VknTckn.VKN);
                            invoice.addPartyTaxSchemeOnParty(supParty);
                        }
                        else  //sup tckn .. add person metodu eklenır
                        {
                            partyIdentificationSchemaType = nameof(EI.VknTckn.TCKN);
                            invoice.addPersonOnParty(supParty, firstName, familyName);
                        }
                        invoice.addPartyIdentification(supParty, 2, partyIdentificationSchemaType, senderVknTc, nameof(EI.Mersis.MERSISNO), sicilNo, "", "");
                        invoice.SetSupplierParty(supParty);

                        //CUST PARTY OLUSTURULMASI
                        cusParty = invoice.createParty(txtPartyName.Text, txtCity.Text, msdPhone.Text, txtMail.Text);
                        if (msdVknTc.Text.Length == 10) //customer vkn
                        {
                            partyIdentificationSchemaType = nameof(EI.VknTckn.VKN);
                            invoice.addPartyTaxSchemeOnParty(cusParty);
                        }
                        else  //customer tckn
                        {
                            partyIdentificationSchemaType = nameof(EI.VknTckn.TCKN);
                            invoice.addPersonOnParty(cusParty, txtCustName.Text, txtCustSurname.Text);
                        }
                        invoice.addPartyIdentification(cusParty, 1, partyIdentificationSchemaType, msdVknTc.Text, "", "", "", "");
                        invoice.SetCustomerParty(cusParty);


                        //INV LINE OLUSTURULMASI
                        foreach (DataGridViewRow row in gridPrice.Rows)
                        {
                            //Inv Lıne Olusturulması
                            //unıt code get fonk cagırılarak secılen bırımın unıt codu getırılırilerek aktarılır
                            invoice.addInvoiceLine(row.Index.ToString(), cmbMoneyType.Text, getUnitCode(row.Cells[nameof(EI.InvLineGridRowClm.unit)].Value.ToString())
                                                   , Convert.ToDecimal(row.Cells[nameof(EI.InvLineGridRowClm.quantity)].Value), Convert.ToDecimal(row.Cells[nameof(EI.InvLineGridRowClm.total)].Value)
                                                   , Convert.ToDecimal(row.Cells[nameof(EI.InvLineGridRowClm.taxAmount)].Value), Convert.ToDecimal(row.Cells[nameof(EI.InvLineGridRowClm.total)].Value)
                                                   , Convert.ToDecimal(row.Cells[nameof(EI.InvLineGridRowClm.taxPercent)].Value), row.Cells[nameof(EI.InvLineGridRowClm.productName)].Value.ToString()
                                                   , Convert.ToDecimal(row.Cells[nameof(EI.InvLineGridRowClm.unitPrice)].Value));
                        }

                        invoice.setInvLines();
                        invoice.setTaxTotal(invoice.invoiceTaxTotal());
                        invoice.SetLegalMonetaryTotal(invoice.CalculateLegalMonetaryTotal());
                        invoice.SetAllowanceCharge(invoice.CalculateAllowanceCharges());

                        //olusturdugumuz nesne ubl turune cevrılır
                        var invoiceUbl = invoice.baseInvoiceUBL;
                        //xml olustur
                        string xmlPath = FolderControl.writeDiscInvoiceConvertUblToXml(invoiceUbl, invoiceType).ToString();

                        if (xmlPath != null)
                        {
                            //db ye kaydet
                            if (invoiceType == nameof(EI.Invoice.Invoices))
                            {
                                Singl.invoiceDalGet.insertDraftInvoice(invoiceUbl, xmlPath);
                            }
                            else if (invoiceType == nameof(EI.Invoice.ArchiveInvoices)) //arsıv ıse
                            {
                                Singl.archiveInvoiceDalGet.insertArchiveOnDbFromUbl(invoiceUbl, xmlPath, chkSendMail.Checked);
                            }

                            MessageBox.Show(xmlPath + "  faturalar kaydedıldı");
                        }
                        else
                        {
                            MessageBox.Show("işlem basarısız");
                        }
                    }
                    else
                    {
                        MessageBox.Show("iade faturası secılıyse temel olarak gonderılmelıdır");
                    }
                }
                else  //bos eleman varsa
                {
                    MessageBox.Show("yıldızlı alanları bos bırakmayınız");
                }
            }
            catch (FaultException <REQUEST_ERRORType> ex) //oib 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)
            {
                MessageBox.Show(Lang.dbFault, "DataBaseFault", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }