Пример #1
0
        public ActionResult CancelOper(string storageNameId, string docNumber, string docDate)
        {
            IFormatProvider culture = new System.Globalization.CultureInfo("ru-RU", true);
            string          format  = "dd.MM.yyyy";
            DateTime        docDt   = DateTime.ParseExact(docDate, format, culture);

            Dictionary <string, object> query = new Dictionary <string, object>();

            query.Add("DocNumber", docNumber);
            query.Add("DocDate", docDt);
            query.Add("OperType.Id", DataGlobals.OPERATION_STORAGE_WEAR_OUT);
            IList <Operation> operations = operationRepository.GetByLikeCriteria(query);

            foreach (var item in operations)
            {
                Storage storage = item.Storage;
                storage.Quantity += item.Quantity;
                storageRepository.SaveOrUpdate(storage);
                operationRepository.Delete(item);
            }
            return(null);
        }
 public void CancelOperation(Operation operation)
 {
     operationRepository.Delete(operation);
 }
Пример #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Lista  ss    = (Lista)dataGridTermini.Items.GetItemAt(dataGridTermini.SelectedIndex);
            string name1 = sender.ToString();

            string[] words = name1.Split(':');

            string[] words1 = name1.Split(' ');
            string   id     = words1[2];


            string sMessageBoxText = "Da li ste sigurni da zelite da otkazete ovaj termin?" + id;
            string sCaption        = "Otkazivanje termina.";

            MessageBoxButton btnMessageBox  = MessageBoxButton.YesNoCancel;
            MessageBoxImage  icnMessageBox  = MessageBoxImage.Warning;
            MessageBoxResult rsltMessageBox = MessageBox.Show(sMessageBoxText, sCaption, btnMessageBox, icnMessageBox);

            switch (rsltMessageBox)
            {
            case MessageBoxResult.Yes:
                PatientUser ovajPacijent = new PatientUser();

                String o = bingPathToAppDir(@"JsonFiles\operations.json");
                String b = bingPathToAppDir(@"JsonFiles\appointments.json");

                AppointmentList = new List <DoctorAppointment>();
                operationList   = new List <Operation>();

                OperationRepository   oprep = new OperationRepository(o);
                AppointmentRepository epr   = new AppointmentRepository(b);
                operationList   = oprep.GetAll();
                AppointmentList = epr.GetAll();


                foreach (DoctorAppointment d in AppointmentList)
                {
                    if (d.id.ToString().Equals(id) && ss.Pregled == true)
                    {
                        Console.WriteLine(id);
                        AppointmentList.Remove(d);
                        //patientController.update(ovajPacijent);
                        epr.Delete(d.id);
                        PatientController patContr = new PatientController();


                        if (d.patient.notifications == null)
                        {
                            d.patient.notifications = new List <ModelNotification>();
                        }
                        List <ModelNotification> notifications1 = d.patient.notifications;
                        // }

                        notifications1.Add(new ModelNotification("Postovani, pregled zakazan za datum: " + d.date + " i vreme " + d.time + " je otkazan."));
                        d.patient.notifications = notifications1;



                        PatientController pCon = new PatientController();
                        pCon.Update(d.patient);

                        if (d.doctor.specialNotifications == null)
                        {
                            d.doctor.specialNotifications = new List <DoctorNotification>();
                        }
                        List <DoctorNotification> obavestenja = d.doctor.specialNotifications;
                        obavestenja.Add(new DoctorNotification("Postovani, pregled zakazan za datum: " + d.date + " i vreme " + d.time + " je otkazan."));
                        d.doctor.specialNotifications = obavestenja;



                        DoctorController docContr1 = new DoctorController();

                        docContr1.Update(d.doctor);
                        var s = new PopunjeniTermini();
                        Panel.Children.Clear();
                        Panel.Children.Add(s);

                        break;
                    }
                }

                foreach (Operation d in operationList)
                {
                    if (d.id.ToString().Equals(id) && ss.Operacija == true)
                    {
                        operationList.Remove(d);
                        oprep.Delete(d.id);

                        if (d.patient.notifications == null)
                        {
                            d.patient.notifications = new List <ModelNotification>();
                        }
                        List <ModelNotification> notifications1 = d.patient.notifications;


                        notifications1.Add(new ModelNotification("Postovani, operacija zakazana za datum: " + d.date + " i vreme " + d.start + " je otkazana."));
                        d.patient.notifications = notifications1;



                        PatientController pCon = new PatientController();
                        pCon.Update(d.patient);



                        if (d.isResponiable.specialNotifications == null)
                        {
                            d.isResponiable.specialNotifications = new List <DoctorNotification>();
                        }
                        List <DoctorNotification> obavestenja = d.isResponiable.specialNotifications;
                        obavestenja.Add(new DoctorNotification("Postovani,operacija zakazana za datum: " + d.date + " i vreme " + d.start + " je otkazana."));
                        d.isResponiable.specialNotifications = obavestenja;



                        DoctorController docContr1 = new DoctorController();

                        docContr1.Update(d.isResponiable);
                        var s = new PopunjeniTermini();
                        Panel.Children.Clear();
                        Panel.Children.Add(s);
                        break;
                    }
                }


                break;


            case MessageBoxResult.No:

                break;

            case MessageBoxResult.Cancel:

                break;
            }
        }
Пример #4
0
 public void Remove(int appointmentid, int operationid)
 {
     operationRepository.Delete(operationid);
 }