private void btnKaydet_Click(object sender, EventArgs e) { if (MUSTERI_KOD.Text != "" && MUSTERI_AD.Text != "") { WebService kntlService = new WebService(); kntlService.SQLText = "SELECT MUSTERI_KODU FROM TBLMUSTERI WHERE MUSTERI_KODU = '" + MUSTERI_KOD.Text + "'"; kntlService.Open(); if (kntlService.DataCount() > 0) { string updStr = "UPDATE TBLMUSTERI SET MUSTERI_ADI = '" + MUSTERI_AD.Text + "'"; if (MUSTERI_TIPI.GetString() != "") { updStr += ", MUSTERI_TIPI = '" + MUSTERI_TIPI.GetString() + "'"; } else { updStr += ", MUSTERI_TIPI = NULL"; } if (UST_NO.Text != "") { updStr += ", UST_NO = '" + UST_NO.Text + "'"; } else { updStr += ", UST_NO = NULL"; } if (CADDE_SOKAK.Text != "") { updStr += ", CADDE_SOKAK = '" + CADDE_SOKAK.Text + "'"; } else { updStr += ", CADDE_SOKAK = NULL"; } if (TEL_NO.Text != "") { updStr += ", TEL_NO = '" + TEL_NO.Text + "'"; } else { updStr += ", TEL_NO = NULL"; } if (CEP_TELNO.Text != "") { updStr += ", CEP_TEL = '" + CEP_TELNO.Text + "'"; } else { updStr += ", CEP_TEL = NULL"; } if (EPOSTA.Text != "") { updStr += ", E_POSTA = '" + EPOSTA.Text + "'"; } else { updStr += ", E_POSTA = NULL"; } if (WEBSITE.Text != "") { updStr += ", WEB_SITE = '" + WEBSITE.Text + "'"; } else { updStr += ", WEB_SITE = NULL"; } if (BINA_NO.Text != "") { updStr += ", BINA_NO = '" + BINA_NO.Text + "'"; } else { updStr += ", BINA_NO = NULL"; } if (SEHIR.Text != "") { updStr += ", SEHIR = '" + SEHIR.Text + "'"; } else { updStr += ", SEHIR = NULL"; } if (POSTA_KODU.Text != "") { updStr += ", POSTA_KODU = '" + POSTA_KODU.Text + "'"; } else { updStr += ", POSTA_KODU = NULL"; } if (ULKE.Text != "") { updStr += ", ULKE = '" + ULKE.Text + "'"; } else { updStr += ", ULKE = NULL"; } if (FIRMA.Text != "") { updStr += ", FIRMA = '" + FIRMA.Text + "'"; } else { updStr += ", FIRMA = NULL"; } if (ISLETME_ADI.Text != "") { updStr += ", ISLETME_ADI = '" + ISLETME_ADI.Text + "'"; } else { updStr += ", ISLETME_ADI = NULL"; } if (FAX.Text != "") { updStr += ", FAX = '" + FAX.Text + "'"; } else { updStr += ", FAX = NULL"; } if (MUSTERI_NOTU.Text != "") { updStr += ", MUSTERI_NOTU = '" + MUSTERI_NOTU.Text + "'"; } else { updStr += ", MUSTERI_NOTU = NULL"; } if (PASIF_MI.SelectedIndex == -1 || PASIF_MI.SelectedIndex == 0) { updStr += ", PASIF_MI = 'H'"; } else { updStr += ", PASIF_MI = 'E'"; } updStr += " WHERE MUSTERI_KODU = '" + MUSTERI_KOD.Text + "'"; WebService service = new WebService(); service.SQLText = updStr; service.Open(); if (service.errorCode == "0") { GotoMessage.ShowMessage("Bilgi", "Kayıt Düzenleme Tamamlandı"); PanelClear(); RefreshGrid(); } else { GotoMessage.ShowMessage("Hata", "Kayıt Aktarılırken Hatayla Karşılaşıldı.\nHata: " + service.description); } } else { string insStr = "INSERT INTO TBLMUSTERI(MUSTERI_KODU, MUSTERI_ADI, MUSTERI_TIPI, UST_NO, CADDE_SOKAK, TEL_NO, CEP_TEL, E_POSTA, WEB_SITE, BINA_NO, SEHIR, POSTA_KODU, ULKE, FIRMA, ISLETME_ADI, FAX, PASIF_MI, MUSTERI_NOTU, KAYIT_YAPAN)"; insStr += "VALUES ('" + MUSTERI_KOD.Text + "', '" + MUSTERI_AD.Text + "'"; if (MUSTERI_TIPI.GetString() != "") { insStr += ", '" + MUSTERI_TIPI.GetString() + "'"; } else { insStr += ", NULL"; } if (UST_NO.Text != "") { insStr += ", '" + UST_NO.Text + "'"; } else { insStr += ", NULL"; } if (CADDE_SOKAK.Text != "") { insStr += ", '" + CADDE_SOKAK.Text + "'"; } else { insStr += ", NULL"; } if (TEL_NO.Text != "") { insStr += ", '" + TEL_NO.Text + "'"; } else { insStr += ", NULL"; } if (CEP_TELNO.Text != "") { insStr += ", '" + CEP_TELNO.Text + "'"; } else { insStr += ", NULL"; } if (EPOSTA.Text != "") { insStr += ", '" + EPOSTA.Text + "'"; } else { insStr += ", NULL"; } if (WEBSITE.Text != "") { insStr += ", '" + WEBSITE.Text + "'"; } else { insStr += ", NULL"; } if (BINA_NO.Text != "") { insStr += ", '" + BINA_NO.Text + "'"; } else { insStr += ", NULL"; } if (SEHIR.Text != "") { insStr += ", '" + SEHIR.Text + "'"; } else { insStr += ", NULL"; } if (POSTA_KODU.Text != "") { insStr += ", '" + POSTA_KODU.Text + "'"; } else { insStr += ", NULL"; } if (ULKE.Text != "") { insStr += ", '" + ULKE.Text + "'"; } else { insStr += ", NULL"; } if (FIRMA.Text != "") { insStr += ", '" + FIRMA.Text + "'"; } else { insStr += ", NULL"; } if (ISLETME_ADI.Text != "") { insStr += ", '" + ISLETME_ADI.Text + "'"; } else { insStr += ", NULL"; } if (FAX.Text != "") { insStr += ", '" + FAX.Text + "'"; } else { insStr += ", NULL"; } if (PASIF_MI.SelectedIndex == -1 || PASIF_MI.SelectedIndex == 0) { insStr += ", 'H'"; } else { insStr += ", 'E'"; } if (MUSTERI_NOTU.Text != "") { insStr += ", '" + MUSTERI_NOTU.Text + "'"; } else { insStr += ", NULL"; } if (Goto724Lib.adminMi == true) { insStr += ", 'Admin'"; } else { insStr += ", '" + Goto724Lib.tedarikciKodu + "'"; } insStr += ")"; WebService service = new WebService(); service.SQLText = insStr; service.Open(); if (service.errorCode == "0") { WebService otonumQry = new WebService(); if (yeniNum) { otonumQry.SQLText = "INSERT INTO TBLOTONUM(NUMARA_KODU, SON_NUMARA) VALUES('" + DateTime.Now.ToString("yyMM") + "_MUSTERI_KODU', '" + Convert.ToInt32(Goto724Lib.LastDigits(MUSTERI_KOD.Text, 6)) + "')"; } else { otonumQry.SQLText = "UPDATE TBLOTONUM SET SON_NUMARA = '" + Convert.ToInt32(Goto724Lib.LastDigits(MUSTERI_KOD.Text, 6)) + "' WHERE NUMARA_KODU = '" + DateTime.Now.ToString("yyMM") + "_MUSTERI_KODU'"; } otonumQry.Open(); MusteriKod(); GotoMessage.ShowMessage("Bilgi", "Kayıt Başarıyla Tamamlandı"); PanelClear(); RefreshGrid(); } else { GotoMessage.ShowMessage("Hata", "Kayıt Aktarılırken Hatayla Karşılaşıldı.\nHata: " + service.description); } } } else { string mesaj = ""; if (MUSTERI_KOD.Text == "") { mesaj = "Müşteri Kodu"; } else if (MUSTERI_AD.Text == "") { mesaj = "Müşteri Adı"; } mesaj += " Boş Olamaz!!"; GotoMessage.ShowMessage("Bilgi", mesaj); } }