protected void btnEkle_Click(object sender, EventArgs e) { try { Student ogrenci = new Student(); string yazi; ogrenci.FirstName = txtAd.Text; yazi = txtAd.Text.Substring(0, 2); ogrenci.LastName = txtSoyad.Text; ogrenci.Password = yazi.ToLower() + txtSoyad.Text.ToLower() + "123"; ogrenci.UserName = yazi.ToLower() + "." + txtSoyad.Text.ToLower(); ogrenci.SectionID = Convert.ToInt32(DropDownListBolum.SelectedValue); ogrenci.Email = txtMail.Text; if (chAktif.Checked == true) { ogrenci.IsActive = true; } else { ogrenci.IsActive = false; } db = new BasEntities(); Classroom classroom = db.Classrooms.Find(Convert.ToInt32(DropDownListSinif.SelectedValue)); ogrenci.Classrooms.Add(classroom); bool result = ogrenciislem.Ekle(ogrenci); if (result) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "js", "Bilgilendirme('Öğrenci başarıyla eklendi.','success');", true); txtAd.Text = ""; txtSoyad.Text = ""; } else { ScriptManager.RegisterStartupScript(Page, this.GetType(), "js", "Bilgilendirme('Bir hata oluştu.','error');", true); } } catch (Exception) { throw; } }
public static bool LoginKullanici(string email, string password, bool userNameMi, out int userID) { BasEntities db = new BasEntities(); bool sonuc = false; int id = 0; if (id > 0) { sonuc = true; } else { sonuc = false; } userID = id; return(sonuc); }