示例#1
0
    public static object GetDoctorById(string id)
    {
        var doc = new DoctorManager().GetDoctorById(id);

        doc.Experience = doc.Experience.Replace("years", "").Replace("Years", "").Replace("year", "").Replace("Year", "").Trim();
        return(doc);
    }
示例#2
0
        public ActionResult Register(Doctor newDoctor)
        {
            // Validate doctor data from the transaction
            if (newDoctor == null)
            {
                ViewBag.message = "Error: Invalid Request - please try again";
                return(View(new Doctor()));
            }
            if (newDoctor.DoctorID == null || newDoctor.DoctorID.Length == 0)
            {
                ViewBag.message = "Error: ID is required";
                return(View(newDoctor));
            }
            if (newDoctor.Password == null || newDoctor.Password.Length == 0)
            {
                ViewBag.message = "Error: Name is required";
                return(View(newDoctor));
            }

            // Add the doctor
            bool result = DoctorManager.AddNewDoctor(newDoctor);

            if (result)
            {
                ViewBag.message = "Doctor is added";
            }
            else
            {
                ViewBag.message = "That doctor could not be added";
            }

            Doctor[] doctors = DoctorManager.GetAllDoctors();
            return(View("List", doctors));
        }
示例#3
0
        private void CreateOrder_OnClick(object sender, RoutedEventArgs e)
        {
            if (Recipe.Medicines == null || Recipe.Patient == null)
            {
                return;
            }

            var doctor = new Doctor()
            {
                LastName      = doctorLastName.Text,
                FirstName     = doctorFirstName.Text,
                SecondaryName = doctorFathersName.Text
            };

            try
            {
                var doctorId = DoctorManager.Insert(doctor);
                Recipe.Doctor = new Doctor(doctorId);
            }
            catch (SqlException ex)
            {
                MessageBox.Show("Doctor information is empty");
                return;
            }

            Guid recipeId;

            try
            {
                Recipe.Diagnoz = diagnoz.Text;
                recipeId       = RecipeManager.Insert(Recipe);
            }
            catch (SqlException ex)
            {
                MessageBox.Show("Recipe information is empty");
                return;
            }

            var order = new Order
            {
                Recipe      = new Recipe(recipeId),
                TotalPrice  = Recipe.Medicines.Sum(m => m.Price),
                PhoneNumber = Recipe.Patient.PhoneNumber,
                OrderDate   = DateTime.Now,
                AvailabilityOfComponents = new Random().Next(100),
                MakeState = OrderState.Open,
                ReadyTime = DateTime.Now.AddDays(new Random().Next(1, 10))
            };

            try
            {
                OrderManager.Insert(order);
            }
            catch (SqlException ex)
            {
                MessageBox.Show("order information is empty");
                return;
            }
            this.Close();
        }
示例#4
0
 public AddDoctorForm(Doctor doctor = null)
 {
     //_doctor = doctor;
     _doctorManager = new DoctorManager();
     _doctorList    = _doctorManager.Read();
     InitializeComponent();
 }
示例#5
0
        public ActionResult Index(Credential credent)
        {
            if (credent == null)
            {
                return(View(credent));
            }
            if (credent.DoctorID == null || credent.DoctorID.Length == 0)
            {
                TempData["message"] = "Both UserId and Password are required";
                return(View(credent));
            }
            if (credent.Password == null || credent.Password.Length == 0)
            {
                TempData["message"] = "Both UserId and Password are required";
                return(View(credent));
            }

            bool resultOfAuthenticate = DoctorManager.AuthenticateDoctor(credent, Session);

            if (resultOfAuthenticate == true)
            {
                TempData["message"] = "Login Successful";
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                TempData["message"] = "Invalid login credentials";
                return(RedirectToAction("Index", "Home"));
            }
        }
示例#6
0
        public ActionResult <Customer> Post(Customer customer)
        {
            try
            {
                if (customer.CustomerID != null && customer.CustomerID.Trim().Length > 0)
                {
                    customer.Condition = "2";
                }
                else
                {
                    customer.CTypeID = "4";
                }


                bool isSaved = new DoctorManager().DoctorManagement(customer);

                if (isSaved)
                {
                    return(Ok("1"));
                }
                // return Ok(JsonConvert.SerializeObject(customer));
            }
            catch (Exception ex)
            {
                return(BadRequest());
            }

            return(BadRequest());
        }
        private void PatientScreen_Load(object sender, EventArgs e)
        {
            Text = "HCS | " + patient.name + " " + patient.surname + "(" + patient.id + ") Patient Screen"; // Form'un ismini düzenle

            // Formdaki hasta bilgilerini getir
            txtName.Text          = patient.name;
            txtSurname.Text       = patient.surname;
            txtIdentity.Text      = patient.identity;
            dtpShipment.Value     = patient.shipment;
            chkDischarged.Checked = patient.is_discharged;

            // Action(İşlem) eklemedeki Policlinics ve Doctors comboboxlarını doldur.
            // Policlinic
            cbxPoliclinic.Items.Clear();
            foreach (Polyclinic polyclinic in PolyclinicManager.All())
            {
                cbxPoliclinic.Items.Add(polyclinic.name);
            }
            // Doctor
            cbxDoctor.Items.Clear();
            foreach (Doctor doctor in DoctorManager.All())
            {
                cbxDoctor.Items.Add(doctor.name);
            }

            refreshActions();
        }
        // Doctor
        //button doctor assign
        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            Doctor doctor = new Doctor();

            try
            {
                doctor.doctorId     = Id;
                doctor.firstName    = this.textBoxFirstName.Text;
                doctor.lastName     = this.textBoxLastName.Text;
                doctor.department   = Int32.Parse(this.comboBoxDepartment.SelectedValue.ToString());
                doctor.age          = Convert.ToInt32(this.textBoxAge.Text);
                doctor.sex          = this.comboBoxSex.Text;
                doctor.heightFt     = Convert.ToInt32(this.textBoxHeightFt.Text);
                doctor.heightInch   = Convert.ToInt32(this.textBoxHeightInch.Text);
                doctor.weight       = Convert.ToInt32(this.textBoxWeight.Text);
                doctor.phone        = Convert.ToInt64(this.textBoxPhone.Text);
                doctor.email        = this.textBoxEmail.Text;
                doctor.address      = this.textBoxAddress.Text;
                doctor.natioinality = Int32.Parse(this.comboBoxNationality.SelectedValue.ToString());
                doctor.shift        = Int32.Parse(this.comboBoxDoctorShift.SelectedValue.ToString());
                DoctorManager.doctorUpdate(doctor);
                MessageBox.Show("Updated");
                displayDoctor();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#9
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            Doctor doctor = new Doctor();

            doctor.Name         = nameTextBox.Text;
            doctor.DepartmentId = int.Parse(departmentComboBox.SelectedValue.ToString());
            doctor.Id           = idforSearch;
            DoctorManager doctorManager = new DoctorManager();

            if (saveButton.Text == "Update")
            {
                bool status = doctorManager.Update(doctor);
                if (status)
                {
                    Close();
                    MessageBox.Show("Updated Successfully");
                }
                else
                {
                    MessageBox.Show("Not updated");
                }
            }
            else if (doctorManager.Save(doctor))
            {
                Close();
                MessageBox.Show("Doctor Successfully Added");
            }
        }
示例#10
0
 public MdiForm()
 {
     _doctormanager  = new DoctorManager();
     _patientmanager = new PatientManager();
     _patientList    = _patientmanager.Read();
     _doctorList     = _doctormanager.Read();
     InitializeComponent();
 }
示例#11
0
        public DoctorViewModel()
        {
            domObjectDoctor = new Doctor();
            doctorManager   = new DoctorManager();

            _doctors = new ObservableCollection <Doctor>();
            // _listPatients = new RelayCommand(DisplayList, CanDisplay);
            DisplayList1();
        }
 // Comboboxtaki doktorları günceller
 private void refreshDoctors()
 {
     cbxDoctors.Items.Clear();
     // Combobox'ın içine veritabanından gelen doktorları dolduralım.
     foreach (Doctor doctor in DoctorManager.All())
     {
         cbxDoctors.Items.Add(doctor.name);
     }
 }
示例#13
0
        public AddPatientForm(Patient patient = null)
        {
            _patientmanager = new PatientManager();
            _doctormanager  = new DoctorManager();
            _doctorList     = _doctormanager.Read();
            _patientList    = _patientmanager.Read();

            InitializeComponent();
        }
示例#14
0
 protected void CancelDelete()
 {
     progress = ProgressDialog.Show(this, "Обработка...", "Пожалуйста, подождите.", true);
     if (doctor.ID != 0)
     {
         DoctorManager.DeleteDoctor(doctor.ID);
     }
     progress.Dismiss();
     Finish();
 }
示例#15
0
        public void RefreshList()
        {
            doctors = (List <Doctor>)DoctorManager.GetDoctors();
            doctors.Sort(DoctorManager.DoctorCompare);
            // create our adapter
            doctorList = new DoctorListAdapter(this, doctors);

            //Hook up our adapter to our ListView
            lstDoctors.Adapter = doctorList;
        }
示例#16
0
        public void DeleteDoctor()
        {
            Doctor Doctor = new Doctor()
            {
                DoctorId = 124,
            };

            DoctorManager DoctManager  = new DoctorManager();
            var           DeleteDoctor = DoctManager.DeleteDoctor(Doctor);
        }
示例#17
0
 public void SearchDoctor()
 {
     Doctor chk = new Doctor()
     {
         DoctorName       = "Dr.Malaki perera",
         DoctorSpeciality = "ENT"
     };
     DoctorManager DoctManager = new DoctorManager();
     var           AddDoctor   = DoctManager.GetDoctor(chk);
 }
示例#18
0
        protected void saveDoctorButton_Click(object sender, EventArgs e)
        {
            string name           = doctorNameTextBox.Text;
            string degree         = degreeTextBox.Text;
            string specialization = specializationTextBox.Text;

            Doctor        doctor        = new Doctor(name, degree, specialization);
            DoctorManager doctorManager = new DoctorManager();

            messageLabel.Text = doctorManager.SaveDoctor(doctor);
        }
示例#19
0
        private void GetDoctorsListInComboBox()
        {
            DoctorManager doctorManager = new DoctorManager();
            List <Doctor> doctorList    = new List <Doctor>();

            doctorList = doctorManager.GetDoctorList();
            doctorComboBox.DataSource    = null;
            doctorComboBox.DataSource    = doctorList;
            doctorComboBox.ValueMember   = "Id";
            doctorComboBox.DisplayMember = "Name";
        }
        protected void saveButton_Click(object sender, EventArgs e)
        {
            DoctorManager aDoctorManager = new DoctorManager();
            Doctor        aDoctor        = new Doctor();

            aDoctor.DoctorCenterId = Convert.ToInt32(Session["CenterId"]);
            aDoctor.Name           = nameTextBox.Text;
            aDoctor.Degree         = degreeTextBox.Text;
            aDoctor.Specification  = specificationTextBox.Text;
            aDoctorManager.Save(aDoctor);
        }
示例#21
0
 public void DoctorUpdate()
 {
     Doctor Doctor = new Doctor()
     {
         DoctorId         = 95,
         DoctorName       = "kamal Perera",
         DoctorSpeciality = "Nuro",
     };
     DoctorManager DoctManager  = new DoctorManager();
     var           UpdateDoctor = DoctManager.DoctorUpdate(Doctor);
 }
示例#22
0
        private void GetDoctorListWithPatients()
        {
            DoctorManager           doctorManager        = new DoctorManager();
            List <DoctorDepartment> doctorDepartmentList = doctorManager.GetDoctorListWithDepartments();

            foreach (var index in doctorDepartmentList)
            {
                ListViewItem listViewItem = new ListViewItem(index.DoctorName);
                listViewItem.SubItems.Add(index.DepartmentName);
                listViewItem.Tag = index.Id;
                doctorsListView.Items.Add(listViewItem);
            }
        }
示例#23
0
        public ActionResult ChangeDoctor(Doctor changeDoctor)
        {
            bool result = DoctorManager.ChangeDoctor(changeDoctor);

            if (result == false)
            {
                ViewBag.message = "Error: Doctor not found";
                return(View(changeDoctor));
            }
            ViewBag.message = "Doctor changed";
            Doctor[] doctors = DoctorManager.GetAllDoctors();
            return(View("List", doctors));
        }
示例#24
0
        public JsonResult Delete(DoctorviewModel model)
        {
            int deleteIndex = 0;

            try
            {
                deleteIndex = DoctorManager.Delete(model.DoctorId);
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
            return(deleteIndex > 0 ? Reload() : ErroResult("Failed To Delete"));
        }
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int           doctorId      = int.Parse(doctorsListView.SelectedItems[0].Tag.ToString());
            DoctorManager doctorManager = new DoctorManager();

            if (doctorManager.DeleteDoctorById(doctorId))
            {
                MessageBox.Show("Doctor Deleted Successfully");
            }
            else
            {
                MessageBox.Show("An Error Occured");
            }
        }
示例#26
0
        private IActionResult getData(string analytic, string choice, string condition)
        {
            DataTable dt         = null;
            string    JSONString = string.Empty;

            switch (analytic)
            {
            case "1":
                dt         = new DoctorManager().DoctorData("1", choice, condition);
                JSONString = JsonConvert.SerializeObject(dt);
                return(Ok(JSONString));
            }
            return(null);
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (Program.DeleteConfirm("Do you want delete this doctor? All patient actions who belongs to this doctor also be deleted."))
            {
                DoctorManager.Delete(doct); // Veritabanından doktoru sil

                MessageBox.Show("Doctor successfully deleted!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);

                refreshDoctors();         // Combobox'ı güncelle

                changeVisible(false);     // formu gizle
                chkStatus.Checked = true; // formu boş hale al
                cbxDoctors.Text   = "";   // Combobox'taki ismi sil
            }
        }
示例#28
0
        private void searchButton_Click(object sender, EventArgs e)
        {
            doctorsListView.Items.Clear();
            string                  search               = doctorsNameTextBox.Text;
            DoctorManager           doctorManager        = new DoctorManager();
            List <DoctorDepartment> doctorDepartmentList = doctorManager.SearchDoctorByNameWithDepartment(search);

            foreach (var index in doctorDepartmentList)
            {
                ListViewItem listViewItem = new ListViewItem(index.DoctorName);
                listViewItem.SubItems.Add(index.DepartmentName);
                listViewItem.Tag = index.Id;
                doctorsListView.Items.Add(listViewItem);
            }
        }
示例#29
0
 public AccountController(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     IEmailSender emailSender,
     ISmsSender smsSender,
     ILogger <AccountController> logger,
     DoctorManager doctorManager)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _emailSender   = emailSender;
     _smsSender     = smsSender;
     _logger        = logger;
     _doctorManager = doctorManager;
 }
        protected override void OnCreate(Bundle bundle)
        {
            RequestWindowFeature(WindowFeatures.NoTitle);

            base.OnCreate(bundle);

            // Create your application here
            SetContentView(Resource.Layout.PresentationView);

            Window.AddFlags(WindowManagerFlags.KeepScreenOn);

            (FindViewById <TextView> (Resource.Id.txtView)).Visibility = ViewStates.Gone;

            gestureDetector = new GestureDetector(this);
            _locMgr         = GetSystemService(Context.LocationService) as LocationManager;

            preses   = Presentations.GetPresentations();
            ivSlide  = FindViewById <ImageView> (Resource.Id.ivSlide);
            doctorID = Intent.GetIntExtra("doctorID", 0);
            if (doctorID == 0)
            {
                Finish();
            }

            doctor = DoctorManager.GetDoctor(doctorID, false);
            if (doctor == null)
            {
                Finish();
            }

            lastSlideTime         = DateTime.Now;
            demonstration         = DemonstrationManager.GetDemonstration(doctorID, DateTime.Today);
            demonstration.analyze = doctor.LastVisitAnalyze;

            if (demonstration.visitTime.Date != DateTime.Today)
            {
                demonstration.visitTime = DateTime.Now;
            }

            selectedPresent = Intent.GetIntExtra("presentationID", 0);

            CreateTopLayout();
            RefreshParts();

            OnButtonTopClick(preses [selectedPresent].btn, null);

            OnButtonBottomClick(preses[selectedPresent].parts [Intent.GetIntExtra("partID", 0)].btn, null);
        }
示例#31
0
        public static void MigrateSurveyCustomer()
        {
            PortalDbContext portalDbContext = new PortalDbContext();
            PortalDbRepository<Access> accesPortalDbRepository = new PortalDbRepository<Access>(portalDbContext);
            PortalDbRepository<SurveyCustomer> surveyCustomerRepository = new PortalDbRepository<SurveyCustomer>(portalDbContext);
            PortalDbRepository<SurveyQuestion> surveyQuestionRepository = new PortalDbRepository<SurveyQuestion>(portalDbContext);
            PortalDbRepository<SurveysGeneralAnswer> surveysGeneralAnswerRepository = new PortalDbRepository<SurveysGeneralAnswer>(portalDbContext);
            PortalDbRepository<SurveysPossibleAnswer> surveyPossibleAnswerRepository = new PortalDbRepository<SurveysPossibleAnswer>(portalDbContext);

            Manager portalDbManager = new Manager(accesPortalDbRepository);
            /////////////===================>>>>>>>>>>>>>>>>>>>
            SurveyCustomerDbManager SurveyCustomerDbManager = new SurveyCustomerDbManager(surveyCustomerRepository, portalDbManager);
            SurveyQuestionManager SurveyQuestionManager = new SurveyQuestionManager(surveyQuestionRepository, portalDbManager);
            SurveyGeneralAnswerManager SurveyGeneralAnswerManager = new SurveyGeneralAnswerManager(surveysGeneralAnswerRepository, portalDbManager);
            SurveyPossibleAnswerManager SurveyPossibleAnswerManager = new SurveyPossibleAnswerManager(surveyPossibleAnswerRepository, portalDbManager);

            //////////////////////////////////////////////////
            CosmeticExpressDbContext cosmeticExpressDbContext = new CosmeticExpressDbContext();
            CosmeticExpressDbRepository<Access> accesCosmeticExpressDbRepository = new CosmeticExpressDbRepository<Access>(cosmeticExpressDbContext);
            CosmeticExpressDbRepository<User> userRepository = new CosmeticExpressDbRepository<User>(cosmeticExpressDbContext);
            CosmeticExpressDbRepository<Schedule> scheduleRepository = new CosmeticExpressDbRepository<Schedule>(cosmeticExpressDbContext);
            CosmeticExpressDbRepository<Office> officeRepository = new CosmeticExpressDbRepository<Office>(cosmeticExpressDbContext);
            CosmeticExpressDbRepository<VWCompleteSurgery> VWCompleteSurgeryRepository = new CosmeticExpressDbRepository<VWCompleteSurgery>(cosmeticExpressDbContext);
            CosmeticExpressDbRepository<Entity.CosmeticExpress.Patient> CosmeticExpressPatientRepository = new CosmeticExpressDbRepository<Entity.CosmeticExpress.Patient>(cosmeticExpressDbContext);


            Manager cosmeticExpressDbManager = new Manager(accesCosmeticExpressDbRepository);
            UserManager userManager = new UserManager(userRepository, cosmeticExpressDbManager);
            ScheduleManager scheduleManager = new ScheduleManager(scheduleRepository, cosmeticExpressDbManager);
            OfficeManager officeManager = new OfficeManager(officeRepository, cosmeticExpressDbManager);
            VWCompleteSurgeryManager vwCompleteSurgeryManager = new VWCompleteSurgeryManager(VWCompleteSurgeryRepository, cosmeticExpressDbManager);
            CosmeticExpressPatientManager CosmeticExpressPatientManager = new CosmeticExpressPatientManager(CosmeticExpressPatientRepository, cosmeticExpressDbManager);

            //////////////////////////////////////////////////
            ApplicationDbContext applicationDbContext = new ApplicationDbContext();
            ApplicationDbRepository<Access> accesApplicationDbRepository = new ApplicationDbRepository<Access>(applicationDbContext);
            ApplicationDbRepository<Review> reviewRepository = new ApplicationDbRepository<Review>(applicationDbContext);
            ApplicationDbRepository<Doctor> doctorRepository = new ApplicationDbRepository<Doctor>(applicationDbContext);
            ApplicationDbRepository<Lead> leadRepository = new ApplicationDbRepository<Lead>(applicationDbContext);
            ApplicationDbRepository<Expert> expertRepository = new ApplicationDbRepository<Expert>(applicationDbContext);
            ApplicationDbRepository<Center> centerRepository = new ApplicationDbRepository<Center>(applicationDbContext);
            ApplicationDbRepository<Entity.ReviewManagerEntities.Patient> ApplicationPatientRepository = new ApplicationDbRepository<Entity.ReviewManagerEntities.Patient>(applicationDbContext);


            Manager applicationDbManager = new Manager(accesApplicationDbRepository);
            ReviewManager reviewManager = new ReviewManager(reviewRepository, applicationDbManager);
            ///////////////////=============================>>>>>>>>>>>>>>>
            DoctorManager doctorManager = new DoctorManager(doctorRepository, applicationDbManager);
            LeadManager leadManager = new LeadManager(leadRepository, applicationDbManager);
            ExpertManager expertManager = new ExpertManager(expertRepository, applicationDbManager);
            CenterManager centerManager = new CenterManager(centerRepository, applicationDbManager);
            ApplicationPatientManager ApplicationPatientManager = new ApplicationPatientManager(ApplicationPatientRepository, cosmeticExpressDbManager);

            var SurveyQuestionCollection = SurveyQuestionManager.Get().ToArray();
            var SurveyCustomerCollection = SurveyCustomerDbManager.Get().ToArray();
            var SurveyPossibleAnswerCollection = SurveyPossibleAnswerManager.Get().ToArray();
            var SurveyGeneralAnswerCollection = SurveyGeneralAnswerManager.Get().ToArray();
            ICollection<VWCompleteSurgery> vwCompleteSurgeriesCollection = vwCompleteSurgeryManager.Get().ToArray();

            var doctors = doctorManager.Get().Select(d => new{ d.Id, d.FullName, d.Reviews.Count }).ToArray();
            var sources = reviewManager.Get().GroupBy(r => r.Source).ToArray().Select(group => new {Source = group.Key, Count = group.Count()});

            ICollection<Review> ReviewCollection = new List<Review>();

            foreach (var sgAnswer in SurveyGeneralAnswerCollection)
            {
                if (!reviewManager.Get().Any(review => review.ExternalId == sgAnswer.Id && review.Source == "Portal") && sgAnswer.SurveyTemplateId == 2)
                {
                    //Schedule Schedule = scheduleManager.Get(sched =>
                    //sched.PatientID == sgAnswer.SurveyCustomer.ExternalId
                    //&& sched.ServiceID == 5
                    //&& sched.dtStart.AddMonths(3) >= sgAnswer.SurveyDate).FirstOrDefault();

                    VWCompleteSurgery surgery = vwCompleteSurgeriesCollection.Where(surg => surg.PatientID == sgAnswer.SurveyCustomer.ExternalId && surg.dtStart.AddMonths(3) >= sgAnswer.SurveyDate).FirstOrDefault();


                    if (surgery != null)
                    {
                        Review review = new Review();
                        review.Source = "Portal";
                        review.ExternalId = sgAnswer.Id;
                        review.Rating = 0;

                        review.CreatedOn = surgery.dtStart;

                        //FROM CEXPRESS/Patient/Patient
                        Entity.CosmeticExpress.Patient CosmeticExpressPatient = CosmeticExpressPatientManager.Get(patient => patient.PatientID == surgery.PatientID).FirstOrDefault();
                        var existingApplicationPatient = ApplicationPatientManager.Get(patient => patient.ExternalId == CosmeticExpressPatient.PatientID && patient.Source == "CosmeticExpress").FirstOrDefault();
                        if (existingApplicationPatient != null)
                        {
                            review.PatientId = existingApplicationPatient.Id;
                        }
                        else
                        {
                            Entity.ReviewManagerEntities.Patient Patient = new Entity.ReviewManagerEntities.Patient()
                            {
                                ExternalId = CosmeticExpressPatient.PatientID,
                                FirstName = CosmeticExpressPatient.FirstName,
                                LastName = CosmeticExpressPatient.LastName,
                                MiddleName = CosmeticExpressPatient.MiddleName,
                                DOB = CosmeticExpressPatient.DOB,
                                Email = CosmeticExpressPatient.Email,
                                Source = "CosmeticExpress"
                            };
                            review.Patient = Patient;
                        }


                        //FROM CEXPRESS/USER TO APP/DOCTOR 
                        User User = userManager.Get(user => user.UserID == surgery.ProviderUserID).FirstOrDefault();
                        var existingDoctorinDb = doctorManager.Get(doc => doc.ExternalId == User.UserID && doc.Source == "CosmeticExpress").FirstOrDefault();
                        var reviewInCollectionWithSameDoctor = ReviewCollection.FirstOrDefault(rev => rev.Doctor != null && rev.Doctor.ExternalId == User.UserID && rev.Doctor.Source == "CosmeticExpress");
                        if (existingDoctorinDb != null)
                        {
                            review.DoctorId = existingDoctorinDb.Id;
                        }
                        else
                        {
                            if (reviewInCollectionWithSameDoctor != null)
                            {
                                review.Doctor = reviewInCollectionWithSameDoctor.Doctor;
                            }
                        }
                        if (review.Doctor == null && review.DoctorId == null)
                        {
                            {
                                Doctor Doctor = new Doctor()
                                {
                                    FullName = User.FullName,
                                    Source = "CosmeticExpress",
                                    ExternalId = User.UserID
                                };
                                review.Doctor = Doctor;
                            }
                        }

                        //FROM CEXPRESS/OFFICE TO APP/CENTER 
                        Office Office = officeManager.Get(office => office.OfficeId == surgery.OfficeID).FirstOrDefault();

                        var existingCenterinDb = centerManager.Get(center => center.ExternalId == surgery.OfficeID).FirstOrDefault();
                        var centerInCollectionWithSameDoctor = ReviewCollection.FirstOrDefault(rev => rev.Center != null && rev.Center.ExternalId == Office.OfficeId && rev.Center.Source == "CosmeticExpress");

                        if (existingCenterinDb != null)
                        {
                            review.CenterId = existingCenterinDb.Id;
                        }
                        else
                        {
                            if (centerInCollectionWithSameDoctor != null)
                            {
                                review.Center = centerInCollectionWithSameDoctor.Center;
                            }
                        }
                        if (review.Center == null && review.CenterId == null)
                        {
                            Center Center = new Center()
                            {
                                Name = Office.OfficeName,
                                Source = "CosmeticExpress",
                                ExternalId = Office.OfficeId
                            };
                            review.Center = Center;                           
                        }

                        //Recorriendo cada pregunta dentro del survey para calcular el rating
                        foreach (var answer in sgAnswer.SurveysAnswers)
                        {
                            if (SurveyQuestionCollection.FirstOrDefault(q => q.Id == answer.SurveyQuestionId).QuestionType == "edit")
                            {
                                review.Text = answer.Answer != null ? answer.Answer.ToString() : "Empty";
                            }
                            else
                            {
                                var anwersItem = SurveyPossibleAnswerCollection.FirstOrDefault(spa => spa.Id == answer.SurveysPossibleAnswerId);
                                review.Rating += anwersItem != null ? anwersItem.Weight : 0;
                            }
                        }
                        //anadiento el review a la coleccion
                        ReviewCollection.Add(review);
                    }
                }
            }
            //from ReviewCollection to reviewManager
            foreach (var review in ReviewCollection)
            {
                reviewManager.Add(review);               
            }
            reviewManager.SaveChanges();
        }