Beispiel #1
0
        private void smsGönderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //if (gridView1.FocusedRowHandle < 0) return;
            //DataRow dr = gridView1.GetDataRow(gridView1.FocusedRowHandle);

            //string pkFirma = dr["pkFirma"].ToString();
            int       h  = 0;
            DataTable dt = DB.GetData("select pkFirma,Cep,Cep2 from Firmalar with(nolock) where sec=1 and (len(Cep)>9 or len(Cep2)>9)");//pkFirma=" + pkFirma);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string fkFirma = dt.Rows[i]["pkFirma"].ToString();
                string cep     = dt.Rows[i]["Cep"].ToString();
                string cep2    = dt.Rows[i]["Cep2"].ToString();
                if (cep.Length < 9)
                {
                    cep = cep2;
                }

                if (cep.Length < 9)
                {
                    h++;
                    continue;
                }

                ArrayList list = new ArrayList();
                list.Add(new SqlParameter("@fkFirma", fkFirma));
                list.Add(new SqlParameter("@CepTel", cep));
                list.Add(new SqlParameter("@Mesaj", "Bakiye"));

                if (DB.GetData("select fkFirma from Sms where Durumu=0 and fkFirma=" + fkFirma).Rows.Count == 0)
                {
                    string sonuc = DB.ExecuteSQL("INSERT INTO Sms (fkFirma,CepTel,Durumu,Mesaj,Tarih) values(@fkFirma,@CepTel,0,@Mesaj,GetDate())", list);
                    if (sonuc == "0")
                    {
                        DB.ExecuteSQL("update Firmalar set sec=0 where pkFirma=" + fkFirma);
                    }
                }
                else
                {
                    DB.ExecuteSQL("update Firmalar set sec=0 where pkFirma=" + fkFirma);
                }
            }

            //if(h>0)
            //  MessageBox.Show( h.ToString() + " Hatalı Cep No Bilgisilerini Kontrol Ediniz!");

            frmSmsGonder SmsGonder = new frmSmsGonder();

            SmsGonder.Show();

            gridyukle("");
        }
        private void simpleButton9_Click(object sender, EventArgs e)
        {
            if (gridView1.FocusedRowHandle < 0)
            {
                return;
            }
            DataRow dr = gridView1.GetDataRow(gridView1.FocusedRowHandle);

            string    pkFirma = dr["PkFirma"].ToString();
            DataTable dt      = DB.GetData("select * from Firmalar with(nolock) where pkFirma=" + pkFirma);//len(Cep)>9 and

            if (dt.Rows.Count > 0)
            {
                string ceptel  = dt.Rows[0]["Cep"].ToString();
                string ceptel2 = dt.Rows[0]["Cep2"].ToString();
                if (ceptel.Length < 9)
                {
                    ceptel = ceptel2;
                }
                if (ceptel.Length < 9)
                {
                    formislemleri.Mesajform("Cep Telefon Numarası Hatalı.", "K", 200);
                    return;
                }

                ArrayList list = new ArrayList();
                list.Add(new SqlParameter("@fkFirma", pkFirma));
                list.Add(new SqlParameter("@CepTel", dt.Rows[0]["Cep"].ToString()));
                list.Add(new SqlParameter("@Mesaj", "Taksit"));
                if (DB.GetData("select * from Sms with(nolock) where Durumu=0 and fkFirma=" + pkFirma).Rows.Count == 0)
                {
                    DB.ExecuteSQL("INSERT INTO Sms (fkFirma,CepTel,Durumu,Mesaj,Tarih) values(@fkFirma,@CepTel,0,@Mesaj,GetDate())", list);
                }
            }

            frmSmsGonder SmsGonder = new frmSmsGonder();

            SmsGonder.ShowDialog();
        }
        void item_Click_sms_gonder(object sender, EventArgs e)
        {
            //int h = 0;
            //DataTable dt = DB.GetData("select pkFirma,Cep,Cep2 from Firmalar with(nolock) where sec=1 and (len(Cep)>9 or len(Cep2)>9)");//pkFirma=" + pkFirma);
            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
            //    string fkFirma = dt.Rows[i]["pkFirma"].ToString();
            //    string cep = dt.Rows[i]["Cep"].ToString();
            //    string cep2 = dt.Rows[i]["Cep2"].ToString();
            //    if (cep.Length < 9) cep = cep2;

            //    if (cep.Length < 9)
            //    {
            //        h++;
            //        continue;
            //    }

            //    ArrayList list = new ArrayList();
            //    list.Add(new SqlParameter("@fkFirma", fkFirma));
            //    list.Add(new SqlParameter("@CepTel", cep));
            //    list.Add(new SqlParameter("@Mesaj", "Bakiye"));

            //    if (DB.GetData("select fkFirma from Sms where Durumu=0 and fkFirma=" + fkFirma).Rows.Count == 0)
            //    {
            //        string sonuc = DB.ExecuteSQL("INSERT INTO Sms (fkFirma,CepTel,Durumu,Mesaj,Tarih) values(@fkFirma,@CepTel,0,@Mesaj,GetDate())", list);
            //        if (sonuc == "0")
            //            DB.ExecuteSQL("update Firmalar set sec=0 where pkFirma=" + fkFirma);
            //    }
            //    else
            //        DB.ExecuteSQL("update Firmalar set sec=0 where pkFirma=" + fkFirma);
            //}

            frmSmsGonder SmsGonder = new frmSmsGonder();

            SmsGonder.Show();
        }
        private void sMSGönderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmSmsGonder SmsGonder = new frmSmsGonder();

            SmsGonder.ShowDialog();
        }