public void insertOrder2(Warehouse_Management wh) { getConnection(); string sql = "insert into Orders(TransactionTypeID, SourceWarehouseID, DestinationWarehouseID,Date) values(2, @sourceid, @desid, @date)"; SqlCommand cmd = new SqlCommand(sql, cnn); cmd.Parameters.AddWithValue("sourceid", wh.sourceid); cmd.Parameters.AddWithValue("desid", wh.destinationid); cmd.Parameters.AddWithValue("date", wh.date); cmd.ExecuteNonQuery(); cnn.Close(); }
internal string getPartnamByID(Warehouse_Management wh) { getConnection(); string sql = "select name from parts where id = @partid"; SqlCommand cmd = new SqlCommand(sql, cnn); cmd.Parameters.AddWithValue("partid", wh.partid); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { wh.partname = (string)dr["Name"]; } cnn.Close(); return(wh.partname); }
public string getSourceNameByID(Warehouse_Management wh) { getConnection(); string sql = "select name from Warehouses where id=@id"; SqlCommand cmd = new SqlCommand(sql, cnn); cmd.Parameters.AddWithValue("id", wh.sourceid); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { wh.source = (string)dr["Name"]; } cnn.Close(); return(wh.source); }