Example #1
0
        private List <OrderDetailsViewManager> GetOrdersFromDBManager()
        {
            List <OrderDetailsView> list = GetOrdersFromDB();

            List <OrderDetailsViewManager> listManager = new List <OrderDetailsViewManager>();

            for (int i = 0; i < list.Count; i++)
            {
                OrderDetailsViewManager lm = (OrderDetailsViewManager)list[i];

                listManager.Add(lm);
            }
            return(listManager);
        }
Example #2
0
        private bool EqualsOrders(OrderDetailsViewManager order, OrdersTbl ordert)
        {
            bool equal = true;

            equal = equal && order.Discount == ordert.discount;
            equal = equal && order.FromDate == ordert.FromDate;
            equal = equal && order.ToDate == ordert.ToDate;
            equal = equal && order.ManagerComments == ordert.ManagerComments;
            equal = equal && order.OrderStatus == ordert.OrderStatus;
            equal = equal && order.Price == ordert.Price;
            equal = equal && order.ShiftNumberFrom == ordert.ShiftNumberFrom;
            equal = equal && order.ShiftNumberTo == ordert.ShiftNumberTo;
            //  equal = equal && order.mDogs.Count == ordert.DogsInOrder.Count;

            foreach (DogsInOrderView dog in order.mDogs)
            {
                var dogt = context.Set <DogsInOrder>().Find(order.OrderNumber, dog.DogNumber);
                equal = equal && dog.DogTraining == dogt.DogTraining;
                equal = equal && dog.HomeFood == dogt.HomeFood;
                equal = equal && dog.Status == dogt.Status;
            }

            return(equal);
        }
Example #3
0
        //כל הכלבים בכל ההזמנות בתאריך והמשמרת המבוקשים
        public List <DogInRoomDetailsView> GetDogsNoSetting(DateTime date, int shift)

        {
            List <DogInRoomDetailsView> dogsInRoom = new List <DogInRoomDetailsView>();

            using (Entities context = new Entities())
            {
                int rooms = context.RoomsTbl.Count();
                //כל הכלבים המשובצים לחדרים בתאריכים המבןקשים

                for (int i = 1; i <= rooms; i++)
                {
                    dogsInRoom.AddRange(GetDogsInRoom(i, date, shift));
                }

                OrderService orderService = new OrderService();
                //כל ההזמנות
                List <OrderDetailsViewManager> listOrders = orderService.GetAllOrdersAndDogsManager();
                // כל ההזמנות בתאריך והמשמרת המבוקשים
                List <OrderDetailsViewManager> listOrderInDates = listOrders.Where(
                    p => (p.OrderStatus == 12 || p.OrderStatus == 15) &&
                    (p.FromDate <date && p.ToDate> date) ||
                    (p.FromDate == date && p.ShiftNumberFrom <= shift) ||
                    (p.ToDate == date && p.ShiftNumberTo >= shift)

                    ).ToList();
                List <DogsInOrderView> dogsInOrders = new List <DogsInOrderView>();
                //כל הכלבים בכל ההזמנות בתאריך והמשמרת המבוקשים
                for (int i = 0; i < listOrderInDates.Count; i++)
                {
                    dogsInOrders.AddRange(orderService.GetDogsForOrder(listOrderInDates[i].OrderNumber));
                }

                List <DogInRoomDetailsView> outOfRoomsList = new List <DogInRoomDetailsView>();
                foreach (DogsInOrderView dogInOrder in dogsInOrders)
                {
                    if (isExist(dogInOrder.DogNumber, dogsInRoom) == -1)     //כלב בהזמנה ולא משובץ בחדר
                    {
                        DogInRoomDetailsView dogOutOfRoom = new DogInRoomDetailsView();
                        dogOutOfRoom.DogComments  = dogInOrder.DogComments;
                        dogOutOfRoom.DogBirthDate = dogInOrder.DogBirthDate;
                        dogOutOfRoom.DogDig       = dogInOrder.DogDig;
                        // dogOutOfRoom.DogFood=dogInOrder.
                        dogOutOfRoom.DogFriendlyWith  = dogInOrder.DogFriendlyWith;
                        dogOutOfRoom.DogGender        = dogInOrder.DogGender;
                        dogOutOfRoom.DogImage         = dogInOrder.DogImage;
                        dogOutOfRoom.DogJump          = dogInOrder.DogJump;
                        dogOutOfRoom.DogName          = dogInOrder.DogName;
                        dogOutOfRoom.DogNeuter        = dogInOrder.DogNeuter;
                        dogOutOfRoom.DogNumber        = dogInOrder.DogNumber;
                        dogOutOfRoom.DogorderNumber   = dogInOrder.OrderNumber;
                        dogOutOfRoom.DogRabiesVaccine = dogInOrder.DogRabiesVaccine;
                        dogOutOfRoom.DogShvav         = dogInOrder.DogShvav;
                        dogOutOfRoom.DogStatus        = dogInOrder.DogStatus;
                        dogOutOfRoom.DogTraining      = dogInOrder.DogTraining;
                        dogOutOfRoom.DogType          = dogInOrder.DogType;
                        dogOutOfRoom.DogUserID        = dogInOrder.DogUserID;
                        dogOutOfRoom.OrderNumber      = dogInOrder.OrderNumber;

                        OrderDetailsViewManager orderDetailsViewManager = listOrderInDates.Find(o => o.OrderNumber == dogOutOfRoom.OrderNumber);
                        dogOutOfRoom.DogUserID         = orderDetailsViewManager.Userid;
                        dogOutOfRoom.FromDateInPension = orderDetailsViewManager.FromDate;
                        dogOutOfRoom.ToDateInPension   = orderDetailsViewManager.ToDate;
                        dogOutOfRoom.ToDateInRoom      = orderDetailsViewManager.ToDate;
                        dogOutOfRoom.RoomShiftTo       = orderDetailsViewManager.ShiftNumberTo;
                        dogOutOfRoom.UserFirstName     = orderDetailsViewManager.userFirstName;
                        dogOutOfRoom.UserLastName      = orderDetailsViewManager.userLastName;
                        var user = context.UsersTbl.Find(dogOutOfRoom.DogUserID);
                        dogOutOfRoom.UserPhone1 = user.UserPhone1;
                        dogOutOfRoom.UserPhone2 = user.UserPhone2;
                        var vet = context.veterinarTbl.Find(user.UserVeterinarId);
                        dogOutOfRoom.VeterinarName   = vet.VeterinarName;
                        dogOutOfRoom.VeterinarPhone1 = vet.VeterinarPhone1;
                        dogOutOfRoom.RoomNumberDB    = 0;
                        outOfRoomsList.Add(dogOutOfRoom);
                    }
                }
                return(outOfRoomsList);
            }
        }