public ActionResult thankspage(SOUND_SYSTEM.Model.customer c) { c.status = "pending"; mdi.customers.Add(c); mdi.SaveChanges(); List <item> cart = (List <item>)Session["cart"]; for (int i = 0; i < cart.Count; i++) { Order_Product obj = new Order_Product(); obj.Product_id = cart[i].P.Product_id; obj.Quanitiy = cart[i].Quantity; obj.Orderno = c.orderno; obj.Price = cart[i].P.Price; obj.Name = cart[i].P.Name; obj.unitprice = cart[i].P.Price; mdi.Order_Product.Add(obj); } mdi.SaveChanges(); return(View()); }
public IHttpActionResult PutOrder_Product(int id, Order_Product order_Product) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != order_Product.PId) { return(BadRequest()); } db.Entry(order_Product).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Order_ProductExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> PutOrder_Product([FromRoute] int id, [FromBody] Order_Product order_Product) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != order_Product.Order_ProductID) { return(BadRequest()); } _context.Entry(order_Product).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Order_ProductExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public static void TableMenu() { int table_id = Convert.ToInt16(LoggedUser.LastName); Tablelogic.PickTable(table_id); Boolean continuarOrdenando = true; List <Product> products = Produclogic.GetProducts(); string productList = ""; foreach (var i in products) { productList += i.ID + ". " + i.Name + ". " + i.Description + ". Costo: " + i.Cost + "\n"; } Console.WriteLine("****LISTA DE PRODUCTOS**** \n\n" + productList); while (continuarOrdenando) { Console.WriteLine("Ingrese el id del producto para ordenar. Pulsa 0 a para salir."); int optionOrder = Convert.ToInt32(Console.ReadLine()); if (optionOrder == 0) { continuarOrdenando = false; Console.WriteLine("La sesion se ha terminado. Se desea seguir ordenando inicie sesion nuevamente."); } else { Order_Product orden = Orderlogic.CreateOrder(table_id, optionOrder, Produclogic.SearchByID(optionOrder).Cost); Console.WriteLine("Se realizo la orden " + orden.ID); } } }
public IActionResult AddOrder(OrderRequest request, int id) { if (request.Products.Count() == 0) { return(new BadRequestObjectResult("The request is empty")); } var order = new Order { DataPrzyjecia = request.DataPrzyjecia, Uwagi = request.Uwagi, IdClient = id, IdEmployee = 1 }; Context.Order.Add(order); foreach (Products product in request.Products) { var productId = Context.Product.Where(k => k.Name == product.Product).Select(k => k.IdProduct).FirstOrDefault(); if (productId == 0) { return(new BadRequestObjectResult("No such product in database")); } var order_product = new Order_Product { IdProduct = productId, IdOrder = order.IdOrder, Quantity = product.Quantity, Uwagi = product.Uwagi }; Context.Order_Product.Add(order_product); } Context.SaveChanges(); return(new OkResult()); }
public ActionResult DeleteConfirmed(int id) { Order_Product order_Product = db.Order_Product.Find(id); db.Order_Product.Remove(order_Product); db.SaveChanges(); return(RedirectToAction("Index")); }
public Order_Product CreateOrder(int table, int product, decimal cost) { Order_Product order = new Order_Product() { Table_id = table, Product_id = product, Cost = cost, Completed = 0, Paid = 0 }; DBAccessConnection.CreateOrder(order); LoadOrders(); return(order); }
public Order_Product Insert_Order_Product_select(int ID) { Order_Product = Order_Product.Select(ID); Insert_orderID_txt.Text = Convert.ToString(Order_Product.orderID); Insert_ProductID_txt.Text = Convert.ToString(Order_Product.ProductID); Insert_Quantity_txt.Text = Convert.ToString(Order_Product.Quantity); Insert_warehouseid_txt.Text = Convert.ToString(Order_Product.warehouseid); Insert_DatePicked_txt.Text = Convert.ToString(Order_Product.DatePicked); Insert_Qtypicked_txt.Text = Convert.ToString(Order_Product.Qtypicked); return(Order_Product); }
public Order_Product Insert_Order_Product_select(int ID) { Order_Product = Order_Product.Select(ID); Insert_orderID_txt.Text = Convert.ToString(Order_Product.orderID); Insert_ProductID_txt.Text = Convert.ToString(Order_Product.ProductID); Insert_Quantity_txt.Text = Convert.ToString(Order_Product.Quantity); Insert_warehouseid_txt.Text = Convert.ToString(Order_Product.warehouseid); Insert_DatePicked_txt.Text = Convert.ToString(Order_Product.DatePicked); Insert_Qtypicked_txt.Text = Convert.ToString(Order_Product.Qtypicked); return Order_Product; }
public IHttpActionResult GetOrder_Product(int id) { Order_Product order_Product = db.Order_Product.Find(id); if (order_Product == null) { return(NotFound()); } return(Ok(order_Product)); }
public ActionResult Edit([Bind(Include = "OrderId,ProductId,Amount")] Order_Product order_Product) { if (ModelState.IsValid) { db.Entry(order_Product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OrderId = new SelectList(db.Orders, "Id", "Status", order_Product.OrderId); ViewBag.ProductId = new SelectList(db.Products, "Id", "Name", order_Product.ProductId); return(View(order_Product)); }
public Order_Product Delete_Order_Product_select(int ID) { Order_Product = Order_Product.Select(ID); Delete_order_Product_ID_txt_lbl.Text = Convert.ToString(Order_Product.order_Product_ID); Delete_orderID_txt_lbl.Text = Convert.ToString(Order_Product.orderID); Delete_ProductID_txt_lbl.Text = Convert.ToString(Order_Product.ProductID); Delete_Quantity_txt_lbl.Text = Convert.ToString(Order_Product.Quantity); Delete_warehouseid_txt_lbl.Text = Convert.ToString(Order_Product.warehouseid); Delete_DatePicked_txt_lbl.Text = Convert.ToString(Order_Product.DatePicked); Delete_Qtypicked_txt_lbl.Text = Convert.ToString(Order_Product.Qtypicked); return(Order_Product); }
public IHttpActionResult PostOrder_Product(Order_Product order_Product) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Order_Product.Add(order_Product); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = order_Product.PId }, order_Product)); }
public async Task <IActionResult> PostOrder_Product([FromBody] Order_Product order_Product) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Order_Product.Add(order_Product); await _context.SaveChangesAsync(); return(CreatedAtAction("GetOrder_Product", new { id = order_Product.Order_ProductID }, order_Product)); }
public static Order_Product ProductDTOtoOrderProduct(ProductDTO productDTO) { var product = ProductDTOtoProduct(productDTO); Order_Product result = new Order_Product { Product = product, Quantity = productDTO.Quantity }; return(result); }
public Order_Product Delete_Order_Product_select(int ID) { Order_Product = Order_Product.Select(ID); Delete_order_Product_ID_txt_lbl.Text = Convert.ToString(Order_Product.order_Product_ID); Delete_orderID_txt_lbl.Text = Convert.ToString(Order_Product.orderID); Delete_ProductID_txt_lbl.Text = Convert.ToString(Order_Product.ProductID); Delete_Quantity_txt_lbl.Text = Convert.ToString(Order_Product.Quantity); Delete_warehouseid_txt_lbl.Text = Convert.ToString(Order_Product.warehouseid); Delete_DatePicked_txt_lbl.Text = Convert.ToString(Order_Product.DatePicked); Delete_Qtypicked_txt_lbl.Text = Convert.ToString(Order_Product.Qtypicked); return Order_Product; }
public static void WaiterMenu() { Boolean continuar = true; while (continuar) { Console.WriteLine("Ingrese el numero que antescede la opcion que desea \n\n1.Elegir mesa y ordernar" + "\n2.Cerrar Sesion"); int option = Convert.ToInt32(Console.ReadLine()); switch (option) { case 1: List <Table> tables = Tablelogic.GetAvailableTables(); string tableList = ""; foreach (var i in tables) { tableList += i.ID + ". Cantidad de personas: " + i.People + "\n"; } Console.WriteLine("****MESAS DISPONIBLES**** \n\n" + tableList); Console.WriteLine("Ingrese el id de la mesa en la que desea ordear"); int table_id = Convert.ToInt16(Console.ReadLine()); Tablelogic.PickTable(table_id); Boolean continuarOrdenando = true; List <Product> products = Produclogic.GetProducts(); string productList = ""; foreach (var i in products) { productList += i.ID + ". " + i.Name + ". " + i.Description + ". Costo: " + i.Cost + "\n"; } Console.WriteLine("****LISTA DE PRODUCTOS**** \n\n" + productList); while (continuarOrdenando) { Console.WriteLine("Ingrese el id del producto para ordenar. Pulsa 0 a para salir."); int optionOrder = Convert.ToInt32(Console.ReadLine()); if (optionOrder == 0) { continuarOrdenando = false; } else { Order_Product orden = Orderlogic.CreateOrder(table_id, optionOrder, Produclogic.SearchByID(optionOrder).Cost); Console.WriteLine("Se realizo la orden " + orden.ID); } } break; case 2: continuar = false; break; } } }
public void Insert(OrderDTO order) { var pureOrder = order.Order; try { var orderID = base.Insert(pureOrder); pureOrder.Id = orderID; int productIDInOrder = 0; foreach (var productDTO in order.Products) { productIDInOrder++; var order_product = new Order_Product { Product = new Product { Id = productDTO.Id }, Order = pureOrder, ProductIdInOrder = productIDInOrder, Quantity = productDTO.Quantity }; //insert var order_productID = _orderProductRepository.Insert(order_product); order_product.Id = order_productID; //if (productDTO.Component != null) //{ // var product = new Product { Id = productDTO.Id }; // foreach (var componentDTO in productDTO.Component) // { // var order_component = new Order_Component // { // Component = new Component { Id = componentDTO.Component.Id }, // Order = pureOrder, // ProductIdInOrder = productIDInOrder, // Product = product, // Quantity = componentDTO.Quantity // }; // var order_componentID = _orderComponentRepository.Insert(order_component); // } //} } } catch (Exception e) { //ex handler } }
bool CheckAgainstList(Order_Product product) { if (productList != null) { foreach (Order_Product pro in productList) { if (pro.GetProduct().productName.Equals(product.GetProduct().productName)) { return(true); } } } return(false); }
public IHttpActionResult DeleteOrder_Product(int id) { Order_Product order_Product = db.Order_Product.Find(id); if (order_Product == null) { return(NotFound()); } db.Order_Product.Remove(order_Product); db.SaveChanges(); return(Ok(order_Product)); }
// GET: Order_Product/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Order_Product order_Product = db.Order_Product.Find(id); if (order_Product == null) { return(HttpNotFound()); } return(View(order_Product)); }
public Order_Product Order_Product_insert() { Order_Product.orderID = Convert.ToInt32(Insert_orderID_txt.Text); Order_Product.ProductID = Convert.ToInt32(Insert_ProductID_txt.Text); Order_Product.Quantity = Convert.ToInt32(Insert_Quantity_txt.Text); Order_Product.warehouseid = Convert.ToInt32(Insert_warehouseid_txt.Text); Order_Product.DatePicked = Convert.ToDateTime(Insert_DatePicked_txt.Text); Order_Product.Qtypicked = Convert.ToInt32(Insert_Qtypicked_txt.Text); Order_Product = Order_Product.Insert(Order_Product); Insert_Order_Product_GridView.DataBind(); Update_Order_Product_GridView.DataBind(); Delete_Order_Product_GridView.DataBind(); return(Order_Product); }
public void RemoveProduct(Order_Product product) { List <Order_Product> newList = new List <Order_Product>(); foreach (Order_Product order_product in productList) { if (!order_product.GetProduct().productName.Equals(product.GetProduct().productName)) { newList.Add(order_product); } } productList = newList; parentPanel.orderFormPanel.UpdateList(); }
// GET: Order_Product/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Order_Product order_Product = db.Order_Product.Find(id); if (order_Product == null) { return(HttpNotFound()); } ViewBag.OrderId = new SelectList(db.Orders, "Id", "Status", order_Product.OrderId); ViewBag.ProductId = new SelectList(db.Products, "Id", "Name", order_Product.ProductId); return(View(order_Product)); }
public Order_Product Order_Product_update(int ID) { Order_Product = Order_Product.Select(ID); Order_Product.order_Product_ID = Convert.ToInt32(Update_order_Product_ID_txt.Text); Order_Product.orderID = Convert.ToInt32(Update_orderID_txt.Text); Order_Product.ProductID = Convert.ToInt32(Update_ProductID_txt.Text); Order_Product.Quantity = Convert.ToInt32(Update_Quantity_txt.Text); Order_Product.warehouseid = Convert.ToInt32(Update_warehouseid_txt.Text); Order_Product.DatePicked = Convert.ToDateTime(Update_DatePicked_txt.Text); Order_Product.Qtypicked = Convert.ToInt32(Update_Qtypicked_txt.Text); Order_Product.Update(Order_Product); Insert_Order_Product_GridView.DataBind(); Update_Order_Product_GridView.DataBind(); Delete_Order_Product_GridView.DataBind(); return(Order_Product); }
public async ValueTask ShouldInsertOrderProductTest() { Order_Product expectedOrder_Prod = new Order_Product { Product = new Product { Id = 6 }, OrderId = 1000, Value = 1, LocalPrice = 10000 }; var actualOrder_Prod = await OS.OrderProductInsert(expectedOrder_Prod); expectedOrder_Prod.Id = actualOrder_Prod.Id; Assert.IsTrue(actualOrder_Prod.Equals(expectedOrder_Prod)); }
public static void CreateOrder(Order_Product order) { string sql = "insert into [restaurantDB].[dbo].[ORDER] ([table_id], [product_id], [cost], [paid], [completed]) VALUES (@table_id, @product_id, @cost, @paid, @completed)"; using (SqlConnection conn = new SqlConnection(connString)) { var rows = conn.Execute(sql, new { table_id = order.Table_id, product_id = order.Product_id, cost = order.Cost, paid = order.Paid, completed = order.Completed }); } }
public int AddOrderDetailInOrder(Order order, int productId, int amount) { Product product = context.Products.FirstOrDefault(el => el.ProductId == productId); if (context.Orders.ToList().Contains(order) && product != null) { Order_Product orderDetail = new Order_Product() { OrderId = order.OrderId, ProductId = product.ProductId, Amount = amount, Price = product.Price * amount }; context.Add(orderDetail); } return(context.SaveChanges()); }
public Order_Product Order_Product_insert() { //loop through each product_id in the product_id_array and insert each time for (int i = 0; i < product_id_array.Length; i++) { warehouse_product_location = warehouse_product_location.Select_By_Product_ID(Convert.ToInt32(product_id_array[i])); warehouse = warehouse.Select(warehouse_product_location.warehouse_id); Order_Product.orderID = Convert.ToInt32(requestor_Order.OrderID); Order_Product.ProductID = Convert.ToInt32(product_id_array[i]); Order_Product.Quantity = 1; Order_Product.warehouseid = warehouse.warehouse_id; Order_Product.DatePicked = DateTime.Now; Order_Product.Qtypicked = 1; Order_Product = Order_Product.Insert(Order_Product); } return(Order_Product); }
protected void updateDatabase() { //product_id_array has all product ids call_center = call_center.Select(Convert.ToInt32(DDL_Call_Center.SelectedValue)); selected_Warehouse = selected_Warehouse.Select(Convert.ToInt32(passWarehouseID_hf.Value)); address = address.Select(selected_Warehouse.address_id); //case_intake case_intake = case_intake_insert(); //encounter encounter = encounter_insert(); //requestor requestor = requestor_insert(); //requestor_Order requestor_Order = requestor_Order_insert(); //Order_product Order_Product = Order_Product_insert(); }
// GET : GetProductsByOrderID public List <Order_Product> GetProductsByOrderID(int ID) { connection(); List <Order_Product> products = new List <Order_Product>(); sqlCommand.CommandText = "select * from [Order] inner join (select p.Code, p.ID, p.Name, p.Scale, p.Ventor, p.PdtDescription, p.QtylnStock, p.BuyPrice, p.MSRP, op.OrderID, op.PriceEach, op.Qty, op.ProductCode from product as p left join Order_Product as op on p.code = op.productcode) as temp on[Order].ID = temp.OrderID where [Order].ID = @ID"; sqlCommand.Parameters.AddWithValue("@ID", ID); sqlConnection.Open(); SqlDataReader dataReader = sqlCommand.ExecuteReader(); while (dataReader.Read()) { Product product = new Product(); Order_Product pro = new Order_Product(); Order or = new Order(); product.Code = Convert.ToInt32(dataReader["Code"]); product.ProductlineID = Convert.ToInt32(dataReader["Id"]); product.Name = Convert.ToString(dataReader["Name"]); product.Scale = Convert.ToInt32(dataReader["Scale"]); product.Vendor = Convert.ToString(dataReader["Ventor"]); product.PdtDescription = Convert.ToString(dataReader["PdtDescription"]); product.QtyInStock = Convert.ToInt32(dataReader["QtylnStock"]); product.BuyPrice = Convert.ToInt32(dataReader["BuyPrice"]); product.MSRP = Convert.ToString(dataReader["MSRP"]); pro.Id = Convert.ToInt32(dataReader["Id"]); pro.OrderId = Convert.ToInt32(dataReader["OrderId"]); pro.ProductCode = Convert.ToInt32(dataReader["ProductCode"]); pro.Qty = Convert.ToInt32(dataReader["Qty"]); pro.PriceEach = Convert.ToInt32(dataReader["PriceEach"]); or.ID = Convert.ToInt32(dataReader["id"]); or.CustomerID = Convert.ToInt32(dataReader["CustomerId"]); or.OrderDate = Convert.ToString(dataReader["OrderDate"]); or.RequiredDate = Convert.ToString(dataReader["RequriedDate"]); or.Status = Convert.ToString(dataReader["Status"]); or.Comments = Convert.ToString(dataReader["Comments"]); or.ShippedDate = Convert.ToString(dataReader["ShippedDate"]); pro.product = product; pro.order = or; products.Add(pro); } sqlConnection.Close(); return(products); }
public JsonResult Post([FromBody] Order order, int idUser, int idProduct) { var user = _context.Users.FirstOrDefault(t => t.Id == idUser); if (user == null) { Response.StatusCode = (int)HttpStatusCode.NotFound; return(Json(new { message = "Username don't exist" })); } var product = _context.Products.FirstOrDefault(t => t.Id == idProduct); if (product == null) { Response.StatusCode = (int)HttpStatusCode.NotFound; return(Json(new { message = "Product don't exist" })); } order = _context.Orders.FirstOrDefault(t => t.Id == order.Id); if (product == null) { Response.StatusCode = (int)HttpStatusCode.NotFound; return(Json(new { message = "Product don't exist" })); } var orderProduct = new Order_Product(); orderProduct.Order = order; orderProduct.Product = product; //if(value.Order_Products.Count < 0) //{ // Response.StatusCode = (int)HttpStatusCode.BadRequest; // return Json(new { message = "Order contains no products" }); //} _context.Order_Products.Add(orderProduct); _context.SaveChanges(); Response.StatusCode = (int)HttpStatusCode.OK; return(Json(new { orderProduct })); }
protected void updateDatabase() { //product_id_array has all product ids call_center = call_center.Select(Convert.ToInt32(DDL_Call_Center.SelectedValue)); selected_Warehouse = selected_Warehouse.Select(Convert.ToInt32(passWarehouseID_hf.Value)); address = address.Select(selected_Warehouse.address_id); //case_intake case_intake = case_intake_insert(); //encounter encounter = encounter_insert(); //requestor requestor = requestor_insert(); //requestor_Order requestor_Order = requestor_Order_insert(); //Order_product Order_Product = Order_Product_insert(); }
protected void INSERT(object sender, EventArgs e) { Order_Product = Order_Product_insert(); }
public Order_Product Order_Product_insert() { Order_Product.orderID = Convert.ToInt32(Insert_orderID_txt.Text); Order_Product.ProductID = Convert.ToInt32(Insert_ProductID_txt.Text); Order_Product.Quantity = Convert.ToInt32(Insert_Quantity_txt.Text); Order_Product.warehouseid = Convert.ToInt32(Insert_warehouseid_txt.Text); Order_Product.DatePicked = Convert.ToDateTime(Insert_DatePicked_txt.Text); Order_Product.Qtypicked = Convert.ToInt32(Insert_Qtypicked_txt.Text); Order_Product = Order_Product.Insert(Order_Product); Insert_Order_Product_GridView.DataBind(); Update_Order_Product_GridView.DataBind(); Delete_Order_Product_GridView.DataBind(); return Order_Product; }
public Order_Product Order_Product_update(int ID) { Order_Product = Order_Product.Select(ID); Order_Product.order_Product_ID = Convert.ToInt32(Update_order_Product_ID_txt.Text); Order_Product.orderID = Convert.ToInt32(Update_orderID_txt.Text); Order_Product.ProductID = Convert.ToInt32(Update_ProductID_txt.Text); Order_Product.Quantity = Convert.ToInt32(Update_Quantity_txt.Text); Order_Product.warehouseid = Convert.ToInt32(Update_warehouseid_txt.Text); Order_Product.DatePicked = Convert.ToDateTime(Update_DatePicked_txt.Text); Order_Product.Qtypicked = Convert.ToInt32(Update_Qtypicked_txt.Text); Order_Product.Update(Order_Product); Insert_Order_Product_GridView.DataBind(); Update_Order_Product_GridView.DataBind(); Delete_Order_Product_GridView.DataBind(); return Order_Product; }
protected void updateOrders_ProductsTable(int ordID) { linqTestingDataContext db = new linqTestingDataContext(); db.Connection.ConnectionString = System.Configuration.ConfigurationManager.AppSettings["linqTest"]; var shopping = from scd in db.ShoppingCartDatas select scd; foreach (ShoppingCartData item in shopping) { Order_Product ord_prod = new Order_Product { PID=item.PID, OrderID=ordID, Qty=item.Quantity, TotalSale=item.Quantity*item.UnitPrice, }; db.Order_Products.InsertOnSubmit(ord_prod); db.SubmitChanges(); } }
protected void UPDATE(object sender, EventArgs e) { Order_Product = Order_Product_update(Convert.ToInt32(Update_Order_Product_GridView.SelectedValue)); }
public Order_Product Order_Product_insert() { //loop through each product_id in the product_id_array and insert each time for (int i = 0; i < product_id_array.Length; i++) { warehouse_product_location = warehouse_product_location.Select_By_Product_ID(Convert.ToInt32(product_id_array[i])); warehouse = warehouse.Select(warehouse_product_location.warehouse_id); Order_Product.orderID = Convert.ToInt32(requestor_Order.OrderID); Order_Product.ProductID = Convert.ToInt32(product_id_array[i]); Order_Product.Quantity = 1; Order_Product.warehouseid = warehouse.warehouse_id; Order_Product.DatePicked = DateTime.Now; Order_Product.Qtypicked = 1; Order_Product = Order_Product.Insert(Order_Product); } return Order_Product; }
protected void Update_Select_Record(object sender, EventArgs e) { Order_Product = Update_Order_Product_select(Convert.ToInt32(Update_Order_Product_GridView.SelectedValue)); }