Пример #1
0
        public BookingResponse ReleaseItem(BookingDetailInfor bookingDetailInfor)
        {
            using (StageBitzDB dataContext = new StageBitzDB())
            {
                InventoryBL     inventoryBL     = new InventoryBL(dataContext);
                ItemBooking     itemBooking     = inventoryBL.GetItemBooking(bookingDetailInfor.ItemBookingId);
                BookingResponse bookingResponse = new BookingResponse();
                if (itemBooking != null)
                {
                    if (itemBooking != null &&
                        (!(Utils.IsCompanyInventoryAdmin(itemBooking.Item.CompanyId.Value, bookingDetailInfor.UserId) ||
                           Utils.IsCompanyInventoryStaffMember(itemBooking.Item.CompanyId.Value, bookingDetailInfor.UserId, itemBooking.Item.LocationId, dataContext))))
                    {
                        bookingResponse.Status    = "NOTOK";
                        bookingResponse.ErrorCode = (int)ErrorCodes.NoEditPermissionForInventory;
                        bookingResponse.Message   = "Could not release the Item.";
                        return(bookingResponse);
                    }

                    bool isSuccess = inventoryBL.RemoveInUseItemFromItemBrief(itemBooking.RelatedId, bookingDetailInfor.UserId);
                    bookingResponse.Status = isSuccess ? "OK" : "NOTOK";
                }
                else
                {
                    bookingResponse.Status = "NOTOK";
                }

                return(bookingResponse);
            }
        }
Пример #2
0
 public BookingResponse ReturnItem(BookingDetailInfor bookingDetailInfor)
 {
     using (StageBitzDB dataContext = new StageBitzDB())
     {
         InventoryBL inventoryBL = new InventoryBL(dataContext);
         return(inventoryBL.ReturnItem(bookingDetailInfor.ItemBookingId, bookingDetailInfor.IsSelect, bookingDetailInfor.UserId));
     }
 }
Пример #3
0
 public BookingResponse RejectBooking(BookingDetailInfor bookingDetailInfor)
 {
     using (StageBitzDB dataContext = new StageBitzDB())
     {
         InventoryBL     inventoryBL     = new InventoryBL(dataContext);
         BookingResponse bookingResponse = inventoryBL.RejectBooking(bookingDetailInfor.ItemBookingId, bookingDetailInfor.UserId);
         return(bookingResponse);
     }
 }