Esempio n. 1
0
        private List <Depasments> OTDetailOTList()
        {
            List <Depasments> add = new List <Depasments>();

            foreach (var i in Department)
            {
                var        DataParts      = DetailOTnew.Where(d => d.Employee.Department_DepartmentID == i.DepartmentID).ToList();
                Depasments DataDepasments = new Depasments();
                DataDepasments.DepasmentsName  = i.DepartmentName;
                DataDepasments.DepasmentsID    = i.DepartmentID;
                DataDepasments.DepasmentsCount = DataParts.Count;


                DataDepasments.CarCount  = DetailOTnew.Where(d => !d.Type.Equals("No") && d.Employee.Department_DepartmentID == i.DepartmentID).ToList().Count;
                DataDepasments.FoodCount = DetailOTnew.Where(d => d.Employee.Department_DepartmentID == i.DepartmentID && !d.FoodSet.NameSet.Equals("No")).ToList().Count;
                List <Parts> Listparts = new List <Parts>();
                foreach (var j in Part)
                {
                    Parts parts = new Parts();
                    parts.PartID   = j.PartID;
                    parts.PartName = j.Name;
                    IList <DetailOT> DataPart = DataParts.Where(d => !d.Point.Part.Name.Equals("No")).ToList();
                    DataPart         = DataPart.Where(d => d.Employee.Department_DepartmentID == i.DepartmentID).ToList();
                    DataPart         = DataPart.Where(d => d.Point.Point_PartID == j.PartID).ToList();
                    parts.PartsCount = DataPart.Where(d => !d.Type.Equals("No")).ToList().Count;
                    if (parts.PartsCount != 0)
                    {
                        Listparts.Add(parts);
                    }
                }
                DataDepasments.ListParts = Listparts;
                List <Foods> Listfoods = new List <Foods>();



                foreach (var j in FoodSet)
                {
                    Foods foods = new Foods();
                    foods.FoodID   = j.FoodSetID;
                    foods.FoodName = j.NameSet;
                    var DataPart = DataParts;

                    DataPart         = DataPart.Where(d => d.FoodSet_FoodSetID == j.FoodSetID && ((d.TimeEnd.Hour == 17 && d.TimeEnd.Minute == 0) || (d.TimeStart.Hour == 8 && d.TimeStart.Minute == 0))).ToList();
                    foods.FoodsCount = DataPart.Count;
                    if (foods.FoodsCount != 0)
                    {
                        Listfoods.Add(foods);
                    }
                }
                DataDepasments.ListFoods = Listfoods;
                add.Add(DataDepasments);
            }

            return(add);
        }
        private List <food> foodMass()
        {
            var foodAdd = new List <food>();

            for (int i = 0; i < 2; i++)
            {
                var Addfood = new food();

                int timeCheck = 0;
                if (i == 0)
                {
                    timeCheck = 8;
                }
                else
                {
                    timeCheck = 17;
                }
                var foodlist = new List <foodList>();
                foreach (var item in FoodSet)
                {
                    if (!item.NameSet.Equals("No"))
                    {
                        var add = new foodList();
                        if (timeCheck == 8)
                        {
                            add.list    = DetailOTnew.Where(c => c.TimeStart.Hour == timeCheck && c.TimeStart.Minute == 0 && c.FoodSet_FoodSetID == item.FoodSetID).ToList();
                            add.set     = item;
                            add.contSet = DetailOTnew.Where(c => c.TimeStart.Hour == timeCheck && c.TimeStart.Minute == 0 && c.FoodSet_FoodSetID == item.FoodSetID).ToList().Count;
                        }
                        if (timeCheck == 17)
                        {
                            add.list    = DetailOTnew.Where(c => c.TimeEnd.Hour == timeCheck && c.TimeEnd.Minute == 0 && c.FoodSet_FoodSetID == item.FoodSetID).ToList();
                            add.set     = item;
                            add.contSet = DetailOTnew.Where(c => c.TimeEnd.Hour == timeCheck && c.TimeEnd.Minute == 0 && c.FoodSet_FoodSetID == item.FoodSetID).ToList().Count;
                        }
                        if (add.contSet != 0)
                        {
                            foodlist.Add(add);
                        }
                    }
                }
                Addfood.time     = timeCheck;
                Addfood.foodList = foodlist;

                if (Addfood.foodList.Count != 0)
                {
                    foodAdd.Add(Addfood);
                }
            }

            return(foodAdd);
        }
Esempio n. 3
0
        private List <Depasments> OTDetailOTList()
        {
            List <Depasments> add = new List <Depasments>();

            foreach (var i in Department)
            {
                Depasments DataDepasments = new Depasments();
                DataDepasments.DepasmentsName  = i.DepartmentName;
                DataDepasments.DepasmentsID    = i.DepartmentID;
                DataDepasments.DepasmentsCount = DetailOTnew.Where(d => d.Employee.Employee_DepartmentID == i.DepartmentID).ToList().Count;
                DataDepasments.CarCount        = DetailOTnew.Where(d => !d.Type.Equals("No") && d.Employee.Employee_DepartmentID == i.DepartmentID).ToList().Count;
                DataDepasments.FoodCount       = DetailOTnew.Where(d => d.FoodSet_FoodSetID != 1 && d.Employee.Employee_DepartmentID == i.DepartmentID).ToList().Count;
                List <Parts> Listparts = new List <Parts>();
                foreach (var j in Part)
                {
                    Parts parts = new Parts();
                    parts.PartID   = j.PartID;
                    parts.PartName = j.Name;
                    IList <DetailOT> DataPart = DetailOTnew.Where(d => d.Part_PaetID != 1).ToList();
                    DataPart         = DataPart.Where(d => d.Employee.Employee_DepartmentID == i.DepartmentID).ToList();
                    DataPart         = DataPart.Where(d => d.Part_PaetID == j.PartID).ToList();
                    parts.PartsCount = DataPart.Where(d => !d.Type.Equals("No")).ToList().Count;
                    if (parts.PartsCount != 0)
                    {
                        Listparts.Add(parts);
                    }
                }
                DataDepasments.ListParts = Listparts;
                List <Foods> Listfoods = new List <Foods>();

                foreach (var j in FoodSet)
                {
                    Foods foods = new Foods();
                    foods.FoodID   = j.FoodSetID;
                    foods.FoodName = j.NameSet;
                    IList <DetailOT> DataPart = DetailOTnew.Where(d => d.FoodSet_FoodSetID != 1).ToList();
                    DataPart         = DataPart.Where(d => d.Employee.Employee_DepartmentID == i.DepartmentID).ToList();
                    DataPart         = DataPart.Where(d => d.FoodSet_FoodSetID == j.FoodSetID).ToList();
                    foods.FoodsCount = DataPart.Where(d => !d.Type.Equals("No")).ToList().Count;
                    if (foods.FoodsCount != 0)
                    {
                        Listfoods.Add(foods);
                    }
                }
                DataDepasments.ListFoods = Listfoods;
                add.Add(DataDepasments);
            }

            return(add);
        }
Esempio n. 4
0
        private OTs ListOTDetail(int?Did)
        {
            OTs OTsnew = new OTs();


            DetailOTnew      = DetailOT.Where(d => d.OT_OTID == Did && d.Status.Equals("Allow")).ToList();
            OTsnew.countEmp  = DetailOTnew.Count;
            OTsnew.countCar  = DetailCarQueue.Count;
            OTsnew.countFood = DetailOTnew.Where(e => !e.FoodSet.NameSet.Equals("No")).ToList().Count;
            //foreach (var i in DetailOTnew)
            //{
            //    if (i.FoodSet.NameSet.Equals("No"))
            //    {
            //        OTsnew.countFood = OTsnew.countFood + 1;
            //    }
            //    if (!i.Type.Equals("No"))
            //    {
            //        OTsnew.countCar = OTsnew.countCar + 1;
            //    }

            //}

            return(OTsnew);
        }
Esempio n. 5
0
        private List <CarsPart> ManageCar(IList <DetailOT> mDetailOTnew)
        {
            List <CarsPart> CarsParts = new List <CarsPart>();

            foreach (var i in Part)
            {
                CarsPart CarsPartNew = new CarsPart();
                CarsPartNew.PartID   = i.PartID;
                CarsPartNew.namePart = i.Name;

                List <Cars> CarsNew = new List <Cars>();

                CarsPartNew.DetailOT = mDetailOTnew.Where(c => c.Part_PaetID == i.PartID).ToList();
                int count = mDetailOTnew.Where(c => c.Part_PaetID == i.PartID).ToList().Count;

                foreach (var j in CarType)
                {
                    if (j.Seat != 0)
                    {
                        Cars cars = new Cars();
                        if (j.Seat <= count)
                        {
                            cars.CarTypeID   = j.CarTypeID;
                            cars.CarTypeName = j.NameCar;
                            cars.seed        = j.Seat;



                            int add = count / j.Seat;
                            count         = count % j.Seat;
                            cars.countCar = add;
                            CarsNew.Add(cars);
                        }
                        else
                        {
                            cars.CarTypeID   = j.CarTypeID;
                            cars.CarTypeName = j.NameCar;
                            cars.seed        = j.Seat;
                            cars.countCar    = 0;
                            CarsNew.Add(cars);
                        }
                    }
                }
                Cars min     = new Cars();
                int  seedMon = 9999;
                foreach (var j in CarType)
                {
                    if (j.Seat != 0)
                    {
                        if (j.Seat < seedMon)
                        {
                            seedMon         = j.Seat;
                            min.CarTypeID   = j.CarTypeID;
                            min.CarTypeName = j.NameCar;
                            min.seed        = j.Seat;
                            min.countCar    = 1;
                        }
                    }
                }

                if (count > 0)
                {
                    int check = 0;
                    foreach (var j in CarsNew)
                    {
                        if (j.CarTypeID == min.CarTypeID)
                        {
                            check      = +1;
                            j.countCar = j.countCar + 1;
                            break;
                        }
                    }
                    if (check == 0)
                    {
                        CarsNew.Add(min);
                    }
                }


                CarsPartNew.ListCars = CarsNew;
                if (DetailOTnew.Where(d => d.Part_PaetID == i.PartID).ToList().Count != 0)
                {
                    CarsParts.Add(CarsPartNew);
                }
            }

            return(CarsParts);
        }