// GET: ItemRequests/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ItemRequest itemRequest = db.ItemRequests.Find(id); if (itemRequest == null) { return(HttpNotFound()); } ViewBag.latitude = itemRequest.Latitude; ViewBag.longitude = itemRequest.Longitude; try { var result = db.RequestProgreses.GroupBy(x => x.ReqId) .Select(x => x.OrderByDescending(y => y.Id).FirstOrDefault()); var p = result.FirstOrDefault(i => i.ReqId == id).value; if (p != 0) { ViewBag.P = p; } } catch (Exception) { ViewBag.P = 0; } return(View(itemRequest)); }
public async Task <IActionResult> RequestItem([FromBody] ItemRequestForCreationDto request) { if (request == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var user = await userManager.FindByNameAsync(User.Claims.First().Value); ItemRequest itemRequest = new ItemRequest() { ItemId = request.BookId, UserId = user.Id, RequestDate = request.RequestDate }; itemRequestRepository.AddItemRequest(itemRequest); if (!itemRequestRepository.Save()) { return(BadRequest("A problem occurred while handling your request.")); } itemRequest.Item = await itemRepository.GetItemAsync(itemRequest.ItemId); return(Created($"api/books/requests/users/{itemRequest.UserId}", itemRequest)); }
public IActionResult Add([FromBody] ItemRequest itemRequest) { Item newItem = _mapper.Map <Item>(itemRequest); _item.Register(newItem); return(CreatedAtAction(nameof(Get), new { id = newItem.Id }, newItem)); }
public void UpdateUI(ItemRequest item, float timeRatio) { mainIcon.GetComponent <Image>().overrideSprite = item.icon; timeLeft.value = timeRatio; // TODO: should also assign the materials }
public GameObject GetItem(Transform callTransform, ItemRequest rq) { if (rq == ItemRequest.None) { return(null); } Ray ray = new Ray(callTransform.position + Vector3.up, Vector3.down); RaycastHit hit; Physics.Raycast(ray, out hit, 100, LayerMask.GetMask("FloorLayer")); switch (rq) { case ItemRequest.Gem: return(GetGem(hit.transform.parent)); case ItemRequest.Health: return(GetHealth(hit.transform.parent)); default: return(null); } }
public IEnumerable <ItemResponse> GetItemsByCommand(ItemRequest datos) { var command = _context.Command.SingleOrDefault(c => c.Id == datos.IdCommand); List <ItemResponse> respuesta = new List <ItemResponse>(); IList <Item> itemsByCommand = (from i in _context.Item where i.CommandId == datos.IdCommand orderby i.Id descending select i).ToList <Item>(); foreach (Item item in itemsByCommand) { ItemResponse itemDto = new ItemResponse(); itemDto.URL = item.Quotation.Url; itemDto.ComisionTraigoIva = Math.Round(item.Quotation.ComisionTraigoIva, 2); itemDto.ComisionViajero = Math.Round(item.Quotation.ComisionViajero, 2); itemDto.Precio = Math.Round(item.Quotation.Precio, 2); itemDto.NombreItem = item.Quotation.NombreItem; itemDto.Peso = item.Quotation.Peso; itemDto.Id = item.Id; itemDto.IdCotizacion = item.QuotationId; itemDto.ComisionTotal = Math.Round(item.Quotation.ComisionViajero + item.Quotation.ComisionTraigoIva, 2); respuesta.Add(itemDto); } return(respuesta); }
private void CustomRequest_Execute(object sender, PopupWindowShowActionExecuteEventArgs e) { ItemRequest ccr = (ItemRequest)e.PopupWindowViewCurrentObject; // string x = "1"; // ccr.Customer.AddNote(ccr.Customer, string.Format("Item Request has been sent for Item: {0} {1} for Customer {2}", ccr.ItemNumber.AccountingNumber, ccr.ItemNumber.ItemDescription, ccr.Customer.CustomerName)); e.PopupWindow.View.ObjectSpace.CommitChanges(); // ((ListView)View).CollectionSource.Reload(); View.ObjectSpace.Refresh(); MessageOptions options = new MessageOptions(); options.Message = string.Format("Item Request has been sent for Item: {0} {1} for Customer {2}", ccr.ItemNumber.AccountingNumber, ccr.ItemNumber.ItemDescription, ccr.Customer.CustomerName); options.Type = InformationType.Success; options.Web.Position = InformationPosition.Right; options.Win.Caption = "Success"; options.Win.Type = WinMessageType.Alert; options.Duration = 1000; Application.ShowViewStrategy.ShowMessage(options); View.Refresh(); }
public object Any(ItemRequest request) { return(new ItemResponse { Item = new Item(request.ItemId, "Made in ServiceStack") }); }
public async Task <IActionResult> PostItemEntity([FromBody] ItemRequest request) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } string picturePath = string.Empty; if (request.PictureArray != null && request.PictureArray.Length > 0) { picturePath = _imageHelper.UploadImage(request.PictureArray, "Items"); } var item = new ItemEntity { Active = request.Active, Date = request.Date, Id = request.Id, Name = request.Name, Price = request.Price, Quantity = request.Quantity, LogoPath = picturePath, }; _context.Items.Add(item); await _context.SaveChangesAsync(); return(Ok(_converterHelper.ToItemResponse(item))); //return NoContent(); }
public IActionResult Post([FromBody] ItemRequest entity) { int itemId = 0; if (entity.item != null) { itemId = _unitOfWork.ItemRepository.Insert(entity.item); if (itemId >= 0) { if (entity.resim != null) { entity.resim.itemId = itemId; _unitOfWork.ItemResimRepository.Insert(entity.resim); } try { _unitOfWork.Commit(); } catch (Exception) { return(StatusCode(500)); } return(Ok()); } } return(BadRequest()); }
public IGoogleAnalyticsRequest CreateRequest(string hitType, IEnumerable <Parameter> requestParameters = null) { if (hitType == null) { throw new ArgumentNullException("hitType"); } IGoogleAnalyticsRequest request; switch (hitType.ToLower()) { case HitTypes.PageView: request = new PageViewRequest(_useSsl, _proxy); break; case HitTypes.Event: request = new EventRequest(_useSsl, _proxy); break; case HitTypes.Item: request = new ItemRequest(_useSsl, _proxy); break; case HitTypes.ScreenView: request = new ScreenTrackingRequest(_useSsl, _proxy); break; case HitTypes.Social: request = new SocialInteractionsRequest(_useSsl, _proxy); break; case HitTypes.Timing: request = new UserTimingTrackingRequest(_useSsl, _proxy); break; case HitTypes.Transaction: request = new TransactionRequest(_useSsl, _proxy); break; default: throw new ApplicationException("Unknown hitType: " + hitType); } request.Parameters.Add(_protocolVersion); request.Parameters.Add(_trackingId); if (requestParameters != null) { request.Parameters.AddRange(requestParameters); } return(request); }
public List <ItemRequest> GetRequests(string voucherId) { List <ItemRequest> requests = new List <ItemRequest>(); SqlConnection conn = connection; SqlDataReader reader = null; try { conn.Open(); string sql = @"select * from ItemRequest where RequestID='" + voucherId + "'"; SqlCommand command = new SqlCommand(sql, conn); reader = command.ExecuteReader(); while (reader.Read()) { ItemRequest request = new ItemRequest() { ItemId = (string)reader["ItemID"], NeededQty = (int)reader["NeededQty"], ActualQty = (int)reader["ActualQty"] }; requests.Add(request); } } finally { if (reader != null) { reader.Close(); } conn.Close(); } return(requests); }
/// <summary> /// Get items in order as per request id. /// </summary> private static List <ItemRequest> GetItems(int reqId) { var itemList = new List <ItemRequest>(); var items = BaseRepository.OimsDataContext.Itemsrequests.Where(i => i.O_Id.Equals(reqId)); foreach (var item in items) { var itemData = ItemRepository.Items.FirstOrDefault(i => i.ItemId.Equals(item.I_Id)); var oi = new ItemRequest { Id = item.OI_Id, ItemRecom = item.OI_ItemRecom, Count = item.OI_Quantity, TotalStock = float.Parse(GetItemStock(item.I_Id)) }; if (itemData != null) { oi.Name = itemData.ItemName; } itemList.Add(oi); } return(itemList); }
public Item UpdateItem(string id, ItemRequest itemRequest) { Item itemRecieved = new Item(itemRequest); _items.ReplaceOne(i => i.Id == id, itemRecieved); return(GetFromItemId(id)); }
public bool UpdateItem(ItemRequest itemRequest) { // get the item from the db using (var db = new DataClasses1DataContext()) { Item item = db.Items.FirstOrDefault(x => x.ItemId == itemRequest.ItemId); if (item == null) { return(false); } // security check var user = this.GetUser(); if (item.UserId != user.UserId) { throw new UnauthorizedAccessException(); } item.Description = itemRequest.Description; item.GroupId = itemRequest.GroupId; item.IsComplete = itemRequest.IsComplete; db.SubmitChanges(); return(true); } }
public ActionResult <ApiResponse> BasketHandlerWithRedirect([FromBody] ItemRequest request) { var response = new ApiResponse(); response.RedirectUrl = "http://example.org"; return(response); }
public async Task <ResponseDTO <List <Item> > > GetAllItems(ItemRequest itemRequest) { try { return(new ResponseDTO <List <Item> >() { IsSuccess = true, ReturnValue = await _itemRepo.GetAllItems(itemRequest), Exception = null, ErrorCode = null, CorrelationId = null, ErrorMessage = null, Errors = null }); } catch (Exception ex) { return(new ResponseDTO <List <Item> >() { IsSuccess = false, ReturnValue = null, Exception = ex, ErrorCode = null, CorrelationId = null, ErrorMessage = ex.Message, Errors = null }); } }
public string DeleteItem(ClientContext ctx, string ListName, string ID) { var responseText = ""; try { RetrieveAccessToken(ctx); XmlNamespaceManager xmlnspm = AddXmlNameSpaces(); var formDigestNode = GetFormDigest(ctx.Url, xmlnspm); string formDigest = formDigestNode.InnerXml; string listUrl = RestUrlList(ListName); var Url = ctx.Url + "/_api/web/lists/getByTitle('" + ListName + "')/items(" + ID + ")"; HttpWebRequest ItemRequest; ItemRequest = (HttpWebRequest)HttpWebRequest.Create(Url); ItemRequest.Method = "POST"; ItemRequest.Headers.Add("X-HTTP-Method", "DELETE"); ItemRequest.Headers.Add("IF-MATCH", "*"); ItemRequest.Headers.Add("Authorization", accessToken); ItemRequest.Headers.Add("X-RequestDigest", formDigest); using (Stream itemRequestStream = ItemRequest.GetRequestStream()) { itemRequestStream.Close(); } using (HttpWebResponse itemResponse = (HttpWebResponse)ItemRequest.GetResponse()); return(responseText); } catch (Exception ex) { throw new Exception(string.Format("An error occured while reading data. GUID: {0}", ex.ToString())); } }
private void CreateWithdrawalTransaction(ItemRequest itemRequest) { var transaction = new Transaction() { Id = new Guid(), GuildId = itemRequest.GuildId, CharacterName = itemRequest.CharacterName, TransactionDate = DateTime.Now, Type = "Withdrawal", Money = itemRequest.Gold }; _classicGuildBankDbContext.Transactions.Add(transaction); foreach (var itemRequestDetail in itemRequest.Details) { var transactionDetail = new TransactionDetail() { Id = new Guid(), ItemId = itemRequestDetail.ItemId, TransactionId = transaction.Id, Quantity = itemRequestDetail.Quantity }; _classicGuildBankDbContext.TransactionDetails.Add(transactionDetail); } }
/* Spostare la parte admin in una nuova classe dedicata */ public bool RequestModel(ItemRequest request, out string message, bool admin = false) { message = ""; /* * // PayableItem item = db.SelectItem(model_id); * if(!admin && !request.Item.IsRequestable) * { * message = "Il modello non è richiedibile"; * return false; * } * if(!admin && !request.Item.Enabled) * { * message = "Non è più possibile richiedere il modello"; * return false; * } * * // Verifica la presenza di vecchie richieste * var old_requests = db.Requests_GetList(request.Item.Id, request.PersonId); * if(request.Item.IsUnique && old_requests.Count > 0) * { * message = "Il modello è già stato richiesto in passato e non può più essere richiesto"; * return false; * } * return db.Save(request); */ return(false); }
private void CustomerRequestPopup_Execute(object sender, PopupWindowShowActionExecuteEventArgs e) { ItemRequest ccr = (ItemRequest)e.PopupWindowViewCurrentObject; ccr.Customer.AddNote(ccr.Customer, string.Format("Item Request has been sent to purchasing \r\n Item: {0} {1} \r\n Customer: {2} \r\n Qty: {3} \r\n Price: {4} ", ccr.ItemNumber.AccountingNumber, ccr.ItemNumber.ItemDescription, ccr.Customer.CustomerName, ccr.RequestQty.ToString(), ccr.UnitPrice.ToString("c"))); e.PopupWindow.View.ObjectSpace.CommitChanges(); // ((ListView)View).CollectionSource.Reload(); View.ObjectSpace.Refresh(); MessageOptions options = new MessageOptions(); options.Message = string.Format("Item Request has been sent for Item: {0} {1} for Customer {2}", ccr.ItemNumber.AccountingNumber, ccr.ItemNumber.ItemDescription, ccr.Customer.CustomerName); options.Type = InformationType.Success; options.Web.Position = InformationPosition.Right; options.Win.Caption = "Success"; options.Win.Type = WinMessageType.Alert; options.Duration = 10000; Application.ShowViewStrategy.ShowMessage(options); View.Refresh(); sendnewrequestemail(sender, e); }
public ItemRequest AddItemRequest(RequestItemsModel requestItemsModel, ClassicGuildBankUser classicGuildBankUser) { var request = new ItemRequest() { Id = Guid.NewGuid(), CharacterName = requestItemsModel.CharacterName, Gold = requestItemsModel.Gold, GuildId = requestItemsModel.GuildId, UserId = classicGuildBankUser.Id, Status = RequestStatus.Pending, DateRequested = DateTime.Now }; _classicGuildBankDbContext.ItemRequests.Add(request); foreach (var item in requestItemsModel.RequestItemModels) { var detail = new ItemRequestDetail() { Id = Guid.NewGuid(), ItemId = item.ItemId, Quantity = item.Quantity, ItemRequestId = request.Id }; _classicGuildBankDbContext.ItemRequestDetails.Add(detail); } _classicGuildBankDbContext.SaveChanges(); return(request); }
public async Task <List <Item> > GetAllItems(ItemRequest itemRequest) { SqlParameter[] parameter = { new SqlParameter("@Offset", itemRequest.Offset), new SqlParameter("@PageLimit", itemRequest.PageLimit), new SqlParameter("@StartDate", itemRequest.StartDate), new SqlParameter("@EndDate", itemRequest.EndDate) }; var items = new List <Item>(); return(await ExecuteSqlReaderWithStoreProcAsync(SqlConstants.GetAllItem, parameter, (dr) => { while (dr.Read()) { items.Add(new Item { Id = dr.GetInt64(dr.GetOrdinal("ItemId")), ItemDescription = dr.GetString(dr.GetOrdinal("ItemDescription")), LocationId = dr.GetInt64(dr.GetOrdinal("LocationID")), LocationName = dr.GetString(dr.GetOrdinal("locationName")), LeadTimeVaration = dr.GetInt32(dr.GetOrdinal("LeadTimeVaration")), AverageDemand = dr.GetInt32(dr.GetOrdinal("AverageDemand")), ItemCount = dr.GetInt32(dr.GetOrdinal("ItemCount")), }); } return items; })); }
//Nang Sandar: Create New Order Request public async Task <IActionResult> CreateRequest() { int userId = (int)HttpContext.Session.GetInt32("UserID"); string cartItemJson = HttpContext.Session.GetString("addedItemSession"); ItemRequest itemreq = new ItemRequest(); itemreq.UserID = userId; itemreq.ItemList = JsonConvert.DeserializeObject <List <AddToCartItem> >(cartItemJson); string jsonData = JsonConvert.SerializeObject(itemreq); Request req = new Request(); using (var httpClient = new HttpClient()) { StringContent content = new StringContent(JsonConvert.SerializeObject(jsonData), Encoding.UTF8, "application/json"); using (var response = await httpClient.PostAsync(api_url + "ItemList/CreateRequest", content)) { string apiResponse = await response.Content.ReadAsStringAsync(); req = JsonConvert.DeserializeObject <Request>(apiResponse); } } if (req != null) { HttpContext.Session.Remove("addedItemSession"); HttpContext.Session.Remove("countSession"); } NotificationController.NewRequest(userId); return(RedirectToAction("ViewCart")); }
/// <summary> /// Agrega un producto al carrito de compra de la cookie solicitada, de existir ya el producto le suma la cantidad /// </summary> /// <param name="cookie"></param> /// <param name="productId"></param> /// <param name="quantity"></param> /// <returns></returns> public CartItem AddItemCart(ItemRequest model) { // busca si existe el carrito Cart cart = findCart(model.cartId); if (cart.items == null) { cart.items = new List <CartItem>(); } // busca el producto en el carrito Guid pguid = toGuid(model.productId); CartItem item = cart.items.Find(x => x.productId == pguid); if (item == null) { // Al no existir crea uno nuevo item = new CartItem(); Product producto = db.Products.Where(x => x.id == pguid).FirstOrDefault(); item.productId = pguid; item.product = producto; item.quantity = 0; item.price = producto.price; cart.items.Add(item); } if (item.quantity + model.quantity > 0) { cart.itemCount += model.quantity; item.quantity += model.quantity; Audit(item); Audit(cart); db.SaveChanges(); } return(item); }
void setUpRequest() { if (currentRequest.timeToBuild == 0) { Debug.LogWarning("Should take new "); currentRequestIndex++; currentRequest = requests[currentRequestIndex]; spawnNewItemRequest(); } if (currentRequestIndex == (requests.Length - 1)) { // spawnNewItemRequest(); //Should end the game // return; } currentRequest.timeToBuild--; timeValue = (float)currentRequest.timeToBuild / (float)previousValue; ItemRequestUIPrefab.GetComponent <ItemRequestUI>().UpdateUI(currentRequest, timeValue); Debug.LogWarning("Current index: " + currentRequestIndex); }
void AddItemToInventory(ItemRequest request) { if (!isOwner) { return; } Item shipped_item = amazon.RequestItem(request.item_name); if (SharedItem.isSharedItem(shipped_item)) { if (!isServer) { InvokeServerRpc(RPC_AddSharedItem, request.item_name, 1, channel: INVMANG_CHANNEL); } else { string item_name = request.item_name; uint clientId = NetworkingManager.singleton.LocalClientId; NetworkSharedItem netItem = new NetworkSharedItem(item_name); networkInv.AddItemStack(item_name, netItem, 1); } } if (AbilityItem.isAbilityItem(shipped_item)) { shipped_item.context = this; shipped_item.menu_form = image; actionSlots.ability_items[shipped_item.name()] = (AbilityItem)shipped_item; actionSlots.ChangeAbilityItem(actionSlots.ability_items.GetStackCount(), shipped_item.name()); } GameObject.Destroy(request.gameObject); }
// Use this for initialization void Start() { requests = ItemRequestsFactory.Instance.getLevel01(); currentRequest = requests[0]; previousValue = currentRequest.timeToBuild; StartCoroutine(DecrementTime()); }
public async Task <IActionResult> Update([FromBody] ItemRequest item) { _itemsRepository.Update(new Items() { Id = item.id, Name = item.name, Description = item.description, Price = item.price }); return(Ok()); }
public ActionResult DeleteConfirmed(int id) { ItemRequest itemRequest = db.ItemRequests.Find(id); db.ItemRequests.Remove(itemRequest); db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// Make an item request to the interface server. /// </summary> /// <param name="request">Item request to make.</param> /// <returns></returns> public ItemResponse Request(ItemRequest request) { try { var writer = new JsonStreamWriter(client, Encoding); writer.WriteJson(request); writer.Flush(); client.WaitForPipeDrain(); var reader = new JsonStreamReader(client, Encoding); var response = reader.ReadJson<ItemResponse>(); return response; } catch (EndOfStreamException) { return null; } catch (JsonException) { return null; } }
public async Task<ItemResponse> RequestAsync(ItemRequest request) { try { var writer = new JsonStreamWriter(client, Encoding); await writer.WriteJsonAsync(request); await writer.FlushAsync(); client.WaitForPipeDrain(); var reader = new JsonStreamReader(client, Encoding); var response = await reader.ReadJsonAsync<ItemResponse>(); return response; } catch (EndOfStreamException) { return null; } catch (JsonException) { return null; } }