Пример #1
0
        public static BLLResult DataBaseResultToBLLResult(DAL.Extensions.DataBaseResult dataBaseResult)
        {
            BLLResult result = BLLResult.Error;

            switch (dataBaseResult)
            {
            case DAL.Extensions.DataBaseResult.Success:
                result = BLLResult.Success;
                break;

            case DAL.Extensions.DataBaseResult.AlreadyFound:
                result = BLLResult.AlreadyFound;
                break;

            case DAL.Extensions.DataBaseResult.Referanced:
                result = BLLResult.Referanced;
                break;

            case DAL.Extensions.DataBaseResult.NotFound:
                result = BLLResult.NotFound;
                break;

            case DAL.Extensions.DataBaseResult.Error:
                result = BLLResult.Error;
                break;

            case DAL.Extensions.DataBaseResult.ServerDisable:
                result = BLLResult.ServerDisable;
                break;

            default:
                throw new ArgumentOutOfRangeException("dataBaseResult", dataBaseResult, null);
            }
            return(result);
        }
Пример #2
0
        public ProcessResult Update(Patient newInfoPatient)
        {
            ProcessResult processResult = ValidateModel(newInfoPatient, true);

            if (processResult.Result != Extensions.BLLResult.Verified)
            {
                return(processResult);
            }
            Patient patient = Select(newInfoPatient.TcNo);

            if (patient != null && patient.Id != newInfoPatient.Id)
            {
                processResult.Errors.Add("Girilen kimlik numarasıyla başka bir hasta kaydı zaten bulunmaktadır");
                processResult.Result = Extensions.BLLResult.AlreadyFound;
                return(processResult);
            }
            DAL.Extensions.DataBaseResult result = _patientDal.Update(newInfoPatient);

            switch (result)
            {
            case DAL.Extensions.DataBaseResult.Success:
                processResult.Result = Extensions.BLLResult.Success;
                processResult.Errors.Add(Extensions.SuccessProcess);
                break;

            case DAL.Extensions.DataBaseResult.Error:
                processResult.Errors.Add(Extensions.InnerException);
                processResult.Result = Extensions.BLLResult.Error;
                break;

            case DAL.Extensions.DataBaseResult.NotFound:
                processResult.Errors.Add(Extensions.NotFound);
                processResult.Result = Extensions.BLLResult.NotFound;
                break;

            case DAL.Extensions.DataBaseResult.ServerDisable:
                processResult.Result = Extensions.BLLResult.ServerDisable;
                processResult.Errors.Add(Extensions.ServerDisable);
                break;

            case DAL.Extensions.DataBaseResult.AlreadyFound:
                break;

            case DAL.Extensions.DataBaseResult.Referanced:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(processResult);
        }
Пример #3
0
        public ProcessResult Insert(Patient newPatient)
        {
            ProcessResult result = ValidateModel(newPatient, false);

            if (result.Result != Extensions.BLLResult.Verified)
            {
                return(result);
            }

            newPatient.Password = Char.ToLower(newPatient.MotherName[0]) + newPatient.TcNo.Substring(8) +
                                  Char.ToLower(newPatient.FatherName[0]) +
                                  newPatient.BirthDay.Day;

            DAL.Extensions.DataBaseResult insert = _patientDal.Insert(newPatient);
            switch (insert)
            {
            case DAL.Extensions.DataBaseResult.AlreadyFound:
                result.Result = Extensions.BLLResult.AlreadyFound;
                result.Errors.Add(
                    Extensions.AlreadyFoundString(String.Format("{0} kimlik numaralı {1} {2}", newPatient.TcNo,
                                                                newPatient.Name, newPatient.Surname)));
                break;

            case DAL.Extensions.DataBaseResult.Success:
                result.Result = Extensions.BLLResult.Success;
                result.Errors.Add(Extensions.SuccessProcess);
                break;

            case DAL.Extensions.DataBaseResult.Error:
                result.Result = Extensions.BLLResult.InnerException;
                result.Errors.Add(Extensions.InnerException);
                break;

            case DAL.Extensions.DataBaseResult.ServerDisable:
                result.Result = Extensions.BLLResult.ServerDisable;
                result.Errors.Add(Extensions.ServerDisable);
                break;

            case DAL.Extensions.DataBaseResult.Referanced:
                break;

            case DAL.Extensions.DataBaseResult.NotFound:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(result);
        }
Пример #4
0
        public ProcessResult Update(Country newInfoCountry)
        {
            ProcessResult result = VerifeyModel(newInfoCountry);

            if (result.Result != Extensions.BLLResult.Verified)
            {
                return(result);
            }

            DAL.Extensions.DataBaseResult insert = _countryDal.Update(newInfoCountry);

            switch (insert)
            {
            //case DAL.Extensions.DataBaseResult.AlreadyFound:
            //    result.Result = Extensions.BLLResult.AlreadyFound;
            //    result.Errors.Add(Extensions.AlreadyFoundString(newInfoCountry.Name));
            //    break;
            case DAL.Extensions.DataBaseResult.Error:
                result.Result = Extensions.BLLResult.InnerException;
                result.Errors.Add(Extensions.InnerException);
                break;

            case DAL.Extensions.DataBaseResult.Success:
                result.Result = Extensions.BLLResult.Success;
                result.Errors.Add(Extensions.SuccessProcess);
                break;

            case DAL.Extensions.DataBaseResult.ServerDisable:
                result.Result = Extensions.BLLResult.ServerDisable;
                result.Errors.Add(Extensions.ServerDisable);
                break;

            case DAL.Extensions.DataBaseResult.AlreadyFound:
                break;

            case DAL.Extensions.DataBaseResult.Referanced:
                break;

            case DAL.Extensions.DataBaseResult.NotFound:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(result);
        }
Пример #5
0
        public ProcessResult Insert(Degree newDegree)
        {
            ProcessResult result = ValidateModel(newDegree);

            if (result.Result != Extensions.BLLResult.Verified)
            {
                return(result);
            }

            result.Errors.Clear();

            DAL.Extensions.DataBaseResult insert = _degreeDal.Insert(newDegree);

            switch (insert)
            {
            case DAL.Extensions.DataBaseResult.Success:
                result.Result = Extensions.BLLResult.Success;
                result.Errors.Add(Extensions.SuccessProcess);
                break;

            case DAL.Extensions.DataBaseResult.AlreadyFound:
                result.Result = Extensions.BLLResult.AlreadyFound;
                result.Errors.Add(Extensions.AlreadyFoundString(newDegree.Name));
                break;

            case DAL.Extensions.DataBaseResult.Error:
                result.Result = Extensions.BLLResult.InnerException;
                result.Errors.Add(Extensions.InnerException);
                break;

            case DAL.Extensions.DataBaseResult.ServerDisable:
                result.Result = Extensions.BLLResult.ServerDisable;
                result.Errors.Add(Extensions.ServerDisable);
                break;

            case DAL.Extensions.DataBaseResult.Referanced:
                break;

            case DAL.Extensions.DataBaseResult.NotFound:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(result);
        }
        public ProcessResult Delete(int id)
        {
            ProcessResult result = new ProcessResult();

            DAL.Extensions.DataBaseResult delete = _diagnosisDal.Delete(id);
            switch (delete)
            {
            case DAL.Extensions.DataBaseResult.Success:
                result.Result = Extensions.BLLResult.Success;
                result.Errors.Add(Extensions.SuccessProcess);
                break;

            case DAL.Extensions.DataBaseResult.Referanced:
                result.Result = Extensions.BLLResult.Referanced;
                result.Errors.Add("Teşhisler başka tablolar üzerinde refere edildiğinden silinemedi");
                break;

            case DAL.Extensions.DataBaseResult.NotFound:
                result.Result = Extensions.BLLResult.NotFound;
                result.Errors.Add(Extensions.NotFound);
                break;

            case DAL.Extensions.DataBaseResult.Error:
                result.Result = Extensions.BLLResult.InnerException;
                result.Errors.Add(Extensions.InnerException);
                break;

            case DAL.Extensions.DataBaseResult.ServerDisable:
                result.Result = Extensions.BLLResult.ServerDisable;
                result.Errors.Add(Extensions.ServerDisable);
                break;

            case DAL.Extensions.DataBaseResult.AlreadyFound:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(result);
        }
Пример #7
0
        public ProcessResult Update(Holiday newInfoHoliday)
        {
            newInfoHoliday.Name = newInfoHoliday.Name.Trim();
            ProcessResult result = new ProcessResult();

            DAL.Extensions.DataBaseResult update = holidayDal.Update(newInfoHoliday);

            switch (update)
            {
            case DAL.Extensions.DataBaseResult.AlreadyFound:
                result.Result = Extensions.BLLResult.AlreadyFound;
                result.Errors.Add(Extensions.AlreadyFoundString(newInfoHoliday.Name));
                break;

            case DAL.Extensions.DataBaseResult.Error:
                result.Result = Extensions.BLLResult.InnerException;
                result.Errors.Add(Extensions.InnerException);
                break;

            case DAL.Extensions.DataBaseResult.Success:
                result.Result = Extensions.BLLResult.Success;
                result.Errors.Add(Extensions.SuccessProcess);
                break;

            case DAL.Extensions.DataBaseResult.ServerDisable:
                result.Result = Extensions.BLLResult.ServerDisable;
                result.Errors.Add(Extensions.ServerDisable);
                break;

            case DAL.Extensions.DataBaseResult.Referanced:
                break;

            case DAL.Extensions.DataBaseResult.NotFound:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(result);
        }
Пример #8
0
        public ProcessResult Delete(int id)
        {
            ProcessResult processResult = new ProcessResult();

            DAL.Extensions.DataBaseResult result = _patientDal.Delete(id);
            switch (result)
            {
            case DAL.Extensions.DataBaseResult.Success:
                processResult.Result = Extensions.BLLResult.Success;
                processResult.Errors.Add(Extensions.SuccessProcess);
                break;

            case DAL.Extensions.DataBaseResult.Referanced:
                processResult.Result = Extensions.BLLResult.Referanced;
                processResult.Errors.Add("Silinmeye çalışılan hasta başka işlemlerle ilişkili olduğundan silinemedi");
                break;

            case DAL.Extensions.DataBaseResult.NotFound:
                processResult.Result = Extensions.BLLResult.NotFound;
                processResult.Errors.Add(Extensions.NotFound);
                break;

            case DAL.Extensions.DataBaseResult.Error:
                processResult.Result = Extensions.BLLResult.InnerException;
                processResult.Errors.Add(Extensions.InnerException);
                break;

            case DAL.Extensions.DataBaseResult.ServerDisable:
                processResult.Result = Extensions.BLLResult.ServerDisable;
                processResult.Errors.Add(Extensions.ServerDisable);
                break;

            case DAL.Extensions.DataBaseResult.AlreadyFound:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(processResult);
        }
Пример #9
0
        public ProcessResult Delete(int id)
        {
            DAL.Extensions.DataBaseResult delete = holidayDal.Delete(id);

            ProcessResult result = new ProcessResult();

            switch (delete)
            {
            case DAL.Extensions.DataBaseResult.Success:
                result.Result = Extensions.BLLResult.Success;
                result.Errors.Add(Extensions.SuccessProcess);
                break;

            case DAL.Extensions.DataBaseResult.NotFound:
                result.Result = Extensions.BLLResult.NotFound;
                result.Errors.Add(Extensions.NotFound);
                break;

            case DAL.Extensions.DataBaseResult.Error:
                result.Result = Extensions.BLLResult.InnerException;
                result.Errors.Add(Extensions.InnerException);
                break;

            case DAL.Extensions.DataBaseResult.ServerDisable:
                result.Result = Extensions.BLLResult.ServerDisable;
                result.Errors.Add(Extensions.ServerDisable);
                break;

            case DAL.Extensions.DataBaseResult.AlreadyFound:
                break;

            case DAL.Extensions.DataBaseResult.Referanced:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(result);
        }
        public ProcessResult Insert(Rendezvous newRendezvous, bool toExamination)
        {
            newRendezvous.IsActive = !toExamination;
            newRendezvous.Date     = toExamination ? DateTime.Today : newRendezvous.Date;

            ProcessResult result = Verifyrendezvous(newRendezvous);

            if (result.Result != Extensions.BLLResult.Verified)
            {
                return(result);
            }

            result = IsHoliday(newRendezvous.Date);
            if (result.Result != Extensions.BLLResult.Success)
            {
                return(result);
            }

            result = IsExistOtherRendezvous(newRendezvous);
            if (result.Result == Extensions.BLLResult.AlreadyFound)
            {
                return(result);
            }

            DAL.Extensions.DataBaseResult baseResult = _rendezvousDal.Insert(ref newRendezvous);

            switch (baseResult)
            {
            case DAL.Extensions.DataBaseResult.Error:
                result.Errors.Add(Extensions.InnerException);
                result.Result = Extensions.BLLResult.InnerException;
                break;

            case DAL.Extensions.DataBaseResult.ServerDisable:
                result.Result = Extensions.BLLResult.ServerDisable;
                result.Errors.Add(Extensions.ServerDisable);
                break;

            case DAL.Extensions.DataBaseResult.Success:
                break;

            case DAL.Extensions.DataBaseResult.AlreadyFound:
                break;

            case DAL.Extensions.DataBaseResult.Referanced:
                break;

            case DAL.Extensions.DataBaseResult.NotFound:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            if (toExamination)
            {
                DiagnosisManager   diagnosisManager = new DiagnosisManager();
                Diagnosis          diagnosis        = diagnosisManager.GetDefaultDiagnosis();
                ExaminationManager manager          = new ExaminationManager();
                manager.Insert(new Examination
                {
                    CanSendMessage = false, PatientId = newRendezvous.PatientId, DoctorId = newRendezvous.DoctorId, Time = newRendezvous.Date, RendezvousId = newRendezvous.Id, IsActive = true, DiagnosisId = diagnosis.Id
                });
            }

            result.Errors.Add(Extensions.SuccessProcess);
            result.Errors.Add(String.Format("Kayıt numarası: {0}", newRendezvous.Id));
            result.Result = Extensions.BLLResult.Success;
            return(result);
        }
Пример #11
0
        public ProcessResult Insert(Holiday newHoliday, int holidayLenght, bool everyYear)
        {
            newHoliday.Year = everyYear ? null : newHoliday.Year;
            newHoliday.Name = newHoliday.Name.Trim();
            ProcessResult result = VelidateModel(newHoliday);

            if (result.Result != Extensions.BLLResult.Verified)
            {
                return(result);
            }
            DAL.Extensions.DataBaseResult insert = DAL.Extensions.DataBaseResult.Error;

            if (holidayLenght == 1)
            {
                insert = holidayDal.Insert(newHoliday);
            }
            else
            {
                for (int i = 1; i <= holidayLenght; i++)
                {
                    DateTime time = new DateTime(newHoliday.Year ?? 1, newHoliday.Month, newHoliday.Day).AddDays(i - 1);
                    insert = holidayDal.Insert(new Holiday
                    {
                        Name  = String.Format("{0} {1}. Gün", newHoliday.Name, i),
                        Year  = newHoliday.Year == null ? (int?)null : time.Year,
                        Month = time.Month,
                        Day   = time.Day
                    });
                }
            }

            switch (insert)
            {
            case DAL.Extensions.DataBaseResult.AlreadyFound:
                result.Result = Extensions.BLLResult.AlreadyFound;
                result.Errors.Add(Extensions.AlreadyFoundString(newHoliday.Name));
                break;

            case DAL.Extensions.DataBaseResult.Error:
                result.Result = Extensions.BLLResult.InnerException;
                result.Errors.Add(Extensions.InnerException);
                break;

            case DAL.Extensions.DataBaseResult.Success:
                result.Result = Extensions.BLLResult.Success;
                result.Errors.Add(Extensions.SuccessProcess);
                break;

            case DAL.Extensions.DataBaseResult.ServerDisable:
                result.Result = Extensions.BLLResult.ServerDisable;
                result.Errors.Add(Extensions.ServerDisable);
                break;

            case DAL.Extensions.DataBaseResult.Referanced:
                break;

            case DAL.Extensions.DataBaseResult.NotFound:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(result);
        }