public void UpdateDoctorLoginDetail(DoctorLoginDetail dld)
        {
            DoctorLoginDetail updatedDoctorLoginDetail = database.DoctorLoginDetails.FirstOrDefault(x => x.LoginDetailId == dld.LoginDetailId);

            database.Entry(updatedDoctorLoginDetail).CurrentValues.SetValues(updatedDoctorLoginDetail);
            database.Entry(updatedDoctorLoginDetail).State = EntityState.Modified;
        }
        public bool AddDoctorLoginDetail(DoctorLoginDetail doctorLoginDetail)
        {
            if (doctorLoginDetail.UserName.Length > 20)
            {
                return(false);
            }

            if (doctorLoginDetail.Password.Length > 16)
            {
                return(false);
            }

            return(doctorLoginDetailManagement.AddDoctorLoginDetail(doctorLoginDetail));
        }
        public bool AddDoctorLoginDetail(DoctorLoginDetail dld)
        {
            DoctorLoginDetail dl;

            try
            {
                dl = database.DoctorLoginDetails.Add(dld);
                database.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
 public void RemoveDoctorLoginDetail(DoctorLoginDetail dld)
 {
     if (dld.LoginDetailId <= 0)
     {
         MessageBox.Show("Kayıt Silebilmek İçin Bir Kayıt Seçilmelidir..");
     }
     else
     {
         var selectedDoctorLoginDetail = database.DoctorLoginDetails.FirstOrDefault(x => x.LoginDetailId == dld.LoginDetailId);
         if (selectedDoctorLoginDetail == null)
         {
             MessageBox.Show("Silinebilecek bir kayıt bulunmadı...");
         }
         else
         {
             DialogResult dialogResult = MessageBox.Show($"{dld.LoginDetailId} Numaralı Kaydı Silmek İstediğinizden Emin Misiniz ?", "Doktor Giriş Detay Silme İşlemi", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
             if (dialogResult == DialogResult.OK)
             {
                 database.DoctorLoginDetails.Remove(selectedDoctorLoginDetail);
                 database.SaveChanges();
             }
         }
     }
 }
        public DoctorLoginDetail FindDoctor(DoctorLoginDetail doctor)
        {
            var result = database.DoctorLoginDetails.SingleOrDefault(d => d.UserName == doctor.UserName && d.Password == doctor.Password);

            return(result);
        }
コード例 #6
0
        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;
            }
        }