public Restock get(int id) { string sql = "Select * From Inv_Restock Where ID=" + id.ToString(); DataTable dt = DataAccess.ExecuteSQLQuery(sql); Restock restock = new Restock(); restock.ID = id; restock.ProductID = Convert.ToInt32(dt.Rows[0]["ProductID"].ToString()); restock.SupplierID = Convert.ToInt32(dt.Rows[0]["SupplierID"].ToString()); restock.WarehouseID = Convert.ToInt32(dt.Rows[0]["WarehouseID"].ToString()); restock.TotalCost = Convert.ToDouble(dt.Rows[0]["TotalCost"].ToString()); restock.UnitCost = Convert.ToDouble(dt.Rows[0]["UnitCost"].ToString()); restock.Quantity = Convert.ToInt32(dt.Rows[0]["Quantity"].ToString()); restock.Remarks = dt.Rows[0]["Remarks"].ToString(); restock.Active = Convert.ToInt32(dt.Rows[0]["Active"].ToString()); restock.CreationDate = Convert.ToDateTime(dt.Rows[0]["CreationDate"].ToString()); restock.LastModifiedDate = Convert.ToDateTime(dt.Rows[0]["LastModifiedDate"].ToString()); restock.OperatorID = Convert.ToInt32(dt.Rows[0]["OperatorID"].ToString()); return(restock); }
public async Task <IHttpActionResult> Restock([FromUri] int id, [FromBody] Restock model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); //400 } Product product = await _context.Products.FindAsync(id); if (product == null) { return(NotFound()); //404 } product.Quantity += model.Quantity; if (await _context.SaveChangesAsync() == 1) { return(Ok()); //200, Party on. } return(InternalServerError()); //500 }
internal void RestockStartExec() { if (World.Player == null) // offline { Restock.AddLog("You are not logged in game!"); return; } if (restockListSelect.Text == String.Empty) // Nessuna lista { Restock.AddLog("Item list not selected!"); return; } Restock.Start(); Restock.AddLog("Restock Engine Start..."); if (showagentmessageCheckBox.Checked) { Misc.SendMessage("RESTOCK: Engine Start...", false); } RestockStartWork(); }
private void RestockDestinationContainerTarget_Callback(bool loc, Assistant.Serial serial, Assistant.Point3D pt, ushort itemid) { Assistant.Item restockBag = Assistant.World.FindItem((Assistant.Serial)((uint)serial)); if (restockBag == null) { if (showagentmessageCheckBox.Checked) { Misc.SendMessage("Invalid Destination Container, set backpack", false); } Restock.AddLog("Invalid Destination Container, set backpack"); Restock.RestockDestination = (int)World.Player.Backpack.Serial.Value; return; } if (restockBag != null && restockBag.Serial.IsItem && restockBag.IsContainer) { if (showagentmessageCheckBox.Checked) { Misc.SendMessage("Destination Container set to: " + restockBag.ToString(), false); } Restock.AddLog("Destination Container set to: " + restockBag.ToString()); Restock.RestockDestination = (int)restockBag.Serial.Value; } else { if (showagentmessageCheckBox.Checked) { Misc.SendMessage("Invalid Destination Container, set backpack", false); } Restock.AddLog("Invalid Destination Container, set backpack"); Restock.RestockDestination = (int)World.Player.Backpack.Serial.Value; } this.Invoke((MethodInvoker) delegate { Settings.Restock.ListUpdate(restockListSelect.Text, Restock.RestockDelay, Restock.RestockSource, serial, true); Restock.RefreshLists(); }); }
public int insert(Restock restock) { SqlParameter[] param = new SqlParameter[11]; param[0] = DataAccess.AddParamter("@ProductID", restock.ProductID, SqlDbType.Int, 50); param[1] = DataAccess.AddParamter("@SupplierID", restock.SupplierID, SqlDbType.Int, 50); param[2] = DataAccess.AddParamter("@WarehouseID", restock.WarehouseID, SqlDbType.Int, 50); param[3] = DataAccess.AddParamter("@TotalCost", restock.TotalCost, SqlDbType.Float, 50); param[4] = DataAccess.AddParamter("@UnitCost", restock.UnitCost, SqlDbType.Float, 50); param[5] = DataAccess.AddParamter("@Quantity", restock.Quantity, SqlDbType.Int, 50); param[6] = DataAccess.AddParamter("@Remarks", restock.Remarks, SqlDbType.NVarChar, 500); param[7] = DataAccess.AddParamter("@Active", restock.Active, SqlDbType.Int, 50); param[8] = DataAccess.AddParamter("@CreationDate", DateTime.Now, SqlDbType.DateTime, 50); param[9] = DataAccess.AddParamter("@LastModifiedDate", DateTime.Now, SqlDbType.DateTime, 50); param[10] = DataAccess.AddParamter("@OperatorID", restock.OperatorID, SqlDbType.Int, 50); string sql = "Insert Into Inv_Restock (ProductID,SupplierID,WarehouseID,TotalCost,UnitCost,Quantity,Remarks,CreationDate,LastModifiedDate,OperatorID,Active) Values (@ProductID,@SupplierID,@WarehouseID,@TotalCost,@UnitCost,@Quantity,@Remarks,@CreationDate,@LastModifiedDate,@OperatorID,1)"; int res = DataAccess.ExecuteSQLNonQuery(sql, param); if (res > 0) { UpdateProductWarehouse(restock.ProductID, restock.WarehouseID, restock.UnitCost, restock.Quantity, restock.OperatorID); } return(res); }
protected void btnEdit_Click(object sender, EventArgs e) { string fileLocation = ""; if (FileUpload1.HasFile) { string fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + Path.GetFileName(FileUpload1.PostedFile.FileName); string fileExtension = Path.GetExtension(FileUpload1.PostedFile.FileName); fileLocation = Server.MapPath("~/Inventory/Uplaods/" + fileName); FileUpload1.SaveAs(fileLocation); } Restock restock = new Restock(); restock.ProductID = Convert.ToInt32(ddlProduct.SelectedValue.ToString()); restock.SupplierID = Convert.ToInt32(ddlSupplier.SelectedValue.ToString()); restock.WarehouseID = Convert.ToInt32(ddlWarehouse.SelectedValue.ToString()); restock.Quantity = Convert.ToInt32(txtQuantity.Text); restock.TotalCost = Convert.ToDouble(txtTotalCost.Text); restock.UnitCost = Convert.ToDouble(txtUnitCost.Text); restock.Remarks = txtRemarks.Text; restock.InvoiceImage = fileLocation; restock.Active = 1; HttpCookie myCookie = Request.Cookies["user"]; restock.OperatorID = Convert.ToInt32(myCookie.Values["userid"].ToString()); int res = new ClsRestock().update(Convert.ToInt32(Request.QueryString["id"].ToString()), restock); if (res > 0) { Response.Redirect("~/Inventory/RestockedItems.aspx?alert=success"); } else { Response.Redirect("~/Inventory/AddNewItemToStock.aspx?id=0&&alret=notpass"); } }
private void EnhancedAgentAddList_Click(object sender, EventArgs e) { bool fail = false; string newList = ""; if (AgentListToAdd.Text == "") { fail = true; } if (!Regex.IsMatch(AgentListToAdd.Text, "^[a-zA-Z0-9_]+$")) { fail = true; } newList = AgentListToAdd.Text.ToLower(); switch (m_agentid) { case 1: if (Settings.AutoLoot.ListExists(newList)) { fail = true; } break; case 2: if (Settings.Scavenger.ListExists(newList)) { fail = true; } break; case 3: if (Settings.Organizer.ListExists(newList)) { fail = true; } break; case 4: if (Settings.BuyAgent.ListExists(newList)) { fail = true; } break; case 5: if (Settings.SellAgent.ListExists(newList)) { fail = true; } break; case 6: if (Settings.Dress.ListExists(newList)) { fail = true; } break; case 7: if (Settings.Friend.ListExists(newList)) { fail = true; } break; case 8: if (Settings.Restock.ListExists(newList)) { fail = true; } break; case 9: if (RazorEnhanced.Shard.Exists(newList)) { fail = true; } break; } if (fail) { MessageBox.Show("Invalid list name!", "Invalid list name!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); fail = true; } else { switch (m_agentid) { case 1: AutoLoot.AddList(newList); break; case 2: Scavenger.AddList(newList); break; case 3: Organizer.AddList(newList); break; case 4: BuyAgent.AddList(newList); break; case 5: SellAgent.AddList(newList); break; case 6: Dress.AddList(newList); HotKey.Init(); break; case 7: Friend.AddList(newList); break; case 8: Restock.AddList(newList); break; case 9: RazorEnhanced.Shard.Insert(newList, "Not set", "Not Set", "0.0.0.0", "0", false, false); break; } Close(); } }
private void GridView_DragDrop(object sender, DragEventArgs e) { DataGridView grid = (DataGridView)sender; Point clientPoint = grid.PointToClient(new Point(e.X, e.Y)); rowIndexOfItemUnderMouseToDrop = grid.HitTest(clientPoint.X, clientPoint.Y).RowIndex; if (rowIndexOfItemUnderMouseToDrop == -1) { return; } if (e.Effect == DragDropEffects.Move) { DataGridViewRow rowToMove = e.Data.GetData(typeof(DataGridViewRow)) as DataGridViewRow; if (rowIndexOfItemUnderMouseToDrop >= (grid.RowCount - 1)) // Blocca il drag fuori dalle celle salvate { return; } if (rowIndexFromMouseDown >= (grid.RowCount - 1)) // Blocca il drag di una cella non salvata { return; } grid.Rows.RemoveAt(rowIndexFromMouseDown); grid.Rows.Insert(rowIndexOfItemUnderMouseToDrop, rowToMove); switch (grid.Name) { case "autolootdataGridView": AutoLoot.CopyTable(); break; case "scavengerdataGridView": Scavenger.CopyTable(); break; case "organizerdataGridView": Organizer.CopyTable(); break; case "vendorbuydataGridView": BuyAgent.CopyTable(); break; case "vendorsellGridView": SellAgent.CopyTable(); break; case "restockdataGridView": Restock.CopyTable(); break; case "graphfilterdatagrid": RazorEnhanced.Filters.CopyGraphTable(); break; case "journalfilterdatagrid": RazorEnhanced.Filters.CopyJournalFilterTable(); break; } } }