コード例 #1
0
        public static int Update(EKullanici eKullanici)
        {
            SqlCommand sqlCommand   = null;
            int        degistirilen = 0;

            try
            {
                sqlCommand             = new SqlCommand("Kitap_Update", Baglan.Con);
                sqlCommand.CommandType = CommandType.StoredProcedure;
                if (sqlCommand.Connection.State != ConnectionState.Open)
                {
                    sqlCommand.Connection.Open();
                }
                sqlCommand.Parameters.AddWithValue("adS", eKullanici.adS);
                sqlCommand.Parameters.AddWithValue("email", eKullanici.email);
                sqlCommand.Parameters.AddWithValue("telefon", eKullanici.telefon);

                degistirilen = sqlCommand.ExecuteNonQuery();
                MessageBox.Show("Güncelleme başarılı");
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                degistirilen = -1;
            }
            finally
            {
                sqlCommand.Connection.Close();
            }
            return(degistirilen);
        }
コード例 #2
0
        public static int Insert(EKullanici eKullanici)
        {
            SqlCommand sqlCommand = null;
            int        girilen    = 0;

            try
            {
                sqlCommand             = new SqlCommand("Kullanici_Ekle", Baglan.Con);
                sqlCommand.CommandType = CommandType.StoredProcedure;
                if (sqlCommand.Connection.State != ConnectionState.Open)
                {
                    sqlCommand.Connection.Open();
                }
                sqlCommand.Parameters.AddWithValue("adS", eKullanici.adS);
                sqlCommand.Parameters.AddWithValue("email", eKullanici.email);
                sqlCommand.Parameters.AddWithValue("telefon", eKullanici.telefon);
                sqlCommand.Parameters.AddWithValue("password", eKullanici.password);
                girilen = sqlCommand.ExecuteNonQuery();
                MessageBox.Show("Ekleme başarılı");
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            finally
            {
                sqlCommand.Connection.Close();
            }
            return(girilen);
        }
コード例 #3
0
 public static int Update(EKullanici eKullanici)
 {
     if (eKullanici.adS != null && eKullanici.email.Trim().Length > 0 && eKullanici.kullaniciId > 0)
     {
         return(FKullanici.Update(eKullanici));
     }
     return(-1);
 }
コード例 #4
0
 public static int Insert(EKullanici eKullanici)
 {
     if (eKullanici.email != null && eKullanici.email.Trim().Length > 0 && eKullanici.password != null && eKullanici.password.Trim().Length > 0)
     {
         return(FKullanici.Insert(eKullanici));
     }
     return(-1);
 }
コード例 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            EKullanici yeniKullanici = new EKullanici();

            yeniKullanici.adS      = adSoyadText.Text;
            yeniKullanici.email    = emailText.Text;
            yeniKullanici.password = sifreText.Text;
            yeniKullanici.telefon  = telefonText.Text;
            BKullanici.Insert(yeniKullanici);
        }
コード例 #6
0
        public static List <EKullanici> FirmaGorevlileri()
        {
            List <EKullanici> fGorevlileri = null;
            SqlCommand        sqlCommand   = null;

            try
            {
                sqlCommand             = new SqlCommand("Firma_Yetkilileri_Getir", Baglan.Con);
                sqlCommand.CommandType = CommandType.StoredProcedure;
                if (sqlCommand.Connection.State != ConnectionState.Open)
                {
                    sqlCommand.Connection.Open();
                }
                SqlDataReader rdr = sqlCommand.ExecuteReader();
                if (rdr.HasRows)
                {
                    fGorevlileri = new List <EKullanici>();
                    while (rdr.Read())
                    {
                        EKullanici kul = new EKullanici();
                        kul.kullaniciId = Convert.ToInt32(rdr["kullaniciId"]);
                        kul.adS         = rdr["adS"].ToString();
                        kul.email       = rdr["email"].ToString();
                        kul.telefon     = rdr["telefon"].ToString();

                        fGorevlileri.Add(kul);
                    }
                }
                rdr.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                fGorevlileri = null;
            }
            finally
            {
                sqlCommand.Connection.Close();
            }

            return(fGorevlileri);
        }
コード例 #7
0
        public static EKullanici BirKullanici(int Id)
        {
            EKullanici kullanici  = null;
            SqlCommand sqlCommand = null;

            try
            {
                sqlCommand             = new SqlCommand("Kullanici_Getir", Baglan.Con);
                sqlCommand.CommandType = CommandType.StoredProcedure;
                if (sqlCommand.Connection.State != ConnectionState.Open)
                {
                    sqlCommand.Connection.Open();
                }
                sqlCommand.Parameters.AddWithValue("ID", Id);
                SqlDataReader rdr = sqlCommand.ExecuteReader();
                if (rdr.HasRows)
                {
                    while (rdr.Read())
                    {
                        kullanici         = new EKullanici();
                        kullanici.adS     = rdr["adS"].ToString();
                        kullanici.email   = rdr["email"].ToString();
                        kullanici.telefon = rdr["telefon"].ToString();
                    }
                }
                rdr.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                kullanici = null;
            }
            finally
            {
                sqlCommand.Connection.Close();
            }

            return(kullanici);
        }