Пример #1
0
 private void ALIS_FIYAT1_Leave(object sender, EventArgs e)
 {
     if (ALIS_FIYAT1.Text != "")
     {
         ALIS_FIYAT1.TextChanged -= new EventHandler(ALIS_FIYAT1_TextChanged);
         double doubleVal = Convert.ToDouble(Goto724Lib.RemoveChar(ALIS_FIYAT1.Text, '.'));
         if (doubleVal == 0.0)
         {
             ALIS_FIYAT1.Text = "";
         }
         else
         {
             string decimalStr = "";
             for (int i = 0; i < 2; i++)
             {
                 decimalStr += "0";
             }
             ALIS_FIYAT1.Text = doubleVal.ToString("#,0." + decimalStr);
         }
         afLastText = ALIS_FIYAT1.Text;
         ALIS_FIYAT1.SelectionStart = ALIS_FIYAT1.Text.Length;
         ALIS_FIYAT1.TextChanged   += new EventHandler(ALIS_FIYAT1_TextChanged);
     }
     else
     {
         ALIS_FIYAT1.TextChanged -= new EventHandler(ALIS_FIYAT1_TextChanged);
         ALIS_FIYAT1.Text         = "0,00";
         afLastText = ALIS_FIYAT1.Text;
         ALIS_FIYAT1.TextChanged += new EventHandler(ALIS_FIYAT1_TextChanged);
     }
 }
Пример #2
0
 private void PUAN_TextChanged(object sender, EventArgs e)
 {
     if (PUAN.Text != "")
     {
         PUAN.TextChanged -= new EventHandler(PUAN_TextChanged);
         if (PUAN.Text.Contains(","))
         {
             if (Goto724Lib.AfterChr(PUAN.Text, ',').Length > 2)
             {
                 PUAN.Text           = puanLastText;
                 PUAN.SelectionStart = PUAN.Text.Length;
                 PUAN.TextChanged   += new EventHandler(PUAN_TextChanged);
                 return;
             }
             else if (Goto724Lib.BeforeChr(PUAN.Text, ',').Length == 0)
             {
                 PUAN.Text = "0," + Goto724Lib.BeforeChr(PUAN.Text, ',');
             }
             else
             {
                 double numeric = Convert.ToDouble(Goto724Lib.RemoveChar(Goto724Lib.BeforeChr(PUAN.Text, ','), '.'));
                 PUAN.Text = numeric.ToString("#,0") + "," + Goto724Lib.AfterChr(PUAN.Text, ',');
             }
         }
         else
         {
             double doubleVal = Convert.ToDouble(Goto724Lib.RemoveChar(PUAN.Text, '.'));
             PUAN.Text = doubleVal.ToString("#,0");
         }
         puanLastText        = PUAN.Text;
         PUAN.SelectionStart = PUAN.Text.Length;
         PUAN.TextChanged   += new EventHandler(PUAN_TextChanged);
     }
 }
Пример #3
0
        private void SATIS_FIYAT1_Leave(object sender, EventArgs e)
        {
            if (SATIS_FIYAT1.Text != "")
            {
                SATIS_FIYAT1.TextChanged -= new EventHandler(SATIS_FIYAT1_TextChanged);
                double doubleVal = Convert.ToDouble(Goto724Lib.RemoveChar(SATIS_FIYAT1.Text, '.'));
                if (doubleVal == 0.0)
                {
                    SATIS_FIYAT1.Text = "";
                }
                else
                {
                    string decimalStr = "";
                    for (int i = 0; i < 2; i++)
                    {
                        decimalStr += "0";
                    }
                    SATIS_FIYAT1.Text = doubleVal.ToString("#,0." + decimalStr);
                }
                sfLastText = SATIS_FIYAT1.Text;
                SATIS_FIYAT1.SelectionStart = SATIS_FIYAT1.Text.Length;
                SATIS_FIYAT1.TextChanged   += new EventHandler(SATIS_FIYAT1_TextChanged);
            }
            else
            {
                SATIS_FIYAT1.TextChanged -= new EventHandler(SATIS_FIYAT1_TextChanged);
                SATIS_FIYAT1.Text         = "0,00";
                sfLastText = SATIS_FIYAT1.Text;
                SATIS_FIYAT1.TextChanged += new EventHandler(SATIS_FIYAT1_TextChanged);
            }

            GrdStokIskDuzenle();
        }
Пример #4
0
 private void GrdStokIskDuzenle()
 {
     foreach (DataGridViewRow row in grdStokFiyat.Rows)
     {
         double satisFiyat = Convert.ToDouble(Goto724Lib.RemoveChar(SATIS_FIYAT1.Text, '.'));
         double newFiyat   = Convert.ToDouble(Goto724Lib.RemoveChar(row.Cells["grdFiyat"].Value.ToString(), '.'));
         if (newFiyat != 0.0 && satisFiyat != 0.0)
         {
             row.Cells["grdIskonto"].Value = (((satisFiyat - newFiyat) * 100) / satisFiyat) / 100.0;
         }
         else
         {
             row.Cells["grdIskonto"].Value = 0.0;
         }
     }
 }
Пример #5
0
 private void GrdStokFiyat_CellEndEdit(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.ColumnIndex == 1)
         {
             if (grdStokFiyat.Rows[e.RowIndex].Cells["grdFiyat"].Value != null && grdStokFiyat.Rows[e.RowIndex].Cells["grdFiyat"].Value.ToString() != "")
             {
                 grdStokFiyat.Rows[e.RowIndex].Cells["grdFiyat"].Value = Convert.ToDouble(grdStokFiyat.Rows[e.RowIndex].Cells["grdFiyat"].Value.ToString());
                 if (SATIS_FIYAT1.Text != "")
                 {
                     double satisFiyat = Convert.ToDouble(Goto724Lib.RemoveChar(SATIS_FIYAT1.Text, '.'));
                     double newFiyat   = Convert.ToDouble(Goto724Lib.RemoveChar(grdStokFiyat.Rows[e.RowIndex].Cells["grdFiyat"].Value.ToString(), '.'));
                     grdStokFiyat.Rows[e.RowIndex].Cells["grdIskonto"].Value = (((satisFiyat - newFiyat) * 100) / satisFiyat) / 100.0;
                 }
             }
             else
             {
                 grdStokFiyat.Rows[e.RowIndex].Cells["grdFiyat"].Value   = 0;
                 grdStokFiyat.Rows[e.RowIndex].Cells["grdIskonto"].Value = 0;
             }
         }
         else if (e.ColumnIndex == 2)
         {
             if (grdStokFiyat.Rows[e.RowIndex].Cells["grdIskonto"].Value != null && grdStokFiyat.Rows[e.RowIndex].Cells["grdIskonto"].Value.ToString() != "")
             {
                 grdStokFiyat.Rows[e.RowIndex].Cells["grdIskonto"].Value = Convert.ToDouble(grdStokFiyat.Rows[e.RowIndex].Cells["grdIskonto"].Value.ToString()) / 100.0;
                 if (SATIS_FIYAT1.Text != "")
                 {
                     double satisFiyat = Convert.ToDouble(Goto724Lib.RemoveChar(SATIS_FIYAT1.Text, '.'));
                     double newIsk     = Convert.ToDouble(Goto724Lib.RemoveChar(grdStokFiyat.Rows[e.RowIndex].Cells["grdIskonto"].Value.ToString(), '.'));
                     grdStokFiyat.Rows[e.RowIndex].Cells["grdFiyat"].Value = satisFiyat - (satisFiyat * newIsk);
                 }
             }
             else
             {
                 grdStokFiyat.Rows[e.RowIndex].Cells["grdFiyat"].Value   = 0;
                 grdStokFiyat.Rows[e.RowIndex].Cells["grdIskonto"].Value = 0;
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Пример #6
0
 private void PUAN_Leave(object sender, EventArgs e)
 {
     if (PUAN.Text != "")
     {
         PUAN.TextChanged -= new EventHandler(PUAN_TextChanged);
         double doubleVal = Convert.ToDouble(Goto724Lib.RemoveChar(PUAN.Text, '.'));
         if (doubleVal == 0.0)
         {
             PUAN.Text = "";
         }
         else
         {
             string decimalStr = "";
             for (int i = 0; i < 2; i++)
             {
                 decimalStr += "0";
             }
             PUAN.Text = doubleVal.ToString("#,0." + decimalStr);
         }
         puanLastText        = PUAN.Text;
         PUAN.SelectionStart = PUAN.Text.Length;
         PUAN.TextChanged   += new EventHandler(PUAN_TextChanged);
     }
 }
Пример #7
0
        private void BtnKaydet_Click(object sender, EventArgs e)
        {
            if (PROMOSYON_KODU.Text != "" && PROMOSYON_TANIMI.Text != "" && PUAN.Text != "")
            {
                WebService kntlService = new WebService();
                kntlService.SQLText = "SELECT PROMOSYON_KODU FROM TBLPROMOSYON WHERE PROMOSYON_KODU = '" + PROMOSYON_KODU.Text + "'";
                kntlService.Open();
                if (kntlService.DataCount() > 0)
                {
                    /*string image = "";
                     * if (!Goto724Lib.isNoImage(PROMOSYON_RESIM.Image)) image = Goto724Lib.ByteArrayToString(Goto724Lib.ImageToByteArray(PROMOSYON_RESIM.Image));*/

                    string updStr = "UPDATE TBLPROMOSYON SET PROMOSYON_TANIMI = '" + PROMOSYON_TANIMI.Text + "'";

                    updStr += ", PUAN = " + Goto724Lib.RemoveChar(PUAN.Text, '.').Replace(',', '.');
                    updStr += ", STOK_ADEDI = " + Goto724Lib.RemoveChar(STOK_ADEDI.Text, '.').Replace(',', '.');
                    if (PASIF_MI.SelectedIndex == -1 || PASIF_MI.SelectedIndex == 0)
                    {
                        updStr += ", PASIF_MI = 'H'";
                    }
                    else
                    {
                        updStr += ", PASIF_MI = 'E'";
                    }

                    if (ACIKLAMA.Text != "")
                    {
                        updStr += ", ACIKLAMA = '" + ACIKLAMA.Text + "'";
                    }
                    else
                    {
                        updStr += ", ACIKLAMA = NULL";
                    }

                    //if (image != "") updStr += ", PROMOSYON_RESIM = 0x" + image;

                    updStr += " WHERE PROMOSYON_KODU = '" + PROMOSYON_KODU.Text + "'";

                    WebService service = new WebService();
                    service.SQLText = updStr;
                    service.Open();
                    if (service.errorCode == "0")
                    {
                        WebService qryDelResim = new WebService();
                        qryDelResim.SQLText = "DELETE FROM TBLRESIM WHERE TABLO_ADI = 'TBLPROMOSYON' AND TABLO_DEGER = '" + PROMOSYON_KODU.Text + "'";
                        qryDelResim.Open();

                        int sira = 0;
                        foreach (Image image in imageList)
                        {
                            if (!Goto724Lib.isNoImage(image))
                            {
                                WebService qryInsResim = new WebService();
                                qryInsResim.SQLText  = "INSERT INTO TBLRESIM(TABLO_ADI, TABLO_DEGER, SIRA, RESIM) VALUES('TBLPROMOSYON', '" + PROMOSYON_KODU.Text + "', " + sira + ", ";
                                qryInsResim.SQLText += "0X" + Goto724Lib.ByteArrayToString(Goto724Lib.ImageToByteArray(image));
                                qryInsResim.SQLText += ")";
                                qryInsResim.Open();
                            }
                            sira++;
                        }

                        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 image = "";
                     * if (!Goto724Lib.isNoImage(PROMOSYON_RESIM.Image)) image = Goto724Lib.ByteArrayToString(Goto724Lib.ImageToByteArray(PROMOSYON_RESIM.Image));*/

                    string insStr = "INSERT INTO TBLPROMOSYON(PROMOSYON_KODU, PROMOSYON_TANIMI, PUAN, PASIF_MI, ACIKLAMA, STOK_ADEDI ";

                    /*if (image != "") insStr += ", PROMOSYON_RESIM) ";
                     * else insStr += ")";*/
                    insStr += ")";
                    insStr += "VALUES ('" + PROMOSYON_KODU.Text + "', '" + PROMOSYON_TANIMI.Text + "', " + Goto724Lib.RemoveChar(PUAN.Text, '.').Replace(',', '.');
                    if (PASIF_MI.SelectedIndex == -1 || PASIF_MI.SelectedIndex == 0)
                    {
                        insStr += ", 'H'";
                    }
                    else
                    {
                        insStr += ", 'E'";
                    }

                    if (ACIKLAMA.Text != "")
                    {
                        insStr += ", '" + ACIKLAMA.Text + "'";
                    }
                    else
                    {
                        insStr += ", NULL";
                    }

                    if (STOK_ADEDI.Text != "")
                    {
                        insStr += ", '" + Goto724Lib.RemoveChar(STOK_ADEDI.Text, '.').Replace(',', '.') + "'";
                    }
                    else
                    {
                        insStr += ", NULL";
                    }

                    //if (image != "") insStr += ", 0x" + image;
                    insStr += ")";

                    WebService service = new WebService();
                    service.SQLText = insStr;
                    service.Open();
                    if (service.errorCode == "0")
                    {
                        int sira = 0;
                        foreach (Image image in imageList)
                        {
                            if (!Goto724Lib.isNoImage(image))
                            {
                                WebService qryInsResim = new WebService();
                                qryInsResim.SQLText  = "INSERT INTO TBLRESIM(TABLO_ADI, TABLO_DEGER, SIRA, RESIM) VALUES('TBLPROMOSYON', '" + PROMOSYON_KODU.Text + "', " + sira + ", ";
                                qryInsResim.SQLText += "0x" + Goto724Lib.ByteArrayToString(Goto724Lib.ImageToByteArray(image));
                                qryInsResim.SQLText += ")";
                                qryInsResim.Open();
                            }
                            sira++;
                        }

                        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 (PROMOSYON_KODU.Text == "")
                {
                    mesaj = "Tip Kodu";
                }
                else if (PROMOSYON_TANIMI.Text == "")
                {
                    mesaj = "Tip Tanımı";
                }
                else if (PUAN.Text == "")
                {
                    mesaj = "Puan";
                }
                mesaj += " Boş Olamaz";
                GotoMessage.ShowMessage("Bilgi", mesaj);
            }
        }
Пример #8
0
        private void btnKaydet_Click(object sender, EventArgs e)
        {
            if (STOK_KOD.Text != "" && STOK_AD.Text != "" && STOK_KATEGORI.Text != "" && STOK_TIPI.Text != "")
            {
                WebService kntlService = new WebService();
                kntlService.SQLText = "SELECT STOK_KODU FROM TBLSTOK WHERE STOK_KODU = '" + STOK_KOD.Text + "' AND TEDARIKCI_KODU = '" + Goto724Lib.tedarikciKodu + "'";
                kntlService.Open();
                if (kntlService.DataCount() > 0)
                {
                    string image = "";
                    if (imageChanged && !Goto724Lib.isNoImage(STOK_RESIM.Image))
                    {
                        image = Goto724Lib.ByteArrayToString(Goto724Lib.ImageToByteArray(STOK_RESIM.Image));
                    }

                    string updStr = "UPDATE TBLSTOK SET STOK_ADI = '" + STOK_AD.Text + "', TEDARIKCI_KODU = '" + Goto724Lib.tedarikciKodu + "'";

                    if (image != "")
                    {
                        updStr += ", STOK_RESIM = 0x" + image;
                    }

                    if (STOK_TIPI.GetString() != "")
                    {
                        updStr += ", STOK_TIPI = '" + STOK_TIPI.GetString() + "'";
                    }
                    else
                    {
                        updStr += ", STOK_TIPI = NULL";
                    }

                    if (STOK_KATEGORI.GetString() != "")
                    {
                        updStr += ", KATEGORI_KODU = '" + STOK_KATEGORI.GetString() + "'";
                    }
                    else
                    {
                        updStr += ", KATEGORI_KODU = NULL";
                    }

                    if (ACIKLAMA1.Text != "")
                    {
                        updStr += ", ACIKLAMA_1 = '" + ACIKLAMA1.Text + "'";
                    }
                    else
                    {
                        updStr += ", ACIKLAMA_1 = NULL";
                    }

                    if (ACIKLAMA2.Text != "")
                    {
                        updStr += ", ACIKLAMA_2 = '" + ACIKLAMA2.Text + "'";
                    }
                    else
                    {
                        updStr += ", ACIKLAMA_2 = NULL";
                    }

                    if (ACIKLAMA3.Text != "")
                    {
                        updStr += ", ACIKLAMA_3 = '" + ACIKLAMA3.Text + "'";
                    }
                    else
                    {
                        updStr += ", ACIKLAMA_3 = NULL";
                    }

                    if (ALIS_FIYAT1.Text != "")
                    {
                        updStr += ", ALIS_FIYAT1 = " + Goto724Lib.RemoveChar(ALIS_FIYAT1.Text, '.').Replace(',', '.') + "";
                    }
                    else
                    {
                        updStr += ", ALIS_FIYAT1 = NULL";
                    }

                    if (SATIS_FIYAT1.Text != "")
                    {
                        updStr += ", SATIS_FIYAT1 = " + Goto724Lib.RemoveChar(SATIS_FIYAT1.Text, '.').Replace(',', '.') + "";
                    }
                    else
                    {
                        updStr += ", SATIS_FIYAT1 = NULL";
                    }

                    for (int i = 0; i < grdStokFiyat.Rows.Count; i++)
                    {
                        if (grdStokFiyat.Rows[i].Cells["grdFiyat"].Value != null)
                        {
                            updStr += ", SATIS_FIYAT" + (i + 2) + " = " + Goto724Lib.RemoveChar(grdStokFiyat.Rows[i].Cells["grdFiyat"].Value.ToString(), '.').Replace(',', '.');
                        }
                        else
                        {
                            updStr += ", SATIS_FIYAT" + (i + 2) + " = 0";
                        }
                    }

                    //if (ALIS_FIYAT1.Text != "") updStr += ", ALIS_FIYAT1 = '" + ALIS_FIYAT1.Text + "'";
                    //else updStr += ", ALIS_FIYAT1 = NULL";

                    if (PASIF_MI.SelectedIndex == -1 || PASIF_MI.SelectedIndex == 0)
                    {
                        updStr += ", PASIF_MI = 'H'";
                    }
                    else
                    {
                        updStr += ", PASIF_MI = 'E'";
                    }

                    if (STOK_KATEGORI.Text == "Döner Kebap")
                    {
                        if (grdStokOran.Rows[0].Cells["grdEt"].Value == null)
                        {
                            updStr += ", ET_ORAN = 0";
                        }
                        else
                        {
                            updStr += ", ET_ORAN = " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdEt"].Value) * 100).ToString().Replace(',', '.');
                        }
                        if (grdStokOran.Rows[0].Cells["grdKiyma"].Value == null)
                        {
                            updStr += ", KIYMA_ORAN = 0";
                        }
                        else
                        {
                            updStr += ", KIYMA_ORAN = " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdKiyma"].Value) * 100).ToString().Replace(',', '.');
                        }
                        if (grdStokOran.Rows[0].Cells["grdDana"].Value == null)
                        {
                            updStr += ", DANA_ORAN = 0";
                        }
                        else
                        {
                            updStr += ", DANA_ORAN = " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdDana"].Value) * 100).ToString().Replace(',', '.');
                        }
                        if (grdStokOran.Rows[0].Cells["grdSutDana"].Value == null)
                        {
                            updStr += ", SUT_DANA_ORAN = 0";
                        }
                        else
                        {
                            updStr += ", SUT_DANA_ORAN = " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdSutDana"].Value) * 100).ToString().Replace(',', '.');
                        }
                        if (grdStokOran.Rows[0].Cells["grdHindi"].Value == null)
                        {
                            updStr += ", HINDI_ORAN = 0";
                        }
                        else
                        {
                            updStr += ", HINDI_ORAN = " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdHindi"].Value) * 100).ToString().Replace(',', '.');
                        }
                        if (grdStokOran.Rows[0].Cells["grdTavuk"].Value == null)
                        {
                            updStr += ", TAVUK_ORAN = 0";
                        }
                        else
                        {
                            updStr += ", TAVUK_ORAN = " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdTavuk"].Value) * 100).ToString().Replace(',', '.');
                        }
                        if (grdStokOran.Rows[0].Cells["grdYag"].Value == null)
                        {
                            updStr += ", YAG_ORAN = 0";
                        }
                        else
                        {
                            updStr += ", YAG_ORAN = " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdYag"].Value) * 100).ToString().Replace(',', '.');
                        }
                        if (grdStokOran.Rows[0].Cells["grdBaharat"].Value == null)
                        {
                            updStr += ", BAHARAT_ORAN = 0";
                        }
                        else
                        {
                            updStr += ", BAHARAT_ORAN = " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdBaharat"].Value) * 100).ToString().Replace(',', '.');
                        }
                    }

                    updStr += " WHERE STOK_KODU = '" + STOK_KOD.Text + "' AND TEDARIKCI_KODU = '" + Goto724Lib.tedarikciKodu + "'";

                    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 image = "";
                    if (imageChanged && !Goto724Lib.isNoImage(STOK_RESIM.Image))
                    {
                        image = Goto724Lib.ByteArrayToString(Goto724Lib.ImageToByteArray(STOK_RESIM.Image));
                    }

                    string insStr = "INSERT INTO TBLSTOK(STOK_KODU, STOK_ADI, TEDARIKCI_KODU, STOK_TIPI, KATEGORI_KODU, ACIKLAMA_1, ACIKLAMA_2, ACIKLAMA_3, ALIS_FIYAT1, SATIS_FIYAT1, ET_ORAN, KIYMA_ORAN, DANA_ORAN, SUT_DANA_ORAN, HINDI_ORAN, TAVUK_ORAN, YAG_ORAN, BAHARAT_ORAN, SATIS_FIYAT2, SATIS_FIYAT3, SATIS_FIYAT4, SATIS_FIYAT5, SATIS_FIYAT6, SATIS_FIYAT7, SATIS_FIYAT8, PASIF_MI";
                    if (image != "")
                    {
                        insStr += ", STOK_RESIM) ";
                    }
                    else
                    {
                        insStr += ")";
                    }
                    insStr += "VALUES ('" + STOK_KOD.Text + "', '" + STOK_AD.Text + "', '" + Goto724Lib.tedarikciKodu + "'";

                    if (STOK_TIPI.GetString() != "")
                    {
                        insStr += ", '" + STOK_TIPI.GetString() + "'";
                    }
                    else
                    {
                        insStr += ", NULL";
                    }

                    if (STOK_KATEGORI.GetString() != "")
                    {
                        insStr += ", '" + STOK_KATEGORI.GetString() + "'";
                    }
                    else
                    {
                        insStr += ", NULL";
                    }

                    if (ACIKLAMA1.Text != "")
                    {
                        insStr += ", '" + ACIKLAMA1.Text + "'";
                    }
                    else
                    {
                        insStr += ", NULL";
                    }

                    if (ACIKLAMA2.Text != "")
                    {
                        insStr += ", '" + ACIKLAMA2.Text + "'";
                    }
                    else
                    {
                        insStr += ", NULL";
                    }

                    if (ACIKLAMA3.Text != "")
                    {
                        insStr += ", '" + ACIKLAMA3.Text + "'";
                    }
                    else
                    {
                        insStr += ", NULL";
                    }

                    if (ALIS_FIYAT1.Text != "")
                    {
                        insStr += ", '" + Goto724Lib.RemoveChar(ALIS_FIYAT1.Text, '.').Replace(',', '.') + "'";
                    }
                    else
                    {
                        insStr += ", NULL";
                    }

                    if (SATIS_FIYAT1.Text != "")
                    {
                        insStr += ", '" + Goto724Lib.RemoveChar(SATIS_FIYAT1.Text, '.').Replace(',', '.') + "'";
                    }
                    else
                    {
                        insStr += ", NULL";
                    }

                    if (STOK_KATEGORI.Text == "Döner Kebap")
                    {
                        if (grdStokOran.Rows[0].Cells["grdEt"].Value == null)
                        {
                            insStr += ", 0";
                        }
                        else
                        {
                            insStr += ", " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdEt"].Value) * 100).ToString().Replace(',', '.');
                        }
                        if (grdStokOran.Rows[0].Cells["grdKiyma"].Value == null)
                        {
                            insStr += ", 0";
                        }
                        else
                        {
                            insStr += ", " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdKiyma"].Value) * 100).ToString().Replace(',', '.');
                        }
                        if (grdStokOran.Rows[0].Cells["grdDana"].Value == null)
                        {
                            insStr += ", 0";
                        }
                        else
                        {
                            insStr += ", " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdDana"].Value) * 100).ToString().Replace(',', '.');
                        }
                        if (grdStokOran.Rows[0].Cells["grdSutDana"].Value == null)
                        {
                            insStr += ", 0";
                        }
                        else
                        {
                            insStr += ", " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdSutDana"].Value) * 100).ToString().Replace(',', '.');
                        }
                        if (grdStokOran.Rows[0].Cells["grdHindi"].Value == null)
                        {
                            insStr += ", 0";
                        }
                        else
                        {
                            insStr += ", " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdHindi"].Value) * 100).ToString().Replace(',', '.');
                        }
                        if (grdStokOran.Rows[0].Cells["grdTavuk"].Value == null)
                        {
                            insStr += ", 0";
                        }
                        else
                        {
                            insStr += ", " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdTavuk"].Value) * 100).ToString().Replace(',', '.');
                        }
                        if (grdStokOran.Rows[0].Cells["grdYag"].Value == null)
                        {
                            insStr += ", 0";
                        }
                        else
                        {
                            insStr += ", " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdYag"].Value) * 100).ToString().Replace(',', '.');
                        }
                        if (grdStokOran.Rows[0].Cells["grdBaharat"].Value == null)
                        {
                            insStr += ", 0";
                        }
                        else
                        {
                            insStr += ", " + (Convert.ToDouble(grdStokOran.Rows[0].Cells["grdBaharat"].Value) * 100).ToString().Replace(',', '.');
                        }
                    }
                    else
                    {
                        insStr += ",0,0,0,0,0,0,0,0";
                    }

                    for (int i = 0; i < grdStokFiyat.Rows.Count; i++)
                    {
                        if (grdStokFiyat.Rows[i].Cells["grdFiyat"].Value != null)
                        {
                            insStr += ", " + Goto724Lib.RemoveChar(grdStokFiyat.Rows[i].Cells["grdFiyat"].Value.ToString(), '.').Replace(',', '.');
                        }
                        else
                        {
                            insStr += ", 0";
                        }
                    }

                    if (PASIF_MI.SelectedIndex == -1 || PASIF_MI.SelectedIndex == 0)
                    {
                        insStr += ", 'H'";
                    }
                    else
                    {
                        insStr += ", 'E'";
                    }

                    if (image != "")
                    {
                        insStr += ", 0x" + image;
                    }

                    insStr += ")";

                    WebService service = new WebService();
                    service.SQLText = insStr;
                    service.Open();
                    if (service.errorCode == "0")
                    {
                        if (STOK_KATEGORI.Text == "Döner Kebap")
                        {
                            for (int i = 0; i < 20; i++)
                            {
                                WebService paketService = new WebService();
                                paketService.SQLText = "INSERT INTO TBLSTOKPAKET(PAKET_KODU, STOK_KODU, BIRIM_KODU, TEDARIKCI_KODU, MIKTAR, ACIKLAMA)" +
                                                       "VALUES('" + STOK_KOD.Text + "" + (i + 1).ToString("000") + "', '" + STOK_KOD.Text + "', 'KG', '" + Goto724Lib.tedarikciKodu + "', " + ((i + 1) * 5) + ", '" + ((i + 1) * 5) + " Kg" + "')";
                                paketService.Open();
                            }
                        }

                        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 (STOK_KOD.Text == "")
                {
                    mesaj = "Stok Kodu";
                }
                else if (STOK_AD.Text == "")
                {
                    mesaj = "Stok Adı";
                }
                else if (STOK_KATEGORI.Text == "")
                {
                    mesaj = "Kategori";
                }
                else if (STOK_TIPI.Text == "")
                {
                    mesaj = "Stok Tipi";
                }
                mesaj += " Boş Olamaz!!";
                GotoMessage.ShowMessage("Bilgi", mesaj);
            }
        }
Пример #9
0
        private void BtnKaydet_Click(object sender, EventArgs e)
        {
            if (PAKET_KODU.Text != "" && PAKET_TANIMI.Text != "" && STOK_KODU.GetString() != "" && BIRIM_KODU.Text != "" && MIKTAR.Text != "")
            {
                WebService kntlService = new WebService();
                kntlService.SQLText = "SELECT PAKET_KODU FROM TBLSTOKPAKET WHERE PAKET_KODU = '" + PAKET_KODU.Text + "' AND TEDARIKCI_KODU = '" + Goto724Lib.tedarikciKodu + "' AND STOK_KODU = '" + STOK_KODU.GetString() + "'";
                kntlService.Open();
                if (kntlService.DataCount() > 0)
                {
                    string updStr = "UPDATE TBLSTOKPAKET SET ACIKLAMA = '" + PAKET_TANIMI.Text + "'";

                    updStr += ", STOK_KODU = '" + STOK_KODU.GetString() + "'";
                    updStr += ", BIRIM_KODU = '" + BIRIM_KODU.Text + "'";
                    updStr += ", MIKTAR = " + Goto724Lib.RemoveChar(MIKTAR.Text, '.').Replace(',', '.');

                    updStr += " WHERE PAKET_KODU = '" + PAKET_KODU.Text + "' AND TEDARIKCI_KODU = '" + Goto724Lib.tedarikciKodu + "'";

                    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 TBLSTOKPAKET(PAKET_KODU, ACIKLAMA, STOK_KODU, BIRIM_KODU, MIKTAR, TEDARIKCI_KODU)";
                    insStr += "VALUES ('" + PAKET_KODU.Text + "', '" + PAKET_TANIMI.Text + "', '" + STOK_KODU.GetString() + "', '" + BIRIM_KODU.Text + "', '" + Goto724Lib.RemoveChar(MIKTAR.Text, '.').Replace(',', '.') + "', '" + Goto724Lib.tedarikciKodu + "')";

                    WebService service = new WebService();
                    service.SQLText = insStr;
                    service.Open();
                    if (service.errorCode == "0")
                    {
                        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 (PAKET_KODU.Text == "")
                {
                    mesaj = "Paket Kodu";
                }
                else if (PAKET_TANIMI.Text == "")
                {
                    mesaj = "Paket Tanımı";
                }
                else if (STOK_KODU.GetString() == "")
                {
                    mesaj = "Stok Kodu";
                }
                else if (BIRIM_KODU.Text == "")
                {
                    mesaj = "Birim";
                }
                else if (MIKTAR.Text == "")
                {
                    mesaj = "Miktar";
                }
                else if (SATIS_FIYAT.Text == "")
                {
                    mesaj = "Satış Fiyatı";
                }
                mesaj += " Boş Olamaz";
                GotoMessage.ShowMessage("Bilgi", mesaj);
            }
        }