public void UpdatePharmacistLoginDetail(PharmacistLoginDetail pl) { PharmacistLoginDetail updatedPharmacistLoginDetail = database.PharmacistLoginDetails.FirstOrDefault(x => x.PharmacistId == pl.PharmacistId); database.Entry(updatedPharmacistLoginDetail).CurrentValues.SetValues(updatedPharmacistLoginDetail); database.Entry(updatedPharmacistLoginDetail).State = EntityState.Modified; }
public bool AddPharmacistLoginDetail(PharmacistLoginDetail pharmacistLoginDetail) { if (pharmacistLoginDetail.UserName.Length > 20) { return(false); } if (pharmacistLoginDetail.Password.Length > 16) { return(false); } return(pharmacistLoginDetailManagement.AddPharmacistLoginDetail(pharmacistLoginDetail)); }
public PharmacistLoginDetail FindPharmacist(PharmacistLoginDetail pharmacist) { var result = database.PharmacistLoginDetails.SingleOrDefault(p => p.UserName == pharmacist.UserName && p.Password == pharmacist.Password); return(result); //if (result==null) //{ // return false; //} //else //{ // return true; //} }
public bool AddPharmacistLoginDetail(PharmacistLoginDetail pl) { PharmacistLoginDetail pld; try { pld = database.PharmacistLoginDetails.Add(pl); database.SaveChanges(); return(true); } catch { return(false); } }
public void RemovePharmacistLoginDetail(PharmacistLoginDetail pl) { if (pl.PharmacistId <= 0) { MessageBox.Show("Kayıt Silebilmek İçin Bir Kayıt Seçilmelidir.."); } else { var selectedPharmacistLoginDetail = database.PharmacistLoginDetails.FirstOrDefault(x => x.PharmacistId == pl.PharmacistId); if (selectedPharmacistLoginDetail == null) { MessageBox.Show("Silinebilecek bir kayıt bulunmadı..."); } else { DialogResult dialogResult = MessageBox.Show($"{pl.PharmacistId} Numaralı Kaydı Silmek İstediğinizden Emin Misiniz ?", "Eczacı Giriş Detayı Silme İşlemi", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (dialogResult == DialogResult.OK) { database.PharmacistLoginDetails.Remove(selectedPharmacistLoginDetail); database.SaveChanges(); } } } }
private void btnLogin_Click(object sender, EventArgs e) { var passwordResult = Validator.isPasswordValid(txtPassword.Text); switch (rol) { case 1: var mailResult = Validator.isEmailValid(txtEmail.Text); if (mailResult == false && passwordResult == false) { lblWarning.Text = "Lütfen Kullanıcı Bilgilerinizi Doğru Formatta Giriniz!"; } //Kullanıcı Adı ve Şifre Yanlışsa else { PatientLoginDetailManagement patientLogin = new PatientLoginDetailManagement(); PatientLoginDetail patient = new PatientLoginDetail { UserName = txtEmail.Text.Trim(), Password = txtPassword.Text.Trim() }; var patientResult = patientLogin.FindPatient(patient); if (patientResult == null) { lblWarning.Text = "Lütfen Kullanıcı Bilgilerini Kontrol Ediniz!"; } else { AppointmentSystem appointmentSystem = new AppointmentSystem(); appointmentSystem.UserID = patientResult.PatientId; appointmentSystem.Show(); } } //Kullanıcı Adı ve Şifre Doğruysa break; case 2: var drusernameResult = Validator.isDoctorUserNameValid(txtEmail.Text); if (drusernameResult == false && passwordResult == false) { lblWarning.Text = "Lütfen Kullanıcı Bilgilerinizi Doğru Formatta Giriniz!"; } else { DoctorLoginDetailManagement doctorLogin = new DoctorLoginDetailManagement(); DoctorLoginDetail doctor = new DoctorLoginDetail { UserName = txtEmail.Text.Trim(), Password = txtPassword.Text.Trim() }; if (doctorLogin.FindDoctor(doctor) == null) { lblWarning.Text = "Lütfen Kullanıcı Bilgilerini Kontrol Ediniz!"; } else { DoctorSystemScreen doctorSystemScreen = new DoctorSystemScreen(); doctorSystemScreen.doctorId = doctorLogin.FindDoctor(doctor).DoctorId; doctorSystemScreen.Show(); } } break; case 3: var phusernameResult = Validator.isPharmacistUserNameValid(txtEmail.Text); PharmacistLoginDetailManagement pharmacistLogin = new PharmacistLoginDetailManagement(); PharmacistLoginDetail pharmacist = new PharmacistLoginDetail { UserName = txtEmail.Text.Trim(), Password = txtPassword.Text.Trim() }; if (phusernameResult == false && passwordResult == false) { lblWarning.Text = "Lütfen Kullanıcı Bilgilerinizi Doğru Formatta Giriniz!"; } else { var pharmacistResult = pharmacistLogin.FindPharmacist(pharmacist); if (pharmacist == null) { lblWarning.Text = "Lütfen Kullanıcı Bilgilerini Kontrol Ediniz!"; } else { PharmacistSystemScreen pharmacistSystemScreen = new PharmacistSystemScreen(); pharmacistSystemScreen.getPharmacistId = pharmacistResult.PharmacistId; pharmacistSystemScreen.Show(); } } break; } }