public int addOrder(CleanOrderDto dto)
        {
            CleanOrder Order = new CleanOrder();

            Order.Hoster      = dto.Hoster;
            Order.moshId      = dto.moshId;
            Order.cleaningEmp = dto.cleaningEmp;

            Order.Description   = dto.Description;
            Order.Creation_Date = dto.Creation_Date;
            Order.Creation_Time = dto.Creation_Time;
            Order.Creation_At   = dto.Creation_At;



            // Order.moshId = _unitOfWork.RoleRepository.FindByName("mosh").Users.Where(x => x.HotelBlock.Rooms == _unitOfWork.RoomRepository.FindById(dto.Room_ID).Id); ;

            //  Order.User = _unitOfWork.UserRepository.FindById(dto.User_ID);

            if (dto.Room_ID.HasValue)
            {
                Order.Room = _unitOfWork.RoomRepository.FindById(dto.Room_ID);
            }
            _unitOfWork.OrderRepository.Add(Order);
            _unitOfWork.SaveChanges();
            return(Order.Id);
        }
        public List <CleanOrderDto> GetAll()
        {
            List <CleanOrder>    list = _unitOfWork.OrderRepository.GetAll();
            List <CleanOrderDto> dtos = new List <CleanOrderDto>();
            CleanOrderDto        dto  = new CleanOrderDto();

            foreach (var item in list)
            {
                dto.Id      = item.Id;
                dto.Istaked = item.isTaked;


                dto.moshId      = item.moshId;
                dto.Hoster      = item.Hoster;
                dto.startdate   = item.startdate;
                dto.enddate     = item.enddate;
                dto.cleaningEmp = item.cleaningEmp;

                dto.isFinished    = item.isFinished;
                dto.Description   = item.Description;
                dto.Creation_At   = item.Creation_At;
                dto.Creation_Date = item.Creation_Date;
                dto.Creation_Time = item.Creation_Time;


                if (item.Room != null)
                {
                    dto.Room_ID = item.Room.Id;
                }
                dtos.Add(dto);
                dto = new CleanOrderDto();
            }
            return(dtos);
        }
Esempio n. 3
0
        public ActionResult EndCleanOrder(CleanOrderDto dto)
        {
            var cleanOrderDto = _orderService.GetById(dto.Id);
            var id            = User.Identity.GetUserId();
            var guid          = new Guid(id);
            var userdto       = _userService.GetById(new Guid(User.Identity.GetUserId()));

            userdto.IsBusy = false;
            _userService.Edit(userdto, new Guid(User.Identity.GetUserId()));
            cleanOrderDto.enddate    = DateTimeHelper.ConvertDateToString(Utils.ServerNow.Date, DateFormats.DD_MM_YYYY) + " " + DateTimeHelper.ConvertTimeToString(Utils.ServerNow.TimeOfDay, TimeFormats.HH_MM_AM);
            cleanOrderDto.isFinished = true;
            cleanOrderDto.Istaked    = true;
            var rom = _RoomService.GetById(Convert.ToInt32(cleanOrderDto.Room_ID));

            cleanOrderDto.Roomnu = rom.RoomNum;
            _orderService.edit(cleanOrderDto);


            rom.isneedclean = false;
            rom.Isrequisted = false;
            _RoomService.Edit(rom);
            MysqlFetchingRoomData.SetCleanStatus(rom.RoomNum, rom.isneedclean);

            roomrecDto roomrecDto = new roomrecDto();

            roomrecDto.Room_Id = (int)cleanOrderDto.Room_ID;
            roomrecDto.Recoed  = _userService.GetById(guid).FullName.ToString() + "تم إنهاء طلب تنظيف من العامل   ";
            _roomrec.Add(roomrecDto);
            return(RedirectToAction("getAllEquipmentsForcleaningEmp", "Equipment", new { Rid = rom.Id }));
        }
Esempio n. 4
0
        public ActionResult takeCleanOrder(CleanOrderDto ordd)
        {
            var dto = _orderService.GetById(ordd.Id);

            dto.startdate = DateTimeHelper.ConvertDateToString(Utils.ServerNow.Date, DateFormats.DD_MM_YYYY) + " " + DateTimeHelper.ConvertTimeToString(Utils.ServerNow.TimeOfDay, TimeFormats.HH_MM_AM);
            var id      = User.Identity.GetUserId();
            var guid    = new Guid(id);
            var userdto = _userService.GetById(guid);

            dto.Istaked    = true;
            userdto.IsBusy = true;
            dto.isFinished = false;
            _userService.Edit(userdto, guid);
            _orderService.edit(dto);
            TempData["ord"] = dto.Id;
            var rom = _RoomService.GetById(Convert.ToInt32(dto.Room_ID));

            MysqlFetchingRoomData.setincleaning(rom.RoomNum.ToString(), false);

            roomrecDto roomrecDto = new roomrecDto();

            roomrecDto.Room_Id = Convert.ToInt32(_orderService.GetById(dto.Id).Room_ID);
            roomrecDto.Recoed  = "تم أستلام   طلب تنظيف من  العامل   " + _userService.GetById(guid).FullName.ToString();
            _roomrec.Add(roomrecDto);

            return(RedirectToAction("EndCleanOrder", new { Oid = dto.Id }));
        }
Esempio n. 5
0
        public ActionResult sendOrderToemp(CleanOrderDto dto, string eid)
        {
            if (ModelState.IsValid)
            {
                dto             = _orderService.GetById(dto.Id);
                dto.cleaningEmp = _userService.GetById(new Guid(eid)).UserId;

                _orderService.edit(dto);

                roomrecDto roomrecDto = new roomrecDto();
                roomrecDto.Room_Id = (int)(dto.Room_ID);
                roomrecDto.Recoed  = "تم أرسال  طلب تنظيف الى العامل   " + _userService.GetById(new Guid(eid)).FullName.ToString();
                _roomrec.Add(roomrecDto);
            }
            return(RedirectToAction("Getallformosh"));
        }
Esempio n. 6
0
        public ActionResult takeCleanOrder(CleanOrderDto cleanOrderDto)
        {
            var dto = _fixOrderServices.GetById(cleanOrderDto.Id);

            dto.startdate = DateTimeHelper.ConvertDateToString(Utils.ServerNow.Date, DateFormats.DD_MM_YYYY) + " " + DateTimeHelper.ConvertTimeToString(Utils.ServerNow.TimeOfDay, TimeFormats.HH_MM_AM);
            var id      = User.Identity.GetUserId();
            var guid    = new Guid(id);
            var userdto = _userService.GetById(guid);

            dto.Istaked    = true;
            userdto.IsBusy = true;
            dto.isFinished = false;
            _userService.Edit(userdto, guid);
            _fixOrderServices.edit(dto);
            TempData["ord"] = dto.Id;
            return(RedirectToAction("EndCleanOrder", new { rid = dto.Room_ID, oid = dto.Id, msg = "" }));
        }
        public CleanOrderDto GetById(int id)
        {
            var           item = _unitOfWork.OrderRepository.FindById(id);
            CleanOrderDto dto  = new CleanOrderDto();

            dto.Id            = item.Id;
            dto.Description   = item.Description;
            dto.Creation_At   = item.Creation_At;
            dto.Creation_Date = item.Creation_Date;
            dto.Creation_Time = item.Creation_Time;
            dto.isFinished    = item.isFinished;
            dto.moshId        = item.moshId;
            dto.cleaningEmp   = item.cleaningEmp;
            dto.Hoster        = item.Hoster;
            dto.isFinished    = item.isFinished;
            dto.Istaked       = item.isTaked;
            dto.startdate     = item.startdate;
            dto.enddate       = item.enddate;



            dto.Room_ID = item.Room.Id;
            return(dto);
        }
Esempio n. 8
0
        public ActionResult AddOrder(CleanOrderDto dto, int rid)
        {
            dto.Hoster        = Guid.Parse(User.Identity.GetUserId());
            dto.Creation_Date = DateTimeHelper.ConvertDateToString(Utils.ServerNow.Date, DateFormats.DD_MM_YYYY);
            dto.Creation_Time = DateTimeHelper.ConvertTimeToString(Utils.ServerNow.TimeOfDay, TimeFormats.HH_MM_AM);
            dto.Creation_At   = DateTimeHelper.ConvertDateToString(Utils.ServerNow.Date, DateFormats.DD_MM_YYYY) + " " + DateTimeHelper.ConvertTimeToString(Utils.ServerNow.TimeOfDay, TimeFormats.HH_MM_AM);
            dto.Room_ID       = rid;
            dto.moshId        = _fixOrderServices.getmoshbyroomId((int)rid);
            int i    = _orderService.addOrder(dto);
            var room = _RoomService.GetById(rid);

            room.Isrequisted = true;
            _RoomService.Edit(room);

            roomrecDto roomrecDto = new roomrecDto();

            roomrecDto.Room_Id = rid;
            roomrecDto.Recoed  = "  تم أضافة طلب تنظيف على الغرفة  ";
            _roomrec.Add(roomrecDto);
            //NotifictationDto dto1 = new NotifictationDto();
            //dto1.senderId = Guid.Parse(User.Identity.GetUserId());
            //dto1.RevieverId = _RoomService.getMangerIdForRoom(Convert.ToInt32( rid));
            //var roomnum = _RoomService.GetById(dto.Room_ID.Value).RoomNum;

            //var s1 = "الغرفة رقم";
            //var s2 = roomnum;
            //var s3 = " بحاجة الى ";
            //var s4 = "&";
            //var s5 = i;
            //var s6 = "تنظيف";

            //dto1.NotDateTime = DateTimeHelper.ConvertDateToString(Utils.ServerNow.Date, DateFormats.DD_MM_YYYY);
            //dto1.Room_ID = dto.Room_ID;
            //_notifictationService.Add(dto1);
            return(RedirectToAction("getAllRoom", "Room"));
        }
        public bool edit(CleanOrderDto dto)
        {
            CleanOrder Order = _unitOfWork.OrderRepository.FindById(dto.Id);

            if (!string.IsNullOrWhiteSpace(dto.Description))
            {
                Order.Description = dto.Description;
            }

            if (!string.IsNullOrWhiteSpace(dto.startdate))
            {
                Order.startdate = dto.startdate;
            }
            if (!string.IsNullOrWhiteSpace(dto.enddate))
            {
                Order.enddate = dto.enddate;
            }
            if (!string.IsNullOrWhiteSpace(dto.Creation_At))
            {
                Order.Creation_At = dto.Creation_At;
            }
            if (!string.IsNullOrWhiteSpace(dto.Creation_Date))
            {
                Order.Creation_Date = dto.Creation_Date;
            }
            if (!string.IsNullOrWhiteSpace(dto.Creation_Time))
            {
                Order.Creation_Time = dto.Creation_Time;
            }



            Order.isFinished = dto.isFinished;
            if (dto.cleaningEmp.HasValue)
            {
                Order.cleaningEmp = dto.cleaningEmp;
            }
            if (dto.moshId.HasValue)
            {
                Order.moshId = dto.moshId;
            }
            if (dto.Hoster.HasValue)
            {
                Order.Hoster = dto.Hoster;
            }

            Order.isTaked = dto.Istaked;



            // Order.User = _unitOfWork.UserRepository.FindById(dto.User_ID);

            if (dto.Room_ID.HasValue)
            {
                Order.Room = _unitOfWork.RoomRepository.FindById(dto.Room_ID);
            }
            _unitOfWork.OrderRepository.Update(Order);

            _unitOfWork.SaveChanges();
            return(true);
        }
Esempio n. 10
0
 public ActionResult Edit(CleanOrderDto orderDto, Guid eid)
 {
     orderDto.cleaningEmp = eid;
     _orderService.edit(orderDto);
     return(RedirectToAction("Getallformosh", "CleanOrder"));
 }