//5.Given a birth can planned
        //a)Show the rooms reserved the birth
        //b)Show the clinicians assigned the birth
        private static void ShowRoomsAndClinicianReservedForBirth(BirthDbContext context)
        {
            Console.WriteLine(" - Hvilket BirthID søger du efter?");
            var input   = Console.ReadLine();
            var inputId = int.Parse(input);

            Birth birth =
                context.Birth

                .Include(b => b.Child)
                .ThenInclude(c => c.Mother)
                .ThenInclude(m => m.Reservations)
                .ThenInclude(r => r.ReservedRoom)
                .Include(b => b.Clinicians)
                .ThenInclude(b => b.Clinician)
                .SingleOrDefault(b => b.BirthId == inputId);

            Console.WriteLine("Fødsels ID: " + birth.BirthId + " Navn: " + birth.Child.FullName);
            Console.WriteLine(" Associeret personale:");
            foreach (var cb in birth.Clinicians)
            {
                Console.WriteLine("   " + cb.Clinician.FullName + " " + cb.Clinician.GetType().Name);
            }

            Console.WriteLine(" Reserverede rum: ");
            Child c = birth.Child;

            foreach (var r in c.Mother.Reservations)
            {
                Console.WriteLine("   " + r.ReservedRoom.RoomName + " med reservationsID: " + r.ReservationId);
            }
            Console.WriteLine("\n\n");
        }
示例#2
0
        public List <Child> EndBirth(Birth birth)
        {
            birth.Ended = 1;

            birth.Children = GenerateBornChildren(birth, birth.Parents);
            return(birth.Children);
        }
 private FakeEventSourcedAggregateRootWithMemento(FakeEntityId id, decimal amount, string name, Birth age)
 {
     Id     = id;
     Amount = amount;
     Name   = name;
     Age    = age;
 }
 protected override void SetMemento(FakeAggregateSnapshot memento)
 {
     Id     = memento.Id;
     Amount = memento.Amount;
     Name   = memento.Name;
     Age    = memento.Age;
 }
        public void InitDefault()
        {
            Birth.AddKey(0, 1.0f);
            Life.AddKey(0, 10.0f);
            Thickness.AddKey(0, 1.0f);
            Velocity.AddKey(0, new Vector3(0, 1, 0));


            MyAnimatedPropertyVector4 colorKey = new MyAnimatedPropertyVector4(Color.Name);

            colorKey.AddKey(0, new Vector4(1, 0, 0, 1));
            colorKey.AddKey(1, new Vector4(0, 0, 1, 1));
            Color.AddKey(0, colorKey);

            MyAnimatedPropertyFloat radiusKey = new MyAnimatedPropertyFloat(Radius.Name);

            radiusKey.AddKey(0, 1.0f);
            Radius.AddKey(0, radiusKey);

            MyAnimatedPropertyTransparentMaterial materialKey = new MyAnimatedPropertyTransparentMaterial(Material.Name);

            materialKey.AddKey(0, MyTransparentMaterials.GetMaterial("Smoke"));
            Material.AddKey(0, materialKey);

            LODBirth.AddKey(0, 1.0f);
            LODBirth.AddKey(MyConstants.MAX_PARTICLE_DISTANCE_DEFAULT, 0f);
            LODRadius.AddKey(0, 1.0f);

            PivotDistVar.SetValue(1.0f);

            AccelerationVar.SetValue(0.0f);

            UseLayerSorting.SetValue(false);
            SortLayer.SetValue(-1);
        }
示例#6
0
文件: Leader.cs 项目: tier6tank/DFWV
        internal override void Export(string table)
        {
            var vals = new List <object>
            {
                Name.DBExport(),
                Hf.DBExport(),
                LeaderType.DBExport(LeaderTypes),
                Race.DBExport(),
                Birth.DBExport(true),
                Birth.DBExport(false),
                Death.DBExport(true),
                Death.DBExport(false),
                ReignBegan.DBExport(true),
                Inheritance.DBExport(InheritanceTypes),
                InheritedFromSource.ToString(),
                InheritedFrom.DBExport(),
                Civilization.DBExport(),
                Site.DBExport(),
                Worship == null ? DBNull.Value : Worship.Name.DBExport(),
                WorshipPercent,
                Spouse.DBExport()
            };

            Database.ExportWorldItem(table, vals);
        }
        /// <summary>
        /// Only for some testing values
        /// </summary>
        public void InitDefault()
        {
            Birth.AddKey(0, 1.0f);
            Life.AddKey(0, 10.0f);
            Thickness.AddKey(0, 1.0f);
            Velocity.AddKey(0, new Vector3(0, 1, 0));


            MyAnimatedPropertyVector4 colorKey = new MyAnimatedPropertyVector4(Color.Name);

            colorKey.AddKey(0, new Vector4(1, 0, 0, 1));
            colorKey.AddKey(1, new Vector4(0, 0, 1, 1));
            Color.AddKey(0, colorKey);

            MyAnimatedPropertyFloat radiusKey = new MyAnimatedPropertyFloat(Radius.Name);

            radiusKey.AddKey(0, 1.0f);
            Radius.AddKey(0, radiusKey);

            MyAnimatedPropertyTransparentMaterial materialKey = new MyAnimatedPropertyTransparentMaterial(Material.Name);

            materialKey.AddKey(0, MyTransparentMaterials.GetMaterial("Smoke"));
            Material.AddKey(0, materialKey);

            LODBirth.AddKey(0, 1.0f);
            LODRadius.AddKey(0, 1.0f);

            UseLayerSorting.SetValue(false);
            SortLayer.SetValue(-1);
        }
示例#8
0
        public ActionResult Birth(Birth birth)
        {
            if (ModelState != null)
            {
                using (RevenueManagementDbContext db = new RevenueManagementDbContext())
                {
                    var result1 = db.Births.Where(a => a.Email == birth.Email).FirstOrDefault();
                    if (result1 == null)
                    {
                        ViewBag.Feedback = "Failed";
                        return(RedirectToAction("Birth"));
                    }


                    var result = db.Citizens.Single(a => a.Email == birth.Email);

                    if (result == null)
                    {
                        ViewBag.Feedback = "Failed";
                        return(RedirectToAction("Birth"));
                    }


                    birth.CitizenId = result.CitizenId;
                    db.Births.Add(birth);
                    db.SaveChanges();
                    ModelState.Clear();
                    ViewBag.Feedback = result1.Id;
                }
            }
            return(View());
        }
示例#9
0
        public ActionResult Edit(Birth emp)
        {
            using (RevenueManagementDbContext db = new RevenueManagementDbContext())
            {
                var emp1 = db.Births.Where(row => row.Id == emp.Id).FirstOrDefault();
                if (emp1 == null)
                {
                    return(RedirectToAction("RegisteredBirth"));
                }

                emp1.Id             = emp.Id;
                emp1.Occupation     = emp.Occupation;
                emp1.AmountPaid     = emp.AmountPaid;
                emp1.Bank           = emp.Bank;
                emp1.NameOfBaby     = emp.NameOfBaby;
                emp1.DOB            = emp.DOB;
                emp1.PlaceOfBirth   = emp.PlaceOfBirth;
                emp1.DateRegistered = emp.DateRegistered;
                emp1.Email          = emp.Email;
                int res = db.SaveChanges();
                if (res > 0)
                {
                    ViewBag.Message = "Successfully Updated";
                }
            }
            return(View());
        }
示例#10
0
        //
        // GET: /Birth/Delete/5
        public ActionResult Delete(Int32 id)
        {
            Birth birth = db.Births.FirstOrDefault(m => m.id == id);

            if (birth == null)
            {
                return(HttpNotFound());
            }
            int      userID   = (int)Membership.GetUser().ProviderUserKey;
            Breeding breeding = db.Breedings.Find(birth.breed_id);

            if (breeding == null)
            {
                return(HttpNotFound());
            }
            breeding.Animal = db.Animals.Find(breeding.father_id);
            if ((!User.IsInRole("admin")) && breeding.Animal.UserProfile.UserId != userID)
            {
                return(HttpNotFound());
            }

            BirthViewModel bvm = new BirthViewModel();

            bvm.birth         = birth;
            bvm.offspring_tag = birth.Animal.tag;
            bvm.father_tag    = db.Animals.Find(db.Breedings.Find(birth.breed_id).father_id).tag;
            bvm.mother_tag    = db.Animals.Find(db.Breedings.Find(birth.breed_id).mother_id).tag;
            return(View(bvm));
        }
示例#11
0
        public ActionResult Edit(Birth birth)
        {
            birth.Animal = db.Animals.Find(birth.child_id);
            if (ModelState.IsValid)
            {
                db.Entry(birth).State = EntityState.Modified;
                try
                {
                    db.SaveChanges();
                }
                catch
                {
                    return(RedirectToAction("Error", "Home"));
                }
                return(RedirectToAction("Index", new { id = birth.breed_id }));
            }
            BirthViewModel bvm = new BirthViewModel();

            bvm.birth         = birth;
            bvm.offspring_tag = birth.Animal.tag;
            bvm.father_tag    = db.Animals.Find(db.Breedings.Find(birth.breed_id).father_id).tag;
            bvm.mother_tag    = db.Animals.Find(db.Breedings.Find(birth.breed_id).mother_id).tag;

            return(View(birth));
        }
        public void CancelReservation()
        {
            List <Birth> list = PrintAllBirths();

            Console.WriteLine();
            Console.WriteLine("Indtast fødsels nummer:");
            int number = int.Parse(Console.ReadLine());

            Birth birth = _birthClinicPlanningService.Births
                          .Find(Builders <Birth> .Filter.Where(b => b.BirthId == list.ElementAt(number).BirthId)).Single();

            Console.WriteLine();

            int counterRoom = 0;

            foreach (var objectId in birth.ReservedRooms)
            {
                Console.WriteLine($"Nummer {counterRoom} Rum id: {objectId}");
                counterRoom++;
            }

            Console.WriteLine("Indtast nummer på rum");

            int roomNumber = int.Parse(Console.ReadLine());

            var roomFilter = Builders <Room> .Filter.Where(r => r.RoomId == birth.ReservedRooms.ElementAt(roomNumber).ToString());

            Room room = _birthClinicPlanningService.Rooms.Find(roomFilter).Single();

            List <Reservation> test = new List <Reservation>();

            int counter = 0;

            foreach (var reservation in room.ReservationList)
            {
                test.Add(reservation);
                Console.WriteLine($"Reservation:{counter}");
                Console.WriteLine($"Startdato: {reservation.ReservationStartDate}");
                Console.WriteLine($"Slutdato: {reservation.ReservationEndDate}");
                counter++;
            }

            if (room.ReservationList.Count != 0)
            {
                Console.WriteLine("Vælg hvilken reservation der skal slettes:");
                int choice = int.Parse(Console.ReadLine());

                var update = Builders <Room> .Update.PullFilter(r => r.ReservationList, Builders <Reservation> .Filter.Where(r => r.ReservationEndDate == test.ElementAt(choice).ReservationEndDate));

                _birthClinicPlanningService.Rooms.UpdateOne(roomFilter, update);
            }
            else
            {
                Console.WriteLine("\nDer er ingen reservationer for dette rum");
            }
        }
示例#13
0
        public static Birth CreateFakeBirth()
        {
            var faker = new Faker("en");
            var o     = new Birth()
            {
                BirthDate = faker.Date.Between(DateTime.Now, DateTime.Now.AddDays(10)),
            };

            return(o);
        }
示例#14
0
        private void btnFalsaPreniez_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtAreteInseminacion.Text) || !string.IsNullOrWhiteSpace(txtAreteInseminacion.Text))
            {
                Swine  swine = new Swine();
                Main   main  = new Main();
                string arete = txtAreteInseminacion.Text;
                swine = main.ExisteArete(arete);

                if (swine.getArete() != null)
                {
                    if (swine.partos.Count > 0)
                    {
                        DateTime now               = DateTime.Now;
                        Birth    birth             = swine.partos.Last();
                        string   last              = birth.getFechaInseminacion();
                        DateTime fechaConfirmacion = DateTime.ParseExact(birth.getFechaConfirmacion28(), "dd-MM-yyyy", null);
                        int      comparacion       = now.CompareTo(fechaConfirmacion);

                        if (comparacion > 0)
                        {
                            DateTime dateFalsaPreniez = fechaFalsaP.Value;
                            int      comparacion2     = dateFalsaPreniez.CompareTo(fechaConfirmacion);

                            if (comparacion > 0) //Será necesaria?
                            {
                                string date = dateFalsaPreniez.Date.ToString("dd-MM-yyyy");
                                birth.setFechaFalsaPreniez(date);
                                main.Update(swine);
                            }
                            else
                            {
                                MessageBox.Show("La fecha que ingresó es anterior a la fecha de confirmación");
                            }
                        }
                        else
                        {
                            MessageBox.Show("Aún no han pasado los 28 días de confirmación");
                        }
                    }
                    else
                    {
                        MessageBox.Show("La hembra nunca ha iniciado proceso de embarazo");
                    }
                }
                else
                {
                    MessageBox.Show("El número de arete que ingresó no existe");
                }
            }
            else
            {
                MessageBox.Show("Debe ingresar el arete de una hembra para continuar");
            }
        }
示例#15
0
        public static bool CreateReservations(BirthClinicDbContext Context, Birth Birth, out List <Reservation> reservations)
        {
            var MaternityStartTime = Birth.BirthDate.AddHours(-132);
            var MaternityEndTime   = Birth.BirthDate.AddHours(-12);

            var RestStartTime = Birth.BirthDate;
            var RestEndTime   = Birth.BirthDate.AddHours(4);

            var BirthStartTime = Birth.BirthDate.AddHours(-12);
            var BirthEndTime   = Birth.BirthDate;

            var AvailableMaternityRoom = FindAvailableRooms(Context.Rooms, MaternityStartTime, MaternityEndTime, RoomType.MATERNITY);
            var AvailableBirthRoom     = FindAvailableRooms(Context.Rooms, MaternityStartTime, MaternityEndTime, RoomType.BIRTH);
            var AvailableRestRoom      = FindAvailableRooms(Context.Rooms, MaternityStartTime, MaternityEndTime, RoomType.REST);

            //Not possible to create a birth at the given time. Find another  hospital.
            if (AvailableBirthRoom == null || AvailableMaternityRoom == null || AvailableRestRoom == null)
            {
                reservations = null;
                return(false);
            }
            else //There are available rooms of all 3 categories! Nice!
            {
                //create reservations
                var MaternityRes = new Reservation
                {
                    StartTime       = MaternityStartTime,
                    EndTime         = MaternityEndTime,
                    ReservedRoom    = AvailableMaternityRoom,
                    AssociatedBirth = Birth
                };

                var BirthRes = new Reservation
                {
                    StartTime       = BirthStartTime,
                    EndTime         = BirthEndTime,
                    ReservedRoom    = AvailableBirthRoom,
                    AssociatedBirth = Birth
                };

                var RestRes = new Reservation
                {
                    StartTime       = RestStartTime,
                    EndTime         = RestEndTime,
                    ReservedRoom    = AvailableRestRoom,
                    AssociatedBirth = Birth
                };

                reservations = new List <Reservation> {
                    MaternityRes, BirthRes, RestRes
                };
                return(true);
            }
        }
示例#16
0
        public void ChangeDateBirth(DateTime birth)
        {
            if (Birth == null || birth.Equals(DateTime.MinValue) || Birth.Equals(birth))
            {
                return;
            }

            Birth = birth;
            CalculateAge();
            EntityModified();
        }
示例#17
0
 public virtual dynamic ToObject()
 {
     return(new
     {
         name = Name,
         cpf = CPF,
         email = Email,
         phone_number = PhoneNumber,
         birth = Birth.ToStringDate()
     });
 }
示例#18
0
        //-----------
        //  METHODS
        //-----------

        /// <summary>
        /// Override of the ToString function
        /// </summary>
        /// <returns>Returns a quick description of the child</returns>
        public override string ToString()
        {
            string str = "";

            str += "ID: " + String.Format("{0}", ID);
            str += "\nMother's ID: " + String.Format("{0}", MotherID);
            str += String.Format("\nFirst name: {0}", FirstName);
            str += String.Format("\nBirth: {0}", Birth.ToShortDateString());
            str += (SpecialNeeds ? "\n==========================\nNeeds: " + Needs + "\n==========================\n": "");

            return(str);
        }
示例#19
0
 private void setInitialPosition(Birth birth)
 {
     if (birth == Birth.Point)
     {
         shape.transform.position = new Vector3(0, 5, 0);
     }
     else
     {
         float x = Random.Range(-10, 10);
         shape.transform.position = new Vector3(x, 5, 0);
     }
 }
示例#20
0
        public override string ToString()
        {
            string s = "STUDENT: " + Name + " - " + Birth.ToLongDateString();

            if (Courses != null)
            {
                s += "\nList of courses:\n";
                foreach (var item in Courses)
                {
                    s += "\n-" + item;
                }
            }
            return(s);
        }
示例#21
0
        public override bool Equals(object obj)
        {
            Employee employee = (Employee)obj;

            return(employee.IdEmployee == IdEmployee &&
                   employee.CompanyId == CompanyId &&
                   employee.HaveLogin == HaveLogin &&
                   employee.Permission == Permission &&
                   employee.Salary == Salary &&
                   employee.OfficeId == OfficeId &&
                   employee.NameEmployee.Equals(NameEmployee) &&
                   employee.Birth.ToString("dd/MM/yyyy").Equals(Birth.ToString("dd/MM/yyyy")) &&
                   employee.Admission.ToString("dd/MM/yyyy").Equals(Admission.ToString("dd/MM/yyyy")));
        }
示例#22
0
        public ActionResult Delete(int id)
        {
            CartOrderCompletion order = db.CartOrders.Find(id);
            Birth birth = db.Births.Find(order.Birth.BirthID);

            if (order != null)
            {
                db.CartOrders.Remove(order);
                db.Births.Remove(birth);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(HttpNotFound("Couldn't find the order with id " + id.ToString() + "!"));
        }
示例#23
0
 public void LoadEnded()
 {
     Emails.LoadEnded();
     FirstNames.LoadEnded();
     LastNames.LoadEnded();
     Phones.LoadEnded();
     Sex.LoadEnded();
     Countries.LoadEnded();
     Cities.LoadEnded();
     Statuses.LoadEnded();
     Joined.LoadEnded();
     Birth.LoadEnded();
     Interests.LoadEnded();
     Premiums.LoadEnded();
 }
示例#24
0
 public void Compress()
 {
     Emails.Compress();
     FirstNames.Compress();
     LastNames.Compress();
     Phones.Compress();
     Sex.Compress();
     Countries.Compress();
     Cities.Compress();
     Statuses.Compress();
     Joined.Compress();
     Birth.Compress();
     Interests.Compress();
     Premiums.Compress();
 }
示例#25
0
 public void Clear()
 {
     Sex.Clear();
     Status.Clear();
     Country.Clear();
     City.Clear();
     Birth.Clear();
     Interest.Clear();
     Like.Clear();
     Joined.Clear();
     Limit = 0;
     Order = false;
     Keys  = 0;
     KeyOrder.Clear();
 }
示例#26
0
        public void ShowReservedRooms()
        {
            List <Birth> list = PrintAllBirths();

            Console.WriteLine("Indtast fødsels nummer:");
            int id = int.Parse(Console.ReadLine());

            Birth birth = _birthClinicPlanningService.Births.Find(Builders <Birth> .Filter.Where(b => b.BirthId == list.ElementAt(id).BirthId)).Single();

            foreach (var objectId in birth.ReservedRooms)
            {
                Room room = FindRoomById(objectId);
                Console.WriteLine($"Rumnummer: {room.RoomNumber} \nRum type: {room.RoomType}");
            }
        }
示例#27
0
        public Birth ScheduleBirth(List <Clinician> clinicians, List <Parent> parents, BirthRoom birthRoom,
                                   MaternityRoom maternityRoom, RestRoom restRoom, DateTime startTime)
        {
            Birth birth = new Birth()
            {
                Clinicians    = clinicians,
                Parents       = parents,
                BirthRoom     = birthRoom,
                RestRoom      = restRoom,
                MaternityRoom = maternityRoom,
                ScheduledTime = startTime,
            };

            return(birth);
        }
示例#28
0
        public ActionResult DeleteConfirmed(Int32 id)
        {
            Birth birth = db.Births.FirstOrDefault(m => m.id == id);

            db.Births.Remove(birth);
            try
            {
                db.SaveChanges();
            }
            catch
            {
                return(RedirectToAction("Error", "Home"));
            }
            return(RedirectToAction("Index", new { id = birth.breed_id }));
        }
示例#29
0
        public ActionResult BuyNow(CartOrderCompletionBirthViewModel orderRequest)
        {
            List <CartItem> cart = (List <CartItem>)Session["cart"];

            try
            {
                if (ModelState.IsValid)
                {
                    Birth birth = new Birth
                    {
                        BirthYear  = orderRequest.BirthYear,
                        BirthMonth = orderRequest.BirthMonth,
                        BirthDay   = orderRequest.BirthDay
                    };
                    db.Births.Add(birth);

                    CartOrderCompletion order = new CartOrderCompletion
                    {
                        First_name   = orderRequest.First_name,
                        Last_name    = orderRequest.Last_name,
                        Phone_number = orderRequest.Phone_number,
                        Region       = orderRequest.Region,
                        City         = orderRequest.City,
                        Address      = orderRequest.Address,
                        Birth        = birth
                    };

                    order.Data = DateTime.Now.ToString();
                    foreach (CartItem item in cart)
                    {
                        order.Products += "[" + item.Product.Name + "," + item.Product.Brand + "," + item.Quantity + "] ";
                    }
                    db.CartOrders.Add(order);

                    db.SaveChanges();
                    // se elibereaza cosul
                    Session.Clear();

                    return(RedirectToAction("Index", "Phone"));
                }

                return(View(orderRequest));
            }
            catch (Exception e)
            {
                return(View(orderRequest));
            }
        }
示例#30
0
        public override dynamic ToObject()
        {
            dynamic customer = new ExpandoObject();

            customer.name         = Name;
            customer.cpf          = CPF.ToDigitsOnly();
            customer.phone_number = PhoneNumber.ToDigitsOnly();
            customer.birth        = Birth.ToStringDate();
            customer.address      = Address.ToObject();
            customer.email        = Email;
            if (JuridicalPerson != null)
            {
                customer.juridical_person = JuridicalPerson.ToObject();
            }
            return(customer);
        }