Example #1
0
        public void changeRequestStatus(Request r)
        {
            switch (r.RequestStatus)
            {
            case RequestStatus.approve:
            {
                //получить организацию юзера
                if (r.Patient.MedOrg != null)
                {
                    int medOrgId  = r.MedOrg.Id;
                    int patientId = r.PatientId;
                    //удалить из организации этого юзера
                    ServiceMedOrg.RemovePatientFromMedOrg(medOrgId, patientId);
                }
                //проставить юзеру новую организацию
                ServiceUser.UpdatePatientMedOrg(r.MedOrgId, r.PatientId);

                // добавить в новой организации юзера
                ServiceMedOrg.AddPatientToMedOrg(r.PatientId, r.MedOrgId);
            }
            break;

            case RequestStatus.reject:
                db.UpdateRequest(r);
                break;
            }
        }
        public void changeRequestStatus(Request r)
        {
            switch (r.requestStatus)
            {
            case RequestStatus.approve:
            {
                //1.получить организацию patient
                if (r.Patient.MedOrg != null)
                {
                    int MedOrgId  = r.Patient.MedOrg.Id;
                    int PatientId = r.PatientId;
                    //2.удалить с организации User данного User
                    ServiceMedOrg.RemovePatientFromMedOrg(MedOrgId, PatientId);
                }

                //3.проставить User новую организацию
                ServiceUser.updateUserMedOrg(r.MedOrgId, r.PatientId);
                //4.добавить в новую организацию User
                ServiceMedOrg.AddPatientFromMedOrg(r.MedOrgId, r.PatientId);
            }
            break;

            case RequestStatus.reject:
                db.UpdateRequest(r);
                break;
            }
        }