Exemplo n.º 1
0
 private void button3_Click(object sender, EventArgs e)
 {
     //Kasiyer Silme Butonu
     if (!String.IsNullOrEmpty(textBox2.Text) && !String.IsNullOrEmpty(textBox3.Text) && !String.IsNullOrEmpty(textBox4.Text) && !String.IsNullOrEmpty(maskedTextBox1.Text) && !String.IsNullOrEmpty(textBox5.Text) && !String.IsNullOrEmpty(textBox6.Text) && !String.IsNullOrEmpty(textBox7.Text) && !String.IsNullOrEmpty(textBox8.Text))
     {
         if (String.IsNullOrEmpty(dataGridView1.CurrentRow.Index.ToString()))
         {
             MessageBox.Show("Kasiyer seçmediniz!!!");
         }
         else
         {
             var a = MessageBox.Show(" Silmek istediğinize emin misiniz?", "Bilgilendirme", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (a == DialogResult.Yes)
             {
                 Cashier m = HelperCashier.GetByID(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value));
                 m.IsActive = false;
                 var b = HelperCashier.CUD(m, System.Data.Entity.EntityState.Modified);
                 if (b.Item2)
                 {
                     MessageBox.Show("Silme işlemi başarılı");
                 }
                 else
                 {
                     MessageBox.Show("Silme yapılamadı");
                 }
             }
             Yenile();
         }
     }
     else
     {
         MessageBox.Show("Lütfen seçim yapınız.");
     }
 }
Exemplo n.º 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     //Kasiyer ekleme butonu
     if (!String.IsNullOrEmpty(textBox2.Text) && !String.IsNullOrEmpty(textBox3.Text) && !String.IsNullOrEmpty(textBox4.Text) && !String.IsNullOrEmpty(maskedTextBox1.Text) && !String.IsNullOrEmpty(textBox5.Text) && !String.IsNullOrEmpty(textBox6.Text) && !String.IsNullOrEmpty(textBox7.Text) && !String.IsNullOrEmpty(textBox8.Text))
     {
         if (!HelperCashier.SearchUserName(textBox7.Text))
         {
             MessageBox.Show("Aynı kullanıcı adı mevcut. Lütfen kullanıcı adını değiştiriniz.");
         }
         else
         {
             Cashier c = new Cashier()
             {
                 name     = textBox2.Text,
                 surname  = textBox3.Text,
                 tcNo     = textBox4.Text,
                 gsm      = maskedTextBox1.Text,
                 address  = textBox5.Text,
                 salary   = Convert.ToInt32(textBox6.Text),
                 userName = textBox7.Text,
                 password = textBox8.Text,
                 IsActive = true,
             };
             Users us = new Users()
             {
                 userName = textBox7.Text,
                 password = textBox8.Text,
                 userType = 2
             };
             var ekle  = HelperCashier.CUD(c, System.Data.Entity.EntityState.Added);
             var ekle2 = HelperUsers.CUD(us, System.Data.Entity.EntityState.Added);
             if (ekle.Item2)
             {
                 MessageBox.Show("Kasiyer ekleme başarılı.");
             }
             else
             {
                 MessageBox.Show("Kasiyer eklenemedi");
             }
             Yenile();
         }
     }
     else
     {
         MessageBox.Show("Lütfen tüm alanları doldurunuz.");
     }
     textBox2.Clear();
     textBox3.Clear();
     textBox4.Clear();
     maskedTextBox1.Clear();
     textBox5.Clear();
     textBox6.Clear();
     textBox7.Clear();
     textBox8.Clear();
 }
Exemplo n.º 3
0
 private void button4_Click(object sender, EventArgs e)
 {
     //Kasiyer Düzenleme butonu
     if (!String.IsNullOrEmpty(textBox2.Text) && !String.IsNullOrEmpty(textBox3.Text) && !String.IsNullOrEmpty(textBox4.Text) && !String.IsNullOrEmpty(maskedTextBox1.Text) && !String.IsNullOrEmpty(textBox5.Text) && !String.IsNullOrEmpty(textBox6.Text) && !String.IsNullOrEmpty(textBox7.Text) && !String.IsNullOrEmpty(textBox8.Text))
     {
         Cashier c = HelperCashier.GetByID(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value));
         c.name     = textBox2.Text;
         c.surname  = textBox3.Text;
         c.tcNo     = textBox4.Text;
         c.gsm      = maskedTextBox1.Text;
         c.address  = textBox5.Text;
         c.salary   = Convert.ToInt32(textBox6.Text);
         c.userName = textBox7.Text;
         c.password = textBox8.Text;
         var degistir = HelperCashier.CUD(c, System.Data.Entity.EntityState.Modified);
         if (degistir.Item2)
         {
             MessageBox.Show("Güncelleme başarılı.");
         }
         else
         {
             MessageBox.Show("Güncelleme yapılamadı.");
         }
         Yenile();
     }
     else
     {
         MessageBox.Show("Lütfen tüm alanları doldurunuz.");
     }
     textBox2.Clear();
     textBox3.Clear();
     textBox4.Clear();
     maskedTextBox1.Clear();
     textBox5.Clear();
     textBox6.Clear();
     textBox7.Clear();
     textBox8.Clear();
 }