Пример #1
0
 public LogItem(Urgency urgency, string desc, string source)
 {
     Datetime = DateTime.Now;
     Urgency = urgency;
     Description = desc;
     Source = source;
 }
Пример #2
0
        public async Task <UrgencyResponse> SaveAsync(int guardianId, Urgency urgency)
        {
            var existingGuardian = await _guardianRepository.FindByIdAsync(guardianId);

            if (existingGuardian == null)
            {
                return(new UrgencyResponse("Guardian not found"));
            }

            var othersUrgencies = await _urgencyRepository.ListByGuardianIdAsync(guardianId);


            var otherUrgency = othersUrgencies.Where(other => urgency.Title == other.Title && urgency.Latitude == other.Latitude &&
                                                     urgency.Longitude == other.Longitude && DateTime.Now.Date == other.ReportedAt.Date).ToList().FirstOrDefault();

            if (otherUrgency != null)
            {
                return(new UrgencyResponse("There is another urgency with same title, location and report day"));
            }

            urgency.Guardian = existingGuardian;

            try
            {
                await _urgencyRepository.AddAsync(urgency);

                await _unitOfWork.CompleteAsync();

                return(new UrgencyResponse(urgency));
            }
            catch (Exception ex)
            {
                return(new UrgencyResponse($"An error ocurred while saving the urgency: {ex.Message}"));
            }
        }
Пример #3
0
 public void SendAlert()
 {
     if (IsValid())
     {
         var props = Writer.EnsureProperties(properties);
         props.Add(XFConstants.EventWriter.EventType, EventTypeOption.Alert);
         props.Add(XFConstants.Alert.Title, Title);
         props.Add(XFConstants.Alert.Message, Message);
         props.Add(XFConstants.Alert.Categories, Categories.ToString());
         props.Add(XFConstants.Alert.Urgency, Urgency.ToString());
         props.Add(XFConstants.Alert.Importance, Importance.ToString());
         props.Add(XFConstants.Alert.Targets, Audiences.ToString());
         props.Add(XFConstants.Alert.Source, Source);
         props.Add(XFConstants.Alert.CreatedAt, DateTime.Now.ToString(XFConstants.DateTimeFormat));
         if (!String.IsNullOrEmpty(Error))
         {
             props.Add(XFConstants.Alert.Error, Error);
         }
         if (!String.IsNullOrWhiteSpace(Stacktrace))
         {
             props.Add(XFConstants.Alert.StackTrace, Stacktrace);
         }
         if (!String.IsNullOrWhiteSpace(NamedRecipient))
         {
             props.Add(XFConstants.Alert.NamedTarget, NamedRecipient);
         }
         if (!String.IsNullOrWhiteSpace(Topic))
         {
             props.Add(XFConstants.Alert.Topic, Topic);
         }
         List <TypedItem> list = Writer.Convert(props);
         EventWriter.Write(EventTypeOption.Alert, list);
     }
 }
Пример #4
0
        private void AddAlert(String msg, Urgency urgency)
        {
            if (this.Dispatcher.Thread == Thread.CurrentThread)
            {
                stackPanelUpdates.Children.Insert(0, CreateAlertBlock(msg));

                /*switch (urgency)
                 * {
                 *  case Urgency.LOW:
                 *      _blip.Play();
                 *      break;
                 *  case Urgency.MODERATE:
                 *      _ding.Play();
                 *      break;
                 *  case Urgency.HIGH:
                 *      _alarm.Play();
                 *      break;
                 *  default:
                 *      break;
                 * }*/
                PlayThreadedBeep(urgency);
            }
            else
            {
                this.Dispatcher.Invoke(new AlertParams(AddAlert), msg, urgency);
            }
        }
        //绑定所有下拉选框
        private void DPDataBind()
        {
            DataTable dt = proBll.Sel();

            proDP.DataSource     = dt;
            proDP.DataTextField  = "ProcedureName";
            proDP.DataValueField = "ID";
            proDP.DataBind();
            proDP.Items.Insert(0, new ListItem("自由流程", "0"));

            //机密等下拉选框绑定
            Secret.DataSource     = OAConfig.StrToDic(OAConfig.Secret);
            Secret.DataValueField = "Key";
            Secret.DataTextField  = "Value";
            Secret.DataBind();

            Urgency.DataSource     = OAConfig.StrToDic(OAConfig.Urgency);
            Urgency.DataValueField = "Key";
            Urgency.DataTextField  = "Value";
            Urgency.DataBind();

            Importance.DataSource     = OAConfig.StrToDic(OAConfig.Importance);
            Importance.DataValueField = "Key";
            Importance.DataTextField  = "Value";
            Importance.DataBind();
        }
Пример #6
0
        private void PlayThreadedBeep(Urgency howUrgent)
        {
            int hertz       = 500; //For "LOW" Urgency by default
            int msPlayedFor = 500;
            int repeats     = 1;

            if (howUrgent == Urgency.HIGH)
            {
                hertz       = 1000;
                msPlayedFor = 400;
                repeats     = 3;
            }
            else if (howUrgent == Urgency.MODERATE)
            {
                hertz       = 1000;
                msPlayedFor = 1000;
            }
            else if (howUrgent == Urgency.NONE)
            {
                return;
            }

            Thread t = new Thread(new ParameterizedThreadStart(PlayBeep));

            t.Start(new int[] { hertz, msPlayedFor, repeats });
        }
Пример #7
0
        public RequestNewBook(User userId, string bookName, string motivation, Urgency urgency, string link, DateTime?bookPublicationDate = null)
        {
            if (userId == null)
            {
                throw new ArgumentException("UserId can't be 0");
            }
            if (string.IsNullOrWhiteSpace(bookName))
            {
                throw new ArgumentException($"{nameof(bookName)} is null or whiteSpace");
            }
            if (string.IsNullOrWhiteSpace(motivation))
            {
                throw new ArgumentException($"{nameof(motivation)} is null or whiteSpace");
            }
            if (string.IsNullOrWhiteSpace(link))
            {
                throw new ArgumentException($"{nameof(link)} is null or whiteSpace");
            }

            User                = userId;
            BookName            = bookName;
            Motivation          = motivation;
            UrgencyType         = urgency;
            Link                = link;
            BookPublicationDate = bookPublicationDate;
        }
Пример #8
0
        public static void DateAndPrice(int km, Urgency urge, Dimension dim, Transport trans)
        {
            var datenow         = DateTime.Now;
            int treatment       = 1 + urge.HoursByUrgency();
            var shippingDay     = datenow.AddHours(treatment);
            var finalPrice      = dim.PriceBySize() + dim.PriceBySize() * urge.PriceByUrgency();
            var travellingHours = km.HoursBasedOnKm() * trans.HourByTransport();

            while (shippingDay.Hour != 17)
            {
                shippingDay = shippingDay.AddHours(1);
            }

            var arrivelDate = shippingDay.AddHours(travellingHours);

            if (arrivelDate.DayOfWeek.ToString() == "Saturday")
            {
                arrivelDate = arrivelDate.AddDays(2);
            }
            if (arrivelDate.DayOfWeek.ToString() == "Sunday")
            {
                arrivelDate = arrivelDate.AddDays(1);
            }

            // se for antes das 9 chega nesse dia (não se faz nada)
            //Se for depois das 20 e antes das 00, chega no dia seguinte entre as 9 e as 12.
            if (arrivelDate.Hour > 20 && arrivelDate.Hour <= 23)
            {
                arrivelDate = arrivelDate.AddHours(12);
            }

            Console.WriteLine($"Your order, with a total price of {finalPrice} euro(s), will arrive approximately on {arrivelDate.ToString("dd/MM/yyyy")}");
        }
Пример #9
0
        public ActionResult DeleteConfirmed(int id)
        {
            Urgency urgency = db.Urgencies.Find(id);

            db.Urgencies.Remove(urgency);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #10
0
 public Maintenance(MaintenanceRequest maintenanceRequest, Urgency urgency, RepairService serviceType, Building building)
 {
     this.maintenanceRequest = maintenanceRequest;
     this.building = building;
     this.urgency = urgency;
     this.serviceType = serviceType;
     statusOfMaintenance = StatusOfMaintenance.NotStarted;
 }
Пример #11
0
        public void Create(IUrgency item)
        {
            Urgency urgency = new Urgency()
            {
                Title = item.Title, Description = item.Description
            };

            _dataContext.Urgencies.Add(urgency);
        }
Пример #12
0
 public ActionResult Edit([Bind(Include = "Id,UrgencyState")] Urgency urgency)
 {
     if (ModelState.IsValid)
     {
         db.Entry(urgency).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(urgency));
 }
Пример #13
0
        public ActionResult Create([Bind(Include = "Id,UrgencyState")] Urgency urgency)
        {
            if (ModelState.IsValid)
            {
                db.Urgencies.Add(urgency);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(urgency));
        }
Пример #14
0
 public ActionResult Create([Bind(Include = "UrgencyName,UrgencyDescription")] Urgency urgency)
 {
     urgency.UrgencyID = CreateCode(db.Urgencies.Count());
     if (ModelState.IsValid)
     {
         db.Urgencies.Add(urgency);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(urgency));
 }
Пример #15
0
        // GET: Urgencies/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Urgency urgency = db.Urgencies.Find(id);

            if (urgency == null)
            {
                return(HttpNotFound());
            }
            return(View(urgency));
        }
Пример #16
0
        public IActionResult AddUrgency(UrgencyAddDTO model)
        {
            if (ModelState.IsValid)
            {
                var urgency = new Urgency()
                {
                    Title = model.Title
                };

                _urgencyService.Create(urgency);
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
Пример #17
0
        } // ScAddContentMeta

        // ******************************************************************************
        public void ScAddCMurgency(int urgencyValue)
        // Code History:
        // 2014-02-26 mws
        {
            if (urgencyValue < 1)
            {
                return;
            }
            if (urgencyValue < 9)
            {
                return;
            }
            var urgency = new Urgency();

            urgency.thisValue = urgencyValue.ToString();
            AddNarPropertyToWrapper1(PropsWrapping1.ContentMeta, urgency);
        } // ScAddCMurgency
Пример #18
0
 public void NewRequest(Urgency urgency, string shortDescription, string moreInformation)
 {
     SelectUrgency(urgency);
     ShortDescriptionTxtBox.SendKeys(shortDescription);
     wait.Until(e => KnowledgeResultTable.Displayed);
     KnowledgeResults.First().Click();
     wait.Until(e => ThisHelpedBtn.Displayed);
     ThisHelpedBtn.Click();
     action.SendKeys(Keys.Escape).Perform();
     wait.Until(e => MoreInfoTxtBox.Displayed);
     MoreInfoTxtBox.SendKeys(moreInformation);
     submitBtn.Click();
     wait.Until(e => SeleniumDriver.Instance.Title.Equals("Abt Service Hub"));
     SeleniumDriver.Instance.SwitchTo().ParentFrame();
     action.MoveToElement(dropzone).Perform();
     // wait.Until(e => OpenMyIncidentsLink.Displayed);
     //  action.SendKeys(Keys.ArrowUp).SendKeys(Keys.ArrowUp).SendKeys(Keys.ArrowUp).Perform();
 }
Пример #19
0
        private void SelectUrgency(Urgency urgency)
        {
            switch (urgency)
            {
            case Urgency.Low:
                UrgencyDropdown.FindElements(By.TagName("option")).Single(e => e.GetAttribute("value").Equals("3")).Click();
                break;

            case Urgency.Medium:
                UrgencyDropdown.FindElements(By.TagName("option")).Single(e => e.GetAttribute("value").Equals("2")).Click();
                break;

            case Urgency.High:
                UrgencyDropdown.FindElements(By.TagName("option")).Single(e => e.GetAttribute("value").Equals("1")).Click();
                break;

            default:
                break;
            }
        }
Пример #20
0
        public static double PriceByUrgency(this Urgency urge)
        {
            double pricePercentage;

            if (urge == Urgency.Green)
            {
                pricePercentage = 0;
            }
            else if (urge == Urgency.Yellow)
            {
                pricePercentage = 0.25;
            }
            else if (urge == Urgency.Orange)
            {
                pricePercentage = 0.50;
            }
            else
            {
                pricePercentage = 1;
            }
            return(pricePercentage);
        }
Пример #21
0
        public static int HoursByUrgency(this Urgency urge)
        {
            int hours;

            if (urge == Urgency.Green)
            {
                hours = 24;
            }
            else if (urge == Urgency.Yellow)
            {
                hours = 12;
            }
            else if (urge == Urgency.Orange)
            {
                hours = 6;
            }
            else
            {
                hours = 3;
            }
            return(hours);
        }
Пример #22
0
        private ActionResult ReportByDate(DateTime StartingDate, DateTime EndDate)
        {
            var query = from Incidents in db.Incidents
                        where Incidents.IncidentCreationDate >= StartingDate && Incidents.IncidentCreationDate <= EndDate
                        select Incidents;

            string       str  = Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
            StreamWriter file = new StreamWriter(str + "\\text2.csv");

            file.WriteLine("IncidentID,Title,CreationDate,User,Status,Urgency,Technician");

            foreach (var x in query)
            {
                Status Status = (from TempStatus in db.Status
                                 where TempStatus.StatusID == x.StatusID
                                 select TempStatus).FirstOrDefault();

                Urgency Urgency = (from TempUrgency in db.Urgencies
                                   where TempUrgency.UrgencyID == x.UrgencyID
                                   select TempUrgency).FirstOrDefault();

                User User = (from TempUser in db.Users
                             where TempUser.UserID == x.UserID
                             select TempUser).FirstOrDefault();

                User User2 = (from TempUser in db.Users
                              where TempUser.UserID == x.TechnicianID
                              select TempUser).FirstOrDefault();

                file.WriteLine(x.IncidentID + "," + x.IncidentTitle + "," + x.IncidentCreationDate + "," + User.UserName +
                               "," + Status.StatusName + "," + Urgency.UrgencyName + "," + User2.UserName);
            }

            file.Flush();
            file.Close();
            return(View("Index", db.Incidents.ToList()));
        }
Пример #23
0
 /// <summary>
 /// Postavlja hitnost
 /// </summary>
 /// <param name="urgency"></param>
 internal void ChangeUrgency(Urgency urgency)
 {
     this.urgency = urgency;
 }
Пример #24
0
 public void WriteToLog(Urgency u, string message)
 {
     Logger.WriteToLog((Urgency)u, message, this.Friendly_Name);
 }
Пример #25
0
        private void PlayThreadedBeep(Urgency howUrgent)
        {
            int hertz = 500; //For "LOW" Urgency by default
            int msPlayedFor = 500;
            int repeats = 1;
            if (howUrgent == Urgency.HIGH)
            {
                hertz = 1000; 
                msPlayedFor = 400;
                repeats = 3;
            }
            else if (howUrgent == Urgency.MODERATE)
            {
                hertz = 1000;
                msPlayedFor = 1000;
            }
            else if (howUrgent == Urgency.NONE)
                return;

            Thread t = new Thread(new ParameterizedThreadStart(PlayBeep));
            t.Start(new int[] { hertz, msPlayedFor, repeats });
        }
Пример #26
0
 private void AddAlert(String msg, Urgency urgency)
 {
     if (this.Dispatcher.Thread == Thread.CurrentThread)
     {
         stackPanelUpdates.Children.Insert(0, CreateAlertBlock(msg));
         /*switch (urgency)
         { 
             case Urgency.LOW:
                 _blip.Play();
                 break;
             case Urgency.MODERATE:
                 _ding.Play();
                 break;
             case Urgency.HIGH:
                 _alarm.Play();
                 break;
             default:
                 break;
         }*/
         PlayThreadedBeep(urgency);
     }
     else
     {
         this.Dispatcher.Invoke(new AlertParams(AddAlert), msg, urgency);
     }
 }
Пример #27
0
 public void Delete(Urgency entity)
 {
     _urgencyDal.Delete(entity);
 }
Пример #28
0
 public void Update(Urgency entity)
 {
     _urgencyDal.Update(entity);
 }
Пример #29
0
 public void Create(Urgency entity)
 {
     _urgencyDal.Create(entity);
 }
Пример #30
0
 public PriceNotifier(Importance importance, Urgency urgency, string symbol, string op, double price) : base(importance, urgency)
 {
     this.Symbol   = symbol;
     this.Operator = op;
     this.Price    = price;
 }
Пример #31
0
 public TradingNotifier(Importance importance, Urgency urgency) : base(importance, urgency)
 {
 }
Пример #32
0
        protected override void Seed(ItsmDataContext db)
        {
            db.Urgencies.Add(new Urgency {
                Title = "High", Description = "я тут по русски вам говорю"
            });
            db.Urgencies.Add(new Urgency {
                Title = "Medium", Description = "я тут по русски вам говорю"
            });
            db.Urgencies.Add(new Urgency {
                Title = "Low", Description = "я тут по русски вам говорю"
            });

            db.Impacts.Add(new Impact {
                Title = "Low", Description = "я тут по русски вам говорю"
            });
            db.Impacts.Add(new Impact {
                Title = "Medium", Description = "я тут по русски вам говорю"
            });
            db.Impacts.Add(new Impact {
                Title = "High", Description = "я тут по русски вам говорю"
            });
            db.SaveChanges();

            Urgency          urg      = db.Urgencies.First(u => u.Title == "Medium");
            Impact           imp      = db.Impacts.First(i => i.Title == "Low");
            IncidentPriority priority = new IncidentPriority()
            {
                Title = "Incident", Description = "Description", Impact = imp, Urgency = urg, ResolutionTime = "60", ResponceTime = "3000"
            };

            db.IncidentPriorities.Add(priority);
            db.SaveChanges();

            db.MethodOfNotifications.Add(new MethodOfNotification()
            {
                Title = "Phone", Description = "Phone phone"
            });
            db.MethodOfNotifications.Add(new MethodOfNotification()
            {
                Title = "email", Description = "email email"
            });
            db.SaveChanges();

            db.ResolutionTypes.Add(new ResolutionType()
            {
                Title = "close", Description = "Closed"
            });
            db.ResolutionTypes.Add(new ResolutionType()
            {
                Title = "registered", Description = "REGistatetd"
            });
            db.SaveChanges();

            db.CategoryRecords.Add(new CategoryRecord()
            {
                Title = "network", Description = ""
            });

            db.SaveChanges();
            CategoryRecord categoryRecord = db.CategoryRecords.First(c => c.Title == "network");

            db.CategoryRecords.Add(new CategoryRecord()
            {
                Title = "switch", PearentCategory = categoryRecord
            });
            db.SaveChanges();


            List <CategoryRecord> categoryRecords = new List <CategoryRecord>();

            categoryRecords.Add(db.CategoryRecords.Find(1));

            List <MethodOfNotification> methodOfNotifications = new List <MethodOfNotification>();

            methodOfNotifications.Add(db.MethodOfNotifications.Find(1));
            methodOfNotifications.Add(db.MethodOfNotifications.Find(2));

            ClosureData closure = new ClosureData()
            {
                ResolutionType    = db.ResolutionTypes.Find(2),
                CustomerFeedback  = "feedback",
                ClosureCategories = categoryRecords,
            };

            db.ClosureDatas.Add(closure);
            db.SaveChanges();
            Incident incident = new Incident()
            {
                Title                = "incident 1",
                Description          = "не работае сеть в отделе снабжения. не горят лампочки на свиче.",
                MethodOfNotification = db.MethodOfNotifications.Find(1),
                MethodOfCallback     = methodOfNotifications,
                IncidentPriority     = db.IncidentPriorities.Find(1),
                Owner                = "Admininstartor",
                ServiceDescAgent     = "Operator",
                OrderDate            = DateTime.Now,
                Closure              = db.ClosureDatas.Find(1)
            };

            db.Incidents.Add(incident);
            db.SaveChanges();
        }
Пример #33
0
    void InitSwaps()
    {
        Angry.setPosition(new Position(Level.Excluded, Circle.Green));
        Blessing.setPosition(new Position(Level.Excluded, Circle.Purple));
        Child.setPosition(new Position(Level.Excluded, Circle.Red));
        Curse.setPosition(new Position(Level.Excluded, Circle.Cyan));
        Heaven.setPosition(new Position(Level.Tertiary, Circle.GreenPurpleRed));
        Happiness.setPosition(new Position(Level.Tertiary, Circle.GreenRedCyan));
        Dragon.setPosition(new Position(Level.Tertiary, Circle.RedCyanPurple));
        Dream.setPosition(new Position(Level.Secondary, Circle.CyanRed));
        Energy.setPosition(new Position(Level.Secondary, Circle.GreenRed));
        Female.setPosition(new Position(Level.Secondary, Circle.CyanPurple));
        Force.setPosition(new Position(Level.Quaternary, Circle.GreenRedCyanPurple));
        Forest.setPosition(new Position(Level.Excluded, Circle.Purple));
        Friend.setPosition(new Position(Level.Secondary, Circle.GreenPurple));
        Hate.setPosition(new Position(Level.Secondary, Circle.GreenPurple));
        Hope.setPosition(new Position(Level.Excluded, Circle.Green));
        Kindness.setPosition(new Position(Level.Tertiary, Circle.CyanPurpleGreen));
        Longevity.setPosition(new Position(Level.Secondary, Circle.CyanPurple));
        Love.setPosition(new Position(Level.Secondary, Circle.CyanPurple));
        Loyal.setPosition(new Position(Level.Secondary, Circle.GreenRed));
        Spirit.setPosition(new Position(Level.Secondary, Circle.CyanRed));
        Male.setPosition(new Position(Level.Quaternary, Circle.GreenRedCyanPurple));
        Mountain.setPosition(new Position(Level.Secondary, Circle.GreenRed));
        Night.setPosition(new Position(Level.Excluded, Circle.Red));
        Pure.setPosition(new Position(Level.Secondary, Circle.GreenPurple));
        Heart.setPosition(new Position(Level.Secondary, Circle.CyanRed));
        River.setPosition(new Position(Level.Excluded, Circle.Cyan));
        Emotion.setPosition(new Position(Level.Excluded, Circle.Cyan));
        Soul.setPosition(new Position(Level.Excluded, Circle.Purple));
        Urgency.setPosition(new Position(Level.Excluded, Circle.Red));
        Wind.setPosition(new Position(Level.Excluded, Circle.Green));

        Debug.LogFormat("[Dragon Energy #{0}] Before swapping, the displayed words are:", _moduleId);
        for (int i = 0; i < displayed.Length; i++)
        {
            Debug.LogFormat("[Dragon Energy #{0}] {1} = {2}", _moduleId, displayed[i].getWord(), displayed[i].getPosition().getCircle().ToReadable());
        }

        char[] letters    = info.GetSerialNumberLetters().ToArray();
        int    vowelCount = 0;

        foreach (char letter in letters)
        {
            if (letter == 'A' || letter == 'E' || letter == 'I' || letter == 'O' || letter == 'U')
            {
                vowelCount++;
            }
        }

        if (info.GetBatteryCount() > 10 && (info.GetSerialNumberNumbers().ToArray()[info.GetSerialNumberNumbers().ToArray().Length - 1] == 5 || info.GetSerialNumberNumbers().ToArray()[info.GetSerialNumberNumbers().ToArray().Length - 1] == 7))
        {
            Swaps(1);
        }
        else if (info.GetPortPlateCount() > info.GetBatteryHolderCount() && (modules.Contains("Morse War") || modules.Contains("Double Color")))
        {
            Swaps(2);
        }
        else if ((info.IsIndicatorOn(Indicator.SIG) && info.IsIndicatorOn(Indicator.FRK)) || (info.GetOffIndicators().Count() == 3))
        {
            Swaps(3);
        }
        else if (info.GetModuleNames().Count() > 8)
        {
            Swaps(4);
        }
        else if (vowelCount >= 2)
        {
            Swaps(5);
        }
        else if (info.GetSolvedModuleNames().Count() == 0)
        {
            Swaps(6);
            dependsOnSolvedModules = true;
        }
        else
        {
            Swaps(7);
        }

        Debug.LogFormat("[Dragon Energy #{0}] After swapping, the displayed words are:", _moduleId);
        for (int i = 0; i < displayed.Length; i++)
        {
            Debug.LogFormat("[Dragon Energy #{0}] {1} = {2}", _moduleId, displayed[i].getWord(), displayed[i].getPosition().getCircle().ToReadable());
        }
    }
Пример #34
0
        static void Main()
        {
            Urgency            urgency            = new Urgency();
            Patient            patient            = new Patient();
            Staff              medic              = new Staff();
            MedicalAppointment medicalAppointment = new MedicalAppointment();



            urgency.LoadPatientsFromFile();
            urgency.LoadMedicalAppointmentFromFile();
            urgency.LoadStaffFromFile();


            Console.WriteLine("Listagem de Staff");
            Console.WriteLine();
            Console.WriteLine("Quantidade: {0}", urgency.Patients.Count);
            urgency.PrintAllStaff(urgency.Staff);
            Console.WriteLine();

            Console.WriteLine("Listagem de Pacientes");
            Console.WriteLine();
            Console.WriteLine("Quantidade: {0}", urgency.Staff.Count);
            urgency.PrintAllPatients(urgency.Patients);
            Console.WriteLine();

            Console.WriteLine("Listagem de Consultas Existentes");
            Console.WriteLine();
            Console.WriteLine("Quantidade: {0}", urgency.MedicalAppointments.Count);
            urgency.PrintAllMedicalAppointments(urgency.MedicalAppointments);
            Console.WriteLine("Premir qualquer tecla para continuar");


            Console.ReadKey();

            Console.Clear();
            patient = patient.CreateNewPatient(patient);
            urgency.Patients.Add(patient);

            Console.WriteLine("Premir qualquer tecla para continuar");

            Console.ReadKey();

            Console.Clear();



            medic = medic.CreateNewStaff(medic);
            urgency.Staff.Add(medic);

            Console.WriteLine("Premir qualquer tecla para continuar");

            Console.ReadKey();

            Console.Clear();



            urgency.AddDiseaseToPatient(urgency.Patients, 1);
            urgency.Patients.Sort((x, y) => - x.Screen.CompareTo(y.Screen));
            medicalAppointment = medicalAppointment.CreateNewMedicalAppointment(medicalAppointment, urgency.Patients.First(), urgency.Staff.First());
            urgency.MedicalAppointments.Add(medicalAppointment);
            urgency.Patients.Sort((x, y) => - x.Screen.CompareTo(y.Screen));



            Console.WriteLine("Premir qualquer tecla para continuar");

            Console.ReadKey();

            Console.Clear();



            urgency.PrintPatient(urgency.FindPatientByIdinList(urgency, 1));



            urgency.SavePatientsToFile();
            urgency.SaveStaffToFile();
            urgency.SaveMedicalAppointmentsToFile();

            Console.WriteLine("Premir qualquer tecla para fechar");


            Console.ReadKey();

            Environment.Exit(1);
        }
 public async Task AddUrgencyAsync(Urgency urgency)
 {
     await _context.Guardians.ToListAsync();
 }
Пример #36
0
 public App2ComplementRequest(Urgency urgancy)
 {
     Urgency = urgancy;
 }
Пример #37
0
        public static void WriteToLog(Urgency urgency, string log, string source)
        {
            if (LogConsole)
                Console.WriteLine(log);

            LogItem item = new LogItem(urgency, log, source);

            if (_log == null)
                _log = new BindingList<LogItem>();

            BindingList<LogItem> copyLog = new BindingList<LogItem>();

            lock (_log)
            {
                _log.Add(item);
                // check if we reached upper level ..
                if (_log.Count >= CacheMaxLogLines)
                {
                    // yes .. then take all until the lover level
                    for (int index = 0; index < CacheMaxLogLines - CacheMinLogLines; index++)
                    {
                        copyLog.Add(_log[0]);
                        _log.RemoveAt(0);
                    }
                }
            }
            // save the logs in a new thread
            if (copyLog.Count > 0)
            {
                if (CacheMaxLogLines == 1)
                {
                    SaveLogToFile(copyLog);
                }
                else
                {
                    new Thread(() =>
                        {
                            SaveLogToFile(copyLog);
                        }).Start();
                }
            }
            // Call delegate in case we have a subscriber
            if (LogItemPostAdd != null)
                LogItemPostAdd("Logger", new EventArgs());
        }
Пример #38
0
 public void Update(Urgency table)
 {
     _urgency.Update(table);
 }
Пример #39
0
 /// <summary>
 /// Postavlja hitnost
 /// </summary>
 /// <param name="urgency"></param>
 protected internal virtual void ChangeUrgency(Urgency urgency)
 {
     this.urgency = urgency;
 }