void OnHammerHit(BasePlayer player, HitInfo info) { if (info.HitEntity == null) { Puts("Null hit entity from hammer"); return; } foreach (EntityLink link in info.HitEntity.GetEntityLinks()) { for (int i = 0; i < link.connections.Count; i++) { if (link.connections[i].owner != null) { player.SendConsoleCommand("ddraw.box", 3f, Color.red, link.connections[i].owner?.transform.position); } } } return; if (info.HitEntity != null) { SpawnEntity(info.HitPositionWorld, player); if (info.HitEntity.GetType() == typeof(BoxStorage)) { BoxStorage entity = (BoxStorage)info.HitEntity; Write(entity._collider); } } }
public BoxStorage GetBoxStorageFromID(int itemId) { BoxStorage bs1 = new BoxStorage(); MySqlDataReader rdr = null; try { string tableName = "boxstorage"; string query = "SELECT * FROM " + tableName + " WHERE id = " + itemId; MySqlCommand cmd = new MySqlCommand(query, MysqlDbc.Instance.getConn()); rdr = cmd.ExecuteReader(); while (rdr.Read()) { bs1.Id = itemId; bs1.StoringJob_id = rdr.GetInt32("name"); bs1.Product_id = rdr.GetInt32("product_id"); bs1.Box_id = rdr.GetInt32("box_id"); bs1.NettWeight = rdr.GetDouble("nettWeight"); bs1.Storeroom_id = rdr.GetInt32("storeroom_id"); bs1.Add_date = rdr.GetDateTime("add_date"); bs1.Best_before = rdr.GetDateTime("best_before"); bs1.Out_date = rdr.GetDateTime("out_date"); bs1.Order_id = rdr.GetInt32("order_id"); } } catch (MySqlException ex) { Console.WriteLine("Error: {0}", ex.ToString()); } finally { if (rdr != null) { rdr.Close(); } } return(bs1); }
private void addBoxStorage() { BoxStorage bs1 = new BoxStorage(); bs1.StoringJob_id = int.Parse(textBox1.Text); bs1.Product_id = int.Parse(textBox2.Text); bs1.Box_id = int.Parse(textBox3.Text); bs1.NettWeight = double.Parse(textBox4.Text); bs1.Storeroom_id = int.Parse(textBox5.Text); bs1.Add_date = Convert.ToDateTime(dateTimePicker1.Text); bs1.Best_before = Convert.ToDateTime(dateTimePicker2.Text); bs1.Out_date = Convert.ToDateTime(dateTimePicker3.Text); bs1.Order_id = int.Parse(textBox6.Text); InsertSQL add = new InsertSQL(); int editrecord = add.addNewBoxStorage(bs1); MessageBox.Show(" Your seccusful"); this.Close(); }